-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to ESLint 9 and ESLint flat config #1617
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import hypothesis from 'eslint-config-hypothesis'; | ||
import globals from 'globals'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
export default tseslint.config( | ||
{ | ||
ignores: [ | ||
'.yalc/**/*', | ||
'.yarn/**/*', | ||
'build/**/*', | ||
'dist/**/*', | ||
'**/vendor/**/*.js', | ||
'**/coverage/**/*', | ||
'docs/_build/*', | ||
// TODO - Lint these files | ||
'rollup*.config.js', | ||
], | ||
}, | ||
...hypothesis, | ||
...tseslint.configs.recommended, | ||
{ | ||
rules: { | ||
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }], | ||
'object-shorthand': ['error', 'properties'], | ||
|
||
// Upgrade TS rules from warning to error. | ||
'@typescript-eslint/no-unused-vars': 'error', | ||
|
||
// Disable TS rules that we dislike. | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-this-alias': 'off', | ||
|
||
// Enforce consistency in cases where TypeScript supports old and new | ||
// syntaxes for the same thing. | ||
// | ||
// - Require `<var> as <type>` for casts | ||
// - Require `import type` for type imports. The corresponding rule for | ||
// exports is not enabled yet because that requires setting up type-aware | ||
// linting. | ||
'@typescript-eslint/consistent-type-assertions': 'error', | ||
'@typescript-eslint/consistent-type-imports': 'error', | ||
}, | ||
languageOptions: { | ||
globals: { | ||
chrome: false, | ||
}, | ||
}, | ||
}, | ||
|
||
// Entry points which get loaded as non-module scripts. | ||
{ | ||
files: ['src/unload-client.js'], | ||
rules: { | ||
strict: ['error', 'global'], | ||
}, | ||
languageOptions: { | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
}, | ||
}, | ||
|
||
// CommonJS scripts which run in Node | ||
{ | ||
files: ['tests/karma.config.cjs'], | ||
rules: { | ||
strict: ['error', 'global'], | ||
}, | ||
languageOptions: { | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
|
||
// ESM scripts which run in Node | ||
{ | ||
files: ['tools/*.js'], | ||
rules: { | ||
'no-console': 'off', | ||
}, | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,19 +19,18 @@ | |
"@rollup/plugin-multi-entry": "^6.0.1", | ||
"@rollup/plugin-node-resolve": "^15.3.0", | ||
"@types/chrome": "^0.0.277", | ||
"@typescript-eslint/eslint-plugin": "^7.4.0", | ||
"@typescript-eslint/parser": "^7.4.0", | ||
"babel-plugin-istanbul": "^7.0.0", | ||
"babel-plugin-mockable-imports": "^2.0.1", | ||
"chai": "^5.1.1", | ||
"chrome-webstore-upload-cli": "^3.3.1", | ||
"diff": "^7.0.0", | ||
"eslint": "^8.57.0", | ||
"eslint-config-hypothesis": "^2.6.0", | ||
"eslint-plugin-mocha": "^10.4.1", | ||
"eslint-plugin-react": "^7.34.1", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint": "^9.12.0", | ||
"eslint-config-hypothesis": "^3.0.0", | ||
"eslint-plugin-mocha": "^10.5.0", | ||
"eslint-plugin-react": "^7.37.1", | ||
"eslint-plugin-react-hooks": "^5.0.0", | ||
Comment on lines
+30
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This project does not really need these two plugins, but they are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could add separate entry points in future for Preact and non-Preact using libs/apps. |
||
"git-describe": "^4.1.1", | ||
"globals": "^15.11.0", | ||
"gulp": "^5.0.0", | ||
"hypothesis": "^1.1527.0", | ||
"is-equal-shallow": "^0.1.3", | ||
|
@@ -47,10 +46,12 @@ | |
"rollup": "^4.24.0", | ||
"sinon": "^19.0.2", | ||
"typescript": "^5.6.3", | ||
"typescript-eslint": "^8.9.0", | ||
"web-ext": "^7.12.0" | ||
}, | ||
"browserslist": "chrome 85, firefox 75", | ||
"scripts": { | ||
"lint": "eslint --cache .", | ||
"test": "rollup -c rollup-tests.config.js && karma start tests/karma.config.cjs --single-run", | ||
"typecheck": "tsc --build src/tsconfig.json" | ||
}, | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept these ignored as it was before. We can change this later.