Skip to content

Commit

Permalink
[IMP/REF] Improve and fix a lot of things:
Browse files Browse the repository at this point in the history
- Add an eslint config
- Fix code to conform to the new config
- Position all elements in overlay as single block so they're well
aligned on all browsers
- Add FPS counter
- Restore ability to show the spectrum of the default file
- Make user files play in the audio editor and synchronize visuals with
that, allowing them to control the audio normally
- Removed some dead code
- Add a (probably useless) per-frame cache for FFT
  • Loading branch information
sdegueldre committed Mar 11, 2021
1 parent 4b781dc commit ca2e5a1
Show file tree
Hide file tree
Showing 13 changed files with 3,304 additions and 2,392 deletions.
320 changes: 320 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,320 @@
module.exports = {
'env': {
'browser': true,
'es2021': true,
},
'extends': 'eslint:recommended',
'parserOptions': {
'ecmaVersion': 12,
'sourceType': 'module',
},
'rules': {
'accessor-pairs': 'error',
'array-bracket-newline': 'error',
'array-bracket-spacing': [
'error',
'never',
],
'array-callback-return': 'error',
'arrow-body-style': 'error',
'arrow-parens': 'off',
'arrow-spacing': [
'error',
{
'after': true,
'before': true,
},
],
'block-scoped-var': 'error',
'block-spacing': 'error',
'brace-style': [
'error',
'1tbs',
],
'callback-return': 'error',
'camelcase': 'error',
'capitalized-comments': 'off',
'class-methods-use-this': 'error',
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': [
'error',
{
'after': true,
'before': false,
},
],
'comma-style': [
'error',
'last',
],
'complexity': 'error',
'computed-property-spacing': [
'error',
'never',
],
'consistent-return': 'error',
'consistent-this': 'error',
'curly': 'off',
'default-case': 'error',
'default-case-last': 'error',
'default-param-last': 'error',
'dot-location': 'error',
'dot-notation': 'error',
'eol-last': [
'error',
'never',
],
'eqeqeq': 'off',
'func-call-spacing': 'error',
'func-name-matching': 'error',
'func-names': 'error',
'func-style': [
'error',
'declaration',
],
'function-paren-newline': 'error',
'generator-star-spacing': 'error',
'global-require': 'error',
'grouped-accessor-pairs': 'error',
'guard-for-in': 'error',
'handle-callback-err': 'error',
'id-blacklist': 'error',
'id-denylist': 'error',
'id-length': 'off',
'id-match': 'error',
'implicit-arrow-linebreak': [
'error',
'beside',
],
'indent': ['warn', 2],
'init-declarations': 'off',
'jsx-quotes': 'error',
'key-spacing': 'error',
'keyword-spacing': [
'error',
{
'after': true,
'before': true,
},
],
'line-comment-position': 'off',
'linebreak-style': [
'error',
'unix',
],
'lines-around-comment': 'error',
'lines-around-directive': 'error',
'lines-between-class-members': 'error',
'max-classes-per-file': 'error',
'max-depth': 'error',
'max-len': 'off',
'max-lines-per-function': 'off',
'max-nested-callbacks': 'error',
'max-params': 'error',
'max-statements': 'off',
'max-statements-per-line': 'error',
'multiline-comment-style': 'error',
'new-cap': 'error',
'new-parens': 'error',
'newline-after-var': 'off',
'newline-before-return': 'off',
'newline-per-chained-call': 'error',
'no-alert': 'error',
'no-array-constructor': 'error',
'no-await-in-loop': 'error',
'no-bitwise': 'error',
'no-buffer-constructor': 'error',
'no-caller': 'error',
'no-catch-shadow': 'error',
'no-confusing-arrow': 'error',
'no-console': 'off',
'no-constructor-return': 'error',
'no-continue': 'error',
'no-div-regex': 'error',
'no-duplicate-imports': 'error',
'no-else-return': 'error',
'no-empty-function': 'error',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-label': 'error',
'no-extra-parens': 'off',
'no-floating-decimal': 'off',
'no-implicit-coercion': 'error',
'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-inline-comments': 'off',
'no-invalid-this': 'error',
'no-iterator': 'error',
'no-label-var': 'error',
'no-labels': 'error',
'no-lone-blocks': 'error',
'no-lonely-if': 'error',
'no-loop-func': 'error',
'no-loss-of-precision': 'error',
'no-magic-numbers': 'off',
'no-mixed-operators': 'off',
'no-mixed-requires': 'error',
'no-multi-assign': 'error',
'no-multi-spaces': 'error',
'no-multi-str': 'error',
'no-multiple-empty-lines': 'error',
'no-native-reassign': 'error',
'no-negated-condition': 'off',
'no-negated-in-lhs': 'error',
'no-nested-ternary': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-require': 'error',
'no-new-wrappers': 'error',
'no-nonoctal-decimal-escape': 'error',
'no-octal-escape': 'error',
'no-param-reassign': 'error',
'no-path-concat': 'error',
'no-plusplus': [
'error',
{
'allowForLoopAfterthoughts': true,
},
],
'no-process-env': 'error',
'no-process-exit': 'error',
'no-promise-executor-return': 'error',
'no-proto': 'error',
'no-restricted-exports': 'error',
'no-restricted-globals': 'error',
'no-restricted-imports': 'error',
'no-restricted-modules': 'error',
'no-restricted-properties': 'error',
'no-restricted-syntax': 'error',
'no-return-assign': 'error',
'no-return-await': 'error',
'no-script-url': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-shadow': 'error',
'no-spaced-func': 'error',
'no-sync': 'error',
'no-tabs': 'error',
'no-template-curly-in-string': 'error',
'no-ternary': 'off',
'no-throw-literal': 'error',
'no-trailing-spaces': 'error',
'no-undef-init': 'error',
'no-undefined': 'error',
'no-underscore-dangle': 'error',
'no-unmodified-loop-condition': 'error',
'no-unneeded-ternary': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-optional-chaining': 'error',
'no-unused-expressions': 'error',
'no-use-before-define': 'off',
'no-useless-backreference': 'error',
'no-useless-call': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-constructor': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-void': 'error',
'no-warning-comments': 'off',
'no-whitespace-before-property': 'error',
'object-curly-newline': 'error',
'object-curly-spacing': 'error',
'object-property-newline': 'error',
'object-shorthand': 'off',
'one-var': 'off',
'one-var-declaration-per-line': [
'error',
'initializations',
],
'operator-assignment': [
'error',
'always',
],
'operator-linebreak': 'error',
'padded-blocks': 'off',
'padding-line-between-statements': 'error',
'prefer-arrow-callback': 'error',
'prefer-const': 'off',
'prefer-destructuring': 'error',
'prefer-exponentiation-operator': 'off',
'prefer-named-capture-group': 'error',
'prefer-numeric-literals': 'error',
'prefer-object-spread': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-reflect': 'error',
'prefer-regex-literals': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'quote-props': 'off',
'quotes': [
'error',
'single',
],
'radix': 'error',
'require-atomic-updates': 'error',
'require-await': 'off',
'require-jsdoc': 'off',
'require-unicode-regexp': 'error',
'rest-spread-spacing': [
'error',
'never',
],
'semi': 'off',
'semi-spacing': [
'error',
{
'after': true,
'before': false,
},
],
'semi-style': [
'error',
'last',
],
'sort-imports': 'error',
'sort-keys': [
'error',
'asc',
],
'sort-vars': 'error',
'space-before-blocks': 'error',
'space-before-function-paren': 'off',
'space-in-parens': [
'error',
'never',
],
'space-infix-ops': 'error',
'space-unary-ops': 'error',
'spaced-comment': [
'error',
'always',
],
'strict': 'error',
'switch-colon-spacing': 'error',
'symbol-description': 'error',
'template-curly-spacing': [
'error',
'never',
],
'template-tag-spacing': 'error',
'unicode-bom': [
'error',
'never',
],
'valid-jsdoc': 'error',
'vars-on-top': 'error',
'wrap-iife': 'error',
'wrap-regex': 'error',
'yield-star-spacing': 'error',
'yoda': [
'error',
'never',
],
},
};
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/node_modules/*
/.cache/*
/dist/*
/assets/audio/*
!/assets/audio/Komiku - Mushrooms.mp3
Binary file added docs/Komiku - Mushrooms.4767492c.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><title></title><link rel="stylesheet" href="style.1f4888d2.css"></head><body> <canvas></canvas> <script src="src.484009ad.js" charset="utf-8"></script> </body></html>
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><title></title><link rel="stylesheet" href="style.6b72d3b2.css"></head><body> <canvas></canvas> <div class="overlay"> <audio controls src="Komiku - Mushrooms.4767492c.mp3" loop></audio> <label for="">Choose a file (will be processed locally) <input type="file" name="" value=""> </label> </div> <script src="src.b180bbfd.js" charset="utf-8"></script> </body></html>
6 changes: 6 additions & 0 deletions docs/src.b180bbfd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/src.b180bbfd.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/style.6b72d3b2.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/style.6b72d3b2.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ca2e5a1

Please sign in to comment.