-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13913 from Swiftb0y/chore/cleanup-eslint-config
Cleanup ESLint config
- Loading branch information
Showing
8 changed files
with
165 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,154 +1,160 @@ | ||
const jsdoc = require("eslint-plugin-jsdoc"); | ||
const typescriptEslint = require("@typescript-eslint/eslint-plugin"); | ||
const tsParser = require("@typescript-eslint/parser"); | ||
const js = require("@eslint/js"); | ||
|
||
const { | ||
FlatCompat, | ||
} = require("@eslint/eslintrc"); | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}); | ||
const eslint = require("@eslint/js"); | ||
const tseslint = require("typescript-eslint"); | ||
const jsdoc = require("eslint-plugin-jsdoc"); | ||
const diff = require("eslint-plugin-diff"); | ||
|
||
module.exports = [{ | ||
ignores: [ | ||
"res/controllers/lodash.mixxx.js", | ||
"res/controllers/Novation-Launchpad MK2-scripts.js", | ||
"res/controllers/Novation-Launchpad Mini MK3-scripts.js", | ||
"res/controllers/Novation-Launchpad-scripts.js", | ||
], | ||
}, ...compat.extends("eslint:recommended", "plugin:jsdoc/recommended", "plugin:diff/diff"), { | ||
// https://github.com/paleite/eslint-plugin-diff/issues/47#issuecomment-2480733106 | ||
const diffConfig = { | ||
plugins: { | ||
jsdoc, | ||
"@typescript-eslint": typescriptEslint, | ||
diff, | ||
}, | ||
|
||
languageOptions: { | ||
globals: { | ||
console: "readonly", | ||
}, | ||
|
||
parser: tsParser, | ||
ecmaVersion: 7, | ||
sourceType: "script", | ||
processor: diff.processors.diff, | ||
} | ||
|
||
module.exports = tseslint.config( | ||
{ | ||
// these are autogenerated and thus should not be linted at all. | ||
ignores: [ | ||
"res/controllers/lodash.mixxx.js", | ||
"res/controllers/Novation-Launchpad MK2-scripts.js", | ||
"res/controllers/Novation-Launchpad Mini MK3-scripts.js", | ||
"res/controllers/Novation-Launchpad-scripts.js", | ||
], | ||
}, | ||
|
||
settings: { | ||
jsdoc: { | ||
preferredTypes: { | ||
object: "Object", | ||
}, | ||
{ | ||
languageOptions: { | ||
ecmaVersion: 7, | ||
sourceType: "script", | ||
}, | ||
}, | ||
|
||
rules: { | ||
"array-bracket-spacing": "warn", | ||
"block-spacing": "warn", | ||
|
||
"brace-style": ["warn", "1tbs", { | ||
allowSingleLine: true, | ||
}], | ||
|
||
curly: "warn", | ||
camelcase: "warn", | ||
"comma-spacing": "warn", | ||
|
||
"computed-property-spacing": ["warn", "never", { | ||
enforceForClassMembers: true, | ||
}], | ||
|
||
"dot-location": ["warn", "property"], | ||
"dot-notation": "warn", | ||
eqeqeq: ["error", "always"], | ||
"func-call-spacing": "warn", | ||
|
||
"func-style": ["error", "expression", { | ||
allowArrowFunctions: true, | ||
}], | ||
|
||
indent: ["warn", 4], | ||
"key-spacing": "warn", | ||
"keyword-spacing": "warn", | ||
"linebreak-style": ["warn", "unix"], | ||
"newline-per-chained-call": "warn", | ||
"no-constructor-return": "warn", | ||
"no-extra-bind": "warn", | ||
"no-sequences": "warn", | ||
"no-useless-call": "warn", | ||
"no-useless-return": "warn", | ||
"no-trailing-spaces": "warn", | ||
|
||
"no-unneeded-ternary": ["warn", { | ||
defaultAssignment: false, | ||
}], | ||
|
||
"no-unused-vars": ["error", { | ||
argsIgnorePattern: "^_", | ||
}], | ||
|
||
"no-var": "warn", | ||
|
||
"object-curly-newline": ["warn", { | ||
consistent: true, | ||
multiline: true, | ||
}], | ||
|
||
"object-curly-spacing": "warn", | ||
"prefer-const": "warn", | ||
"prefer-regex-literals": "warn", | ||
"prefer-template": "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", | ||
yoda: "warn", | ||
}, | ||
}, ...compat.extends("plugin:@typescript-eslint/recommended").map(config => ({ | ||
...config, | ||
files: ["res/controllers/*.d.ts"], | ||
})), { | ||
files: ["res/controllers/*.d.ts"], | ||
|
||
rules: { | ||
"no-unused-vars": "off", | ||
{ | ||
plugins: { | ||
jsdoc, | ||
} | ||
}, | ||
}, { | ||
files: ["**/*.mjs"], | ||
|
||
languageOptions: { | ||
ecmaVersion: 5, | ||
sourceType: "module", | ||
eslint.configs.recommended, | ||
tseslint.configs.recommended, | ||
jsdoc.configs['flat/recommended'], | ||
diffConfig, | ||
{ | ||
files: ["res/controllers/**/*"], | ||
languageOptions: { | ||
globals: { | ||
// QJSEngine::ConsoleExtension, https://doc.qt.io/qt-6/qtquick-debugging.html#console-api | ||
"console": "readonly", | ||
// lodash, deprecated | ||
"_": "readonly", | ||
// Mixxx custom | ||
"ColorMapper": "readonly", | ||
"components": "readonly", | ||
"engine": "readonly", | ||
"midi": "readonly", | ||
// common-controller-scripts globals | ||
"print": "readonly", | ||
"printObject": "readonly", | ||
"stringifyObject": "readonly", | ||
"arrayContains": "readonly", | ||
"secondstominutes": "readonly", | ||
"msecondstominutes": "readonly", | ||
"colorCodeToObject": "readonly", | ||
"colorCodeFromObject": "readonly", | ||
"script": "readonly", | ||
"bpm": "readonly", | ||
"ButtonState": "readonly", | ||
"LedState": "readonly", | ||
"Controller": "readonly", | ||
"Button": "readonly", | ||
"Control": "readonly", | ||
"Deck": "readonly" | ||
} | ||
} | ||
}, | ||
}, { | ||
files: ["res/controllers/common-hid-packet-parser.js"], | ||
|
||
languageOptions: { | ||
globals: { | ||
console: "readonly", | ||
{ | ||
// vanilla rule config from previous `.eslintrc` | ||
rules: { | ||
"array-bracket-spacing": "warn", | ||
"block-spacing": "warn", | ||
|
||
"brace-style": ["warn", "1tbs", { | ||
allowSingleLine: true, | ||
}], | ||
|
||
curly: "warn", | ||
camelcase: "warn", | ||
"comma-spacing": "warn", | ||
|
||
"computed-property-spacing": ["warn", "never", { | ||
enforceForClassMembers: true, | ||
}], | ||
|
||
"dot-location": ["warn", "property"], | ||
"dot-notation": "warn", | ||
eqeqeq: ["error", "always"], | ||
"func-call-spacing": "warn", | ||
|
||
"func-style": ["error", "expression", { | ||
allowArrowFunctions: true, | ||
}], | ||
|
||
indent: ["warn", 4], | ||
"key-spacing": "warn", | ||
"keyword-spacing": "warn", | ||
"linebreak-style": ["warn", "unix"], | ||
"newline-per-chained-call": "warn", | ||
"no-constructor-return": "warn", | ||
"no-extra-bind": "warn", | ||
"no-sequences": "warn", | ||
"no-useless-call": "warn", | ||
"no-useless-return": "warn", | ||
"no-trailing-spaces": "warn", | ||
|
||
"no-unneeded-ternary": ["warn", { | ||
defaultAssignment: false, | ||
}], | ||
|
||
"no-var": "warn", | ||
|
||
"object-curly-newline": ["warn", { | ||
consistent: true, | ||
multiline: true, | ||
}], | ||
|
||
"object-curly-spacing": "warn", | ||
"prefer-const": "warn", | ||
"prefer-regex-literals": "warn", | ||
"prefer-template": "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", | ||
yoda: "warn", | ||
}, | ||
}, | ||
|
||
rules: { | ||
camelcase: "off", | ||
{ | ||
// special rules required for the typescript plugin | ||
rules: { | ||
// Note: you must disable the base rule as it can report incorrect errors | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": ["error", { | ||
argsIgnorePattern: "^_", | ||
}], | ||
// no need for jsdoc type annotation, the typescript syntax already requires it. | ||
"jsdoc/require-param-type": "off", | ||
"jsdoc/require-returns-type": "off", | ||
// this is commonly needed in ComponentsJS | ||
"@typescript-eslint/no-this-alias": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
} | ||
}, | ||
}, { | ||
files: ["res/controllers/*.js"], | ||
ignores: ["res/controllers/common-hid-packet-parser.js"], | ||
|
||
languageOptions: { | ||
globals: { | ||
console: "readonly", | ||
svg: "writable", | ||
HIDController: "writable", | ||
HIDDebug: "writable", | ||
HIDPacket: "writable", | ||
controller: "writable", | ||
}, | ||
{ | ||
// JSDoc specific stuff | ||
rules: { | ||
// the style here is too mixed currently, disable for now | ||
"jsdoc/tag-lines": "off" | ||
} | ||
}, | ||
}]; | ||
); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.