From 15669f6b7376b8e668ed55dc43ee960951c2d1d4 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 14 Jan 2020 12:14:19 +0100 Subject: [PATCH 01/22] .eslintrc.json: Add codefactor.io's default eslint config This config file is used by codefactor.io and can be used to override some of the default settings. The default config has been obtained from: https://github.com/codefactor-io/default-configs/blob/master/.eslintrc.json --- .eslintrc.json | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000000..baba5b054d3d --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,46 @@ +{ + "env": { + "es6": true, + "node": true, + "browser": true, + "jquery": true, + "jasmine": true, + "mocha": true, + "qunit": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaFeatures": { + "jsx": true, + "globalReturn": true + }, + "sourceType": "script" + }, + "rules": { + "no-undef": "off", + "no-fallthrough": "off", + "no-mixed-spaces-and-tabs": "off", + "no-console": "off", + "indent": "off", + "semi": "off", + "no-tabs": "off", + "no-redeclare": "off", + "curly": "off", + "dot-location": "off", + "getter-return": "off", + "yoda": "off", + "require-atomic-updates": "off", + "no-with": "off", + "no-prototype-builtins": "off", + "no-misleading-character-class": "off", + "no-async-promise-executor": "off" + }, + "globals": { + "ActiveXObject": true, + "XDomainRequest": true, + "ScriptEngine": true, + "WSH": true, + "WScript": true, + "DocumentTouch": true + } +} From f835ac185a2c53dcabd2dff26a2b198aca72e34c Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 14 Jan 2020 12:15:55 +0100 Subject: [PATCH 02/22] .eslintrc.json: Disable no-unused-vars for function arguments Previously, this setting led to a lot of false positives in out controller scripts, e.g.: 'group' is defined but never used. Found in res\controllers\KANE_QuNeo_scripts.js:1120 KANE_QuNeo.scrollPlaylist = function (channel, control, value, status, group) { --- .eslintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.json b/.eslintrc.json index baba5b054d3d..b0e6fc9eebe2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,6 +17,7 @@ "sourceType": "script" }, "rules": { + "no-unused-vars": ["error", { "vars": "all", "args": "none" }], "no-undef": "off", "no-fallthrough": "off", "no-mixed-spaces-and-tabs": "off", From 6013f2c2ad1c3b8abb03e37d52103d5e7eb57aeb Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 14 Jan 2020 12:44:07 +0100 Subject: [PATCH 03/22] .eslintrc.json: Set up env for QScript controller mappings --- .eslintrc.json | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index b0e6fc9eebe2..3d9ae2ecf2e4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,19 +1,7 @@ { - "env": { - "es6": true, - "node": true, - "browser": true, - "jquery": true, - "jasmine": true, - "mocha": true, - "qunit": true - }, "extends": "eslint:recommended", "parserOptions": { - "ecmaFeatures": { - "jsx": true, - "globalReturn": true - }, + "ecmaVersion": 5, "sourceType": "script" }, "rules": { @@ -37,11 +25,10 @@ "no-async-promise-executor": "off" }, "globals": { - "ActiveXObject": true, - "XDomainRequest": true, - "ScriptEngine": true, - "WSH": true, - "WScript": true, - "DocumentTouch": true + "components": "readonly", + "engine": "readonly", + "midi": "readonly", + "print": "readonly", + "script": "readonly" } } From 33f0f5c08a845b17d27cd951652f4815eb2820f7 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 14 Jan 2020 13:00:35 +0100 Subject: [PATCH 04/22] .eslintrc.json: Configure eslint to use honor Mixxx coding conventions JS coding conventions can be found at: https://www.mixxx.org/wiki/doku.php/contributing_mappings#coding_conventions_for_javascript --- .eslintrc.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 3d9ae2ecf2e4..4fb1c0f169f7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,15 +6,13 @@ }, "rules": { "no-unused-vars": ["error", { "vars": "all", "args": "none" }], - "no-undef": "off", "no-fallthrough": "off", - "no-mixed-spaces-and-tabs": "off", "no-console": "off", - "indent": "off", - "semi": "off", "no-tabs": "off", + "quotes": ["warn", "double"], + "eqeqeq": ["error", "always"], + "camelcase": "error", "no-redeclare": "off", - "curly": "off", "dot-location": "off", "getter-return": "off", "yoda": "off", From a9868286ae34205a0daaf50267572ee1749e5910 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 14 Jan 2020 13:26:25 +0100 Subject: [PATCH 05/22] .eslintrc.json: Add '_' and 'color' to list of globals --- .eslintrc.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 4fb1c0f169f7..19bf64ae9a16 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -23,6 +23,8 @@ "no-async-promise-executor": "off" }, "globals": { + "_": "readonly", + "color": "readonly", "components": "readonly", "engine": "readonly", "midi": "readonly", From dc97e30fa12bd21aabfe9695734b3a0d1c992e53 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 14 Jan 2020 13:32:00 +0100 Subject: [PATCH 06/22] .eslintrc.json: Re-enable some recommended linter rules --- .eslintrc.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 19bf64ae9a16..f1eb2025e8ba 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,20 +6,14 @@ }, "rules": { "no-unused-vars": ["error", { "vars": "all", "args": "none" }], - "no-fallthrough": "off", - "no-console": "off", - "no-tabs": "off", "quotes": ["warn", "double"], "eqeqeq": ["error", "always"], "camelcase": "error", "no-redeclare": "off", "dot-location": "off", "getter-return": "off", - "yoda": "off", "require-atomic-updates": "off", - "no-with": "off", "no-prototype-builtins": "off", - "no-misleading-character-class": "off", "no-async-promise-executor": "off" }, "globals": { From 251fd4fec274d7ed1456255ac2685a44dc20c508 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 14 Jan 2020 13:49:28 +0100 Subject: [PATCH 07/22] .eslintrc.json: Reduce global variable scope to certain source dirs --- .eslintrc.json | 10 +++------- res/controllers/.eslintrc.json | 10 ++++++++++ script/.eslintrc.json | 7 +++++++ 3 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 res/controllers/.eslintrc.json create mode 100644 script/.eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json index f1eb2025e8ba..c9d80f9738af 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,12 +17,8 @@ "no-async-promise-executor": "off" }, "globals": { - "_": "readonly", - "color": "readonly", - "components": "readonly", - "engine": "readonly", - "midi": "readonly", - "print": "readonly", - "script": "readonly" + "console": "writable", + "svg": "writable", + "print": "readonly" } } diff --git a/res/controllers/.eslintrc.json b/res/controllers/.eslintrc.json new file mode 100644 index 000000000000..a5f60376e3f0 --- /dev/null +++ b/res/controllers/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "globals": { + "_": "readonly", + "color": "readonly", + "components": "readonly", + "engine": "readonly", + "midi": "readonly", + "script": "readonly" + } +} diff --git a/script/.eslintrc.json b/script/.eslintrc.json new file mode 100644 index 000000000000..16bdb96c0438 --- /dev/null +++ b/script/.eslintrc.json @@ -0,0 +1,7 @@ +{ + "globals": { + "__extension__": "readonly", + "__setupPackage__": "readonly", + "__postInit__": "readonly" + } +} From a254f88236488f274620111ef6b9e5eda6a4a9ee Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 14 Jan 2020 14:27:38 +0100 Subject: [PATCH 08/22] .eslintignore: Ignore the res/controllers/lodash.mixxx.js script --- .eslintignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000000..ecba16da6360 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +res/controllers/lodash.mixxx.js From b738aeb4eb001416829502f962430bac3431de4a Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 14 Jan 2020 14:16:21 +0100 Subject: [PATCH 09/22] res/controllers/novation-launchpad: Remove .eslintrc.yaml The .eslintrc.yaml for novation-launchpad has issues with recent versions of eslint and requires installation of custom npm packages. $ eslint . Oops! Something went wrong! :( ESLint: 6.8.0. ESLint couldn't find the config "standard" to extend from. Please check that the name of the config is correct. The config "standard" was referenced from the config file in "/data/jan/Projects/mixxx/res/controllers/novation-launchpad/.eslintrc.yaml". If you still have problems, please stop by https://gitter.im/eslint/eslint to chat with the team. --- .../novation-launchpad/.eslintrc.yaml | 57 ------------------- 1 file changed, 57 deletions(-) delete mode 100644 res/controllers/novation-launchpad/.eslintrc.yaml diff --git a/res/controllers/novation-launchpad/.eslintrc.yaml b/res/controllers/novation-launchpad/.eslintrc.yaml deleted file mode 100644 index ac9d79ec089e..000000000000 --- a/res/controllers/novation-launchpad/.eslintrc.yaml +++ /dev/null @@ -1,57 +0,0 @@ -env: - node: true - es6: true - -extends: standard -parser: babel-eslint -plugins: - - import - - flowtype -rules: - # sort-imports: error - import/no-duplicates: error - no-duplicate-imports: off # see https://github.com/babel/eslint-plugin-babel/issues/59 - flowtype/boolean-style: - - 2 - - boolean - flowtype/define-flow-type: 1 - flowtype/delimiter-dangle: - - 2 - - never - flowtype/generic-spacing: - - 2 - - never - flowtype/no-primitive-constructor-types: 2 - # flowtype/no-weak-types: 2 - flowtype/object-type-delimiter: - - 2 - - comma - # flowtype/require-parameter-type: 2 - # flowtype/require-return-type: - # - 2 - # - always - # - annotateUndefined: never - flowtype/require-valid-file-annotation: 2 - flowtype/semi: - - 2 - - never - flowtype/space-after-type-colon: - - 2 - - always - flowtype/space-before-generic-bracket: - - 2 - - never - flowtype/space-before-type-colon: - - 2 - - never - flowtype/type-id-match: - - 2 - - "^([A-Z][a-z0-9]+)+$" - flowtype/union-intersection-spacing: - - 2 - - always - flowtype/use-flow-type: 1 - flowtype/valid-syntax: 1 -settings: - flowtype: - onlyFilesWithFlowAnnotation: false From 6ec5a2f0f2a37b48444d2e11a04af755711ec889 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 17 Jan 2020 11:41:39 +0100 Subject: [PATCH 10/22] .eslintrc.json: Only ignore unused args if they start with an underscore --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index c9d80f9738af..525ce75b2821 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,7 +5,7 @@ "sourceType": "script" }, "rules": { - "no-unused-vars": ["error", { "vars": "all", "args": "none" }], + "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], "quotes": ["warn", "double"], "eqeqeq": ["error", "always"], "camelcase": "error", From 64658eb8daebc301f41d77667ac01d97576419c6 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 17 Jan 2020 15:15:01 +0100 Subject: [PATCH 11/22] .eslintrc.json: Re-enabled remaining recommended eslint rules These shouldn't cause a lot of linter issues in our existing codebase (if any). There's no reason why they shouldn't be enabled IMHO. --- .eslintrc.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 525ce75b2821..e33e3fd9c4b2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -9,12 +9,8 @@ "quotes": ["warn", "double"], "eqeqeq": ["error", "always"], "camelcase": "error", - "no-redeclare": "off", "dot-location": "off", - "getter-return": "off", - "require-atomic-updates": "off", - "no-prototype-builtins": "off", - "no-async-promise-executor": "off" + "require-atomic-updates": "off" }, "globals": { "console": "writable", From ccdd31b8ebe714198414c4d7ec2db1271214ee23 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 17 Jan 2020 15:21:25 +0100 Subject: [PATCH 12/22] .eslintrc.json: Enable require-atomic-updates rule Although Promises aren't support by Qt Script anyway, some scripts in the res/controllers directory are using Promises anyway (i.e. the Novation Launchpad scripts). So in any case it doesn't hurt to enable this rule. --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index e33e3fd9c4b2..e3bff08374b0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -10,7 +10,7 @@ "eqeqeq": ["error", "always"], "camelcase": "error", "dot-location": "off", - "require-atomic-updates": "off" + "require-atomic-updates": "error" }, "globals": { "console": "writable", From 0af45d0d0869b59b4cc72b335b7fe47c1c2ebdb3 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 17 Jan 2020 16:47:43 +0100 Subject: [PATCH 13/22] .eslintrc.json: Order rules alphabetically --- .eslintrc.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e3bff08374b0..30fda7af6d7c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,11 +5,13 @@ "sourceType": "script" }, "rules": { - "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], - "quotes": ["warn", "double"], - "eqeqeq": ["error", "always"], "camelcase": "error", "dot-location": "off", + "eqeqeq": ["error", "always"], + "no-unused-vars": ["error", { + "argsIgnorePattern": "^_" + }], + "quotes": ["warn", "double"], "require-atomic-updates": "error" }, "globals": { From 3cf0bed154e9c1735f1c3c0550193ecfb0e086ef Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 17 Jan 2020 16:52:58 +0100 Subject: [PATCH 14/22] .eslintrc.json: Reduce camelcase severity to "warn" --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 30fda7af6d7c..0301d145aa23 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,7 +5,7 @@ "sourceType": "script" }, "rules": { - "camelcase": "error", + "camelcase": "warn", "dot-location": "off", "eqeqeq": ["error", "always"], "no-unused-vars": ["error", { From 87d47b7a3d4e3ef6ade11901a05febe3d16b41fc Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 17 Jan 2020 16:57:40 +0100 Subject: [PATCH 15/22] .eslintrc.json: Enforce consistent "dot-location" style --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0301d145aa23..472f56856171 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,7 @@ }, "rules": { "camelcase": "warn", - "dot-location": "off", + "dot-location": "warn", "eqeqeq": ["error", "always"], "no-unused-vars": ["error", { "argsIgnorePattern": "^_" From 63c86fedeb23161c81375cc159f38604e7d9fc5c Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 17 Jan 2020 16:59:30 +0100 Subject: [PATCH 16/22] .eslintrc.json: Add even more code style rules --- .eslintrc.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 472f56856171..d4b1646280e3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,14 +5,30 @@ "sourceType": "script" }, "rules": { + "array-bracket-spacing" : "warn", + "block-spacing": "warn", + "brace-style": ["warn", "1tbs"], "camelcase": "warn", + "comma-spacing": "warn", + "computed-property-spacing" : ["warn", "never", { + "enforceForClassMembers": true + }], "dot-location": "warn", "eqeqeq": ["error", "always"], + "func-style": ["error", "expression", { + "allowArrowFunctions": true + }], + "keyword-spacing": "warn", + "linebreak-style": ["warn", "unix"], "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], + "object-curly-spacing" : "warn", "quotes": ["warn", "double"], - "require-atomic-updates": "error" + "require-atomic-updates": "error", + "semi": "warn", + "semi-spacing": "warn", + "space-in-parens": "warn" }, "globals": { "console": "writable", From 78a6cc27dd67abdfc27b987d59d3afb99a2bda75 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 17 Jan 2020 17:13:36 +0100 Subject: [PATCH 17/22] .eslintrc.json: Allow opening/closing braces for block on same line --- .eslintrc.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index d4b1646280e3..1d26d0679977 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,7 +7,9 @@ "rules": { "array-bracket-spacing" : "warn", "block-spacing": "warn", - "brace-style": ["warn", "1tbs"], + "brace-style": ["warn", "1tbs", { + "allowSingleLine": true + }], "camelcase": "warn", "comma-spacing": "warn", "computed-property-spacing" : ["warn", "never", { From 97b3b9260e739a4f846717c3e4e4eb0a92644098 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 17 Jan 2020 17:38:06 +0100 Subject: [PATCH 18/22] .eslintrc.json: Add more rules regarding key spacing and trailing spaces --- .eslintrc.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 1d26d0679977..2b6014be71d7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -20,8 +20,10 @@ "func-style": ["error", "expression", { "allowArrowFunctions": true }], + "key-spacing": "warn", "keyword-spacing": "warn", "linebreak-style": ["warn", "unix"], + "no-trailing-spaces": "warn", "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], From 14c7242defe4ef0b3791d09d4659a2a88793f31c Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 19 Jan 2020 20:00:58 +0100 Subject: [PATCH 19/22] .eslintrc.json: Disallow unneeded ternary ops and spaces before func parens --- .eslintrc.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 2b6014be71d7..2a31b3120312 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,6 +24,9 @@ "keyword-spacing": "warn", "linebreak-style": ["warn", "unix"], "no-trailing-spaces": "warn", + "no-unneeded-ternary": ["warn", { + "defaultAssignment": false + }], "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], @@ -32,6 +35,7 @@ "require-atomic-updates": "error", "semi": "warn", "semi-spacing": "warn", + "space-before-function-paren": ["warn", "never"], "space-in-parens": "warn" }, "globals": { From 819be4acb741af7f06723f4a9a5ab01babc648ba Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 20 Jan 2020 00:04:49 +0100 Subject: [PATCH 20/22] .eslintrc.json: Add more rules regarding spacing --- .eslintrc.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 2a31b3120312..53b473badd74 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -30,11 +30,16 @@ "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], + "object-curly-newline" : ["warn", { + "consistent": true, + "multiline": true + }], "object-curly-spacing" : "warn", "quotes": ["warn", "double"], "require-atomic-updates": "error", "semi": "warn", "semi-spacing": "warn", + "space-before-blocks": ["warn", "always"], "space-before-function-paren": ["warn", "never"], "space-in-parens": "warn" }, From 1ce693883ac49b12086b824efffe93b0432f8c8f Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 20 Jan 2020 01:08:02 +0100 Subject: [PATCH 21/22] Soundless joyMIDI: Auto-fix eslint issues --- res/controllers/Soundless_joyMIDI_scripts.js | 134 +++++++++---------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/res/controllers/Soundless_joyMIDI_scripts.js b/res/controllers/Soundless_joyMIDI_scripts.js index 9644636dee49..24304d9249cb 100644 --- a/res/controllers/Soundless_joyMIDI_scripts.js +++ b/res/controllers/Soundless_joyMIDI_scripts.js @@ -25,8 +25,8 @@ var joyMIDI = { btnKey: 0, btnBeatgrid: 0, btnVolume: 0, - btnFilter: { "low": 0, "middle": 0, "high": 0 }, - btnFx: { "1": 0, "2": 0 }, + btnFilter: {"low": 0, "middle": 0, "high": 0}, + btnFx: {"1": 0, "2": 0}, connBeatIndicator: {}, }, @@ -39,8 +39,8 @@ var joyMIDI = { btnKey: 0, btnBeatgrid: 0, btnVolume: 0, - btnFilter: { "low": 0, "middle": 0, "high": 0 }, - btnFx: { "1": 0, "2": 0 }, + btnFilter: {"low": 0, "middle": 0, "high": 0}, + btnFx: {"1": 0, "2": 0}, connBeatIndicator: {}, }, @@ -92,12 +92,12 @@ var fsrDelay = false; joyMIDI.init = function(id, debug) { joyMIDI["[Channel1]"].connBeatIndicator = engine.makeConnection("[Channel1]", "beat_active", joyMIDI.onBeatIndicator); joyMIDI["[Channel2]"].connBeatIndicator = engine.makeConnection("[Channel2]", "beat_active", joyMIDI.onBeatIndicator); -} +}; joyMIDI.shutdown = function() { joyMIDI["[Channel1]"].connBeatIndicator.disconnect(); joyMIDI["[Channel2]"].connBeatIndicator.disconnect(); -} +}; //==== Callback ============================================================== joyMIDI.onBeatIndicator = function(value, group, control) { @@ -113,12 +113,12 @@ joyMIDI.onBeatIndicator = function(value, group, control) { midi.sendShortMsg(0x92, 0x00, (value) ? 0x7F : 0x00); } } -} +}; //==== Button ================================================================ joyMIDI.shiftButton = function(channel, control, value, status, group) { joyMIDI[group].btnShift = (value > 0) ? PRESSED : RELEASED; -} +}; joyMIDI.syncButton = function(channel, control, value, status, group) { if (!joyMIDI.userSetting.knobEnable) { @@ -169,11 +169,11 @@ joyMIDI.syncButton = function(channel, control, value, status, group) { joyMIDI[group].btnSync = RELEASED; } } -} +}; joyMIDI.syncTimerHandler = function(group) { joyMIDI[group].syncLongPress = 1; -} +}; joyMIDI.cueButton = function(channel, control, value, status, group) { var sft = joyMIDI[group].btnShift; @@ -181,7 +181,7 @@ joyMIDI.cueButton = function(channel, control, value, status, group) { var val = (value > 0) ? 1 : 0; engine.setValue(group, cmd, val); -} +}; joyMIDI.playButton = function(channel, control, value, status, group) { var sft = joyMIDI[group].btnShift; @@ -190,13 +190,13 @@ joyMIDI.playButton = function(channel, control, value, status, group) { if (value > 0) { script.toggleControl(group, cmd); } -} +}; joyMIDI.scratchButton = function(channel, control, value, status, group) { if (value > 0) { joyMIDI[group].isScratchPermanent = !joyMIDI[group].isScratchPermanent; } -} +}; joyMIDI.keyButton = function(channel, control, value, status, group) { if (!joyMIDI.userSetting.knobEnable) { @@ -228,7 +228,7 @@ joyMIDI.keyButton = function(channel, control, value, status, group) { joyMIDI[group].btnKey = RELEASED; } } -} +}; joyMIDI.beatgridButton = function(channel, control, value, status, group) { if (!joyMIDI.userSetting.knobEnable) { @@ -262,7 +262,7 @@ joyMIDI.beatgridButton = function(channel, control, value, status, group) { joyMIDI[group].btnBeatgrid = RELEASED; } } -} +}; joyMIDI.volumeButton = function(channel, control, value, status, group) { if (!joyMIDI.userSetting.knobEnable) { @@ -288,22 +288,22 @@ joyMIDI.volumeButton = function(channel, control, value, status, group) { joyMIDI[group].btnVolume = RELEASED; } } -} +}; joyMIDI.filterLowButton = function(channel, control, value, status, group) { joyMIDI.filterButton(channel, control, value, status, group, "[EqualizerRack1_" + group + "_Effect1]", "button_parameter1", "low"); -} +}; joyMIDI.filterMiddleButton = function(channel, control, value, status, group) { joyMIDI.filterButton(channel, control, value, status, group, "[EqualizerRack1_" + group + "_Effect1]", "button_parameter2", "middle"); -} +}; joyMIDI.filterHighButton = function(channel, control, value, status, group) { joyMIDI.filterButton(channel, control, value, status, group, "[EqualizerRack1_" + group + "_Effect1]", "button_parameter3", "high"); -} +}; joyMIDI.filterButton = function(channel, control, value, status, group, group2, param, select) { if (!joyMIDI.userSetting.knobEnable) { @@ -329,7 +329,7 @@ joyMIDI.filterButton = function(channel, control, value, status, group, group2, joyMIDI[group].btnFilter[select] = RELEASED; } } -} +}; joyMIDI.hotcueButton = function(channel, control, value, status, group) { var num = control - ((group === "[Channel1]") ? 0x3B : 0x3F); @@ -338,7 +338,7 @@ joyMIDI.hotcueButton = function(channel, control, value, status, group) { var val = (value > 0) ? 1 : 0; engine.setValue(group, cmd, val); -} +}; joyMIDI.reloopToggleButton = function(channel, control, value, status, group) { var usr = joyMIDI.userSetting.beatLoopRollEnable; @@ -347,7 +347,7 @@ joyMIDI.reloopToggleButton = function(channel, control, value, status, group) { var val = (value > 0) ? 1 : 0; engine.setValue(group, cmd, val); -} +}; joyMIDI.loopInButton = function(channel, control, value, status, group) { var sft = joyMIDI[group].btnShift; @@ -355,7 +355,7 @@ joyMIDI.loopInButton = function(channel, control, value, status, group) { var val = (value > 0) ? 1 : 0; engine.setValue(group, cmd, val); -} +}; joyMIDI.loopOutButton = function(channel, control, value, status, group) { var sft = joyMIDI[group].btnShift; @@ -363,40 +363,40 @@ joyMIDI.loopOutButton = function(channel, control, value, status, group) { var val = (value > 0) ? 1 : 0; engine.setValue(group, cmd, val); -} +}; joyMIDI.loop0p125Button = function(channel, control, value, status, group) { joyMIDI.loopXButton(channel, control, value, status, group, - [ "beatloop_0.125_toggle", "beatloop_2_toggle", - "beatlooproll_0.125_activate", "beatlooproll_2_activate" ]); -} + ["beatloop_0.125_toggle", "beatloop_2_toggle", + "beatlooproll_0.125_activate", "beatlooproll_2_activate"]); +}; joyMIDI.loop0p25Button = function(channel, control, value, status, group) { joyMIDI.loopXButton(channel, control, value, status, group, - [ "beatloop_0.25_toggle", "beatloop_4_toggle", - "beatlooproll_0.25_activate", "beatlooproll_4_activate" ]); -} + ["beatloop_0.25_toggle", "beatloop_4_toggle", + "beatlooproll_0.25_activate", "beatlooproll_4_activate"]); +}; joyMIDI.loop0p5Button = function(channel, control, value, status, group) { joyMIDI.loopXButton(channel, control, value, status, group, - [ "beatloop_0.5_toggle", "beatloop_8_toggle", - "beatlooproll_0.5_activate", "beatlooproll_8_activate" ]); -} + ["beatloop_0.5_toggle", "beatloop_8_toggle", + "beatlooproll_0.5_activate", "beatlooproll_8_activate"]); +}; joyMIDI.loop1Button = function(channel, control, value, status, group) { joyMIDI.loopXButton(channel, control, value, status, group, - [ "beatloop_1_toggle", "beatloop_16_toggle", - "beatlooproll_1_activate", "beatlooproll_16_activate" ]); -} + ["beatloop_1_toggle", "beatloop_16_toggle", + "beatlooproll_1_activate", "beatlooproll_16_activate"]); +}; joyMIDI.loopXButton = function(channel, control, value, status, group, commands) { var usr = joyMIDI.userSetting.beatLoopRollEnable; var sft = joyMIDI[group].btnShift; - var cmd = commands[ sft + (usr?2:0) ]; + var cmd = commands[sft + (usr?2:0)]; var val = (value > 0) ? 1 : 0; engine.setValue(group, cmd, val); -} +}; joyMIDI.loadButton = function(channel, control, value, status, group) { var sft = joyMIDI[group].btnShift; @@ -404,23 +404,23 @@ joyMIDI.loadButton = function(channel, control, value, status, group) { var val = (value > 0) ? 1 : 0; engine.setValue(group, cmd, val); -} +}; joyMIDI.sampler1Button = function(channel, control, value, status, group) { joyMIDI.samplerButton(channel, control, value, status, group, 1); -} +}; joyMIDI.sampler2Button = function(channel, control, value, status, group) { joyMIDI.samplerButton(channel, control, value, status, group, 2); -} +}; joyMIDI.sampler3Button = function(channel, control, value, status, group) { joyMIDI.samplerButton(channel, control, value, status, group, 3); -} +}; joyMIDI.sampler4Button = function(channel, control, value, status, group) { joyMIDI.samplerButton(channel, control, value, status, group, 4); -} +}; joyMIDI.samplerButton = function(channel, control, value, status, group, number) { var commands = ["start_play", "start_stop", "cue_gotoandplay", "cue_default"]; @@ -430,17 +430,17 @@ joyMIDI.samplerButton = function(channel, control, value, status, group, number) var val = (value > 0) ? 1 : 0; engine.setValue(group, cmd, val); -} +}; joyMIDI.fx1Button = function(channel, control, value, status, group) { joyMIDI.fxButton(channel, control, value, status, group, "[EffectRack1_EffectUnit1]", "group_"+group+"_enable", 1); -} +}; joyMIDI.fx2Button = function(channel, control, value, status, group) { joyMIDI.fxButton(channel, control, value, status, group, "[EffectRack1_EffectUnit2]", "group_"+group+"_enable", 2); -} +}; joyMIDI.fxButton = function(channel, control, value, status, group, group2, param, select) { if (!joyMIDI.userSetting.knobEnable) { @@ -466,7 +466,7 @@ joyMIDI.fxButton = function(channel, control, value, status, group, group2, para joyMIDI[group].btnFx[select] = RELEASED; } } -} +}; //==== Wheel ============================================================ joyMIDI.wheel = function(channel, control, value, status, group) { @@ -508,14 +508,14 @@ joyMIDI.wheel = function(channel, control, value, status, group) { } else { joyMIDI.wheelPitchBend(channel, control, value, status, group); } -} +}; joyMIDI.wheelPitchBend = function(channel, control, value, status, group) { var newValue = joyMIDI.helperAccel(value - 64); engine.setValue(group, "jog", newValue); print(group + "jog=" + newValue); -} +}; joyMIDI.wheelScratch = function(channel, control, value, status, group) { var deck = script.deckFromGroup(group); @@ -536,12 +536,12 @@ joyMIDI.wheelScratch = function(channel, control, value, status, group) { joyMIDI[group].scratchTimerID = engine.beginTimer(scratchDisableTime, function() { joyMIDI.ScratchTimerHandler(deck, group); }, true); -} +}; -joyMIDI.ScratchTimerHandler = function(deck, group){ +joyMIDI.ScratchTimerHandler = function(deck, group) { engine.scratchDisable(deck); joyMIDI[group].scratchTimerID = 0; -} +}; joyMIDI.wheelSync = function(channel, control, value, status, group) { var delta = joyMIDI.helperAccel(value - 64) * 0.01; @@ -551,7 +551,7 @@ joyMIDI.wheelSync = function(channel, control, value, status, group) { newValue = joyMIDI.helperLimit(newValue, 1.0, -1.0); engine.setValue(group, "rate", newValue); print(group + "rate=" + newValue); -} +}; joyMIDI.wheelKey = function(channel, control, value, status, group) { var delta = /*joyMIDI.helperAccel*/(value - 64) * 0.2; @@ -561,7 +561,7 @@ joyMIDI.wheelKey = function(channel, control, value, status, group) { newValue = joyMIDI.helperLimit(newValue, 6.0, -6.0); engine.setValue(group, "pitch", newValue); print(group + "pitch=" + newValue); -} +}; joyMIDI.wheelBeatgrid = function(channel, control, value, status, group) { var delta = joyMIDI.helperAccel(value - 64); @@ -576,7 +576,7 @@ joyMIDI.wheelBeatgrid = function(channel, control, value, status, group) { print(group + "beats_translate_later"); } } -} +}; joyMIDI.wheelVolume = function(channel, control, value, status, group) { var delta = joyMIDI.helperAccel(value - 64) * 0.01; @@ -586,22 +586,22 @@ joyMIDI.wheelVolume = function(channel, control, value, status, group) { newValue = joyMIDI.helperLimit(newValue, 1.0, 0); engine.setValue(group, "volume", newValue); print(group + "volume=" + newValue); -} +}; joyMIDI.wheelFilterLow = function(channel, control, value, status, group) { joyMIDI.wheelFilter(channel, control, value, status, group, "[EqualizerRack1_" + group + "_Effect1]", "parameter1", "low"); -} +}; joyMIDI.wheelFilterMiddle = function(channel, control, value, status, group) { joyMIDI.wheelFilter(channel, control, value, status, group, "[EqualizerRack1_" + group + "_Effect1]", "parameter2", "middle"); -} +}; joyMIDI.wheelFilterHigh = function(channel, control, value, status, group) { joyMIDI.wheelFilter(channel, control, value, status, group, "[EqualizerRack1_" + group + "_Effect1]", "parameter3", "high"); -} +}; joyMIDI.wheelFilter = function(channel, control, value, status, group, group2, param, select) { var delta = joyMIDI.helperAccel(value - 64) * 0.01; @@ -611,7 +611,7 @@ joyMIDI.wheelFilter = function(channel, control, value, status, group, group2, p newValue = joyMIDI.helperLimit(newValue, 1.0, 0); engine.setParameter(group2, param, newValue); print(group + "EQ_" + select + "=" + newValue); -} +}; joyMIDI.wheelFx1 = function(channel, control, value, status, group) { if (group === "[Channel1]") { @@ -621,7 +621,7 @@ joyMIDI.wheelFx1 = function(channel, control, value, status, group) { joyMIDI.wheelFx(channel, control, value, status, group, "[EffectRack1_EffectUnit2]", "mix", 1); } -} +}; joyMIDI.wheelFx2 = function(channel, control, value, status, group) { if (group === "[Channel1]") { @@ -631,7 +631,7 @@ joyMIDI.wheelFx2 = function(channel, control, value, status, group) { joyMIDI.wheelFx(channel, control, value, status, group, "[EffectRack1_EffectUnit2]", "super1", 2); } -} +}; joyMIDI.wheelFx = function(channel, control, value, status, group, group2, param, select) { var delta = joyMIDI.helperAccel(value - 64) * 0.01; @@ -640,7 +640,7 @@ joyMIDI.wheelFx = function(channel, control, value, status, group, group2, param newValue = joyMIDI.helperLimit(newValue, 1.0, 0); engine.setParameter(group2, param, newValue); -} +}; //==== Jojstick ============================================================ @@ -670,7 +670,7 @@ joyMIDI.joystick = function(channel, control, value, status, group) { } } } -} +}; //==== FSR ============================================================ @@ -690,14 +690,14 @@ joyMIDI.fsr = function(channel, control, value, status, group) { engine.setValue("[Library]", "MoveFocusBackward", true); } } -} +}; //==== Helper ============================================================= joyMIDI.helperLimit = function(input, max, min) { input = input > max ? max : input; input = input < min ? min : input; return input; -} +}; joyMIDI.helperAccel = function(input) { var acc = 0; @@ -708,4 +708,4 @@ joyMIDI.helperAccel = function(input) { acc = input; } return acc; -} +}; From 833a3fa225246f50015e1a2b0a6e585340d777ea Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 20 Jan 2020 01:10:39 +0100 Subject: [PATCH 22/22] Soundless joyMIDI: Fix remaining issues --- res/controllers/Soundless_joyMIDI_scripts.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/res/controllers/Soundless_joyMIDI_scripts.js b/res/controllers/Soundless_joyMIDI_scripts.js index 24304d9249cb..0b6f47e263c0 100644 --- a/res/controllers/Soundless_joyMIDI_scripts.js +++ b/res/controllers/Soundless_joyMIDI_scripts.js @@ -89,7 +89,7 @@ var fsrDelay = false; //==== Init, Shutdown ======================================================== -joyMIDI.init = function(id, debug) { +joyMIDI.init = function(_id, _debug) { joyMIDI["[Channel1]"].connBeatIndicator = engine.makeConnection("[Channel1]", "beat_active", joyMIDI.onBeatIndicator); joyMIDI["[Channel2]"].connBeatIndicator = engine.makeConnection("[Channel2]", "beat_active", joyMIDI.onBeatIndicator); }; @@ -100,7 +100,7 @@ joyMIDI.shutdown = function() { }; //==== Callback ============================================================== -joyMIDI.onBeatIndicator = function(value, group, control) { +joyMIDI.onBeatIndicator = function(value, group, _control) { var fader = engine.getParameter("[Master]", "crossfader"); if (fader < 0.5) { // Left @@ -633,7 +633,7 @@ joyMIDI.wheelFx2 = function(channel, control, value, status, group) { } }; -joyMIDI.wheelFx = function(channel, control, value, status, group, group2, param, select) { +joyMIDI.wheelFx = function(channel, control, value, status, group, group2, param, _select) { var delta = joyMIDI.helperAccel(value - 64) * 0.01; var oldValue = engine.getParameter(group2, param); var newValue = oldValue + delta; @@ -644,14 +644,13 @@ joyMIDI.wheelFx = function(channel, control, value, status, group, group2, param //==== Jojstick ============================================================ -joyMIDI.joystick = function(channel, control, value, status, group) { +joyMIDI.joystick = function(channel, control, _value, _status, _group) { if (joystickDelay === false) { /* Delay a while */ joystickDelay = true; engine.beginTimer(300, function() { joystickDelay = false; }, true); - var isShift = joyMIDI["[Channel1]"].btnShift === true || joyMIDI["[Channel2]"].btnShift === true; if (!joyMIDI["[Channel1]"].btnShift) { /* Joystick only */ switch (control) { @@ -674,7 +673,7 @@ joyMIDI.joystick = function(channel, control, value, status, group) { //==== FSR ============================================================ -joyMIDI.fsr = function(channel, control, value, status, group) { +joyMIDI.fsr = function(_channel, _control, _value, _status, _group) { if (fsrDelay === false) { /* Delay a while */