-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
chore: use eslint 9 internally #9119
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
Changes from all commits
482dea2
3623435
2bbb91a
b3dab19
fa3d79f
ad65eaf
06bc0d0
148304f
f665a25
3d2844a
e05c917
7772628
1906460
535574b
d916841
d41caf5
2d45bb6
9cfe5cd
f63ff71
44879bf
c148a63
82e0b2d
14f95ad
d1a0722
061d0c3
34206ff
0319a55
0f47c86
e09b293
123e9bb
fd2973f
b08cbd9
2e08c7f
472487b
3720bd4
bc22423
6cd00f5
d01d7d6
5ffa053
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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.
Hmmm, turns out our This seems a bit suspicious to me though: this option has not been enabled for this repository until now. Maybe there are some considerations in favor of leaving this option disabled? 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. Just want to clarify that it was the upgrade from ESLint 8 to ESLint 9 that caused it to begin reporting unnecessary lint suppressions. 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. Yeah I'd +1 switching to |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import url from 'node:url'; | ||
|
||
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'; | ||
import { FlatCompat } from '@eslint/eslintrc'; | ||
import eslint from '@eslint/js'; | ||
import tseslintInternalPlugin from '@typescript-eslint/eslint-plugin-internal'; | ||
|
@@ -29,15 +30,20 @@ export default tseslint.config( | |
plugins: { | ||
['@typescript-eslint']: tseslint.plugin, | ||
['@typescript-eslint/internal']: tseslintInternalPlugin, | ||
['deprecation']: deprecationPlugin, | ||
// https://github.com/gund/eslint-plugin-deprecation/issues/78 | ||
// https://github.com/typescript-eslint/typescript-eslint/issues/8988 | ||
['deprecation']: fixupPluginRules(deprecationPlugin), | ||
abrahamguo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
['eslint-comments']: eslintCommentsPlugin, | ||
['eslint-plugin']: eslintPluginPlugin, | ||
['import']: importPlugin, | ||
// https://github.com/import-js/eslint-plugin-import/issues/2948 | ||
['import']: fixupPluginRules(importPlugin), | ||
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 might want to consider switching to 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. I'd be in support of this as a separate followup yeah. |
||
['jest']: jestPlugin, | ||
['jsdoc']: jsdocPlugin, | ||
['jsx-a11y']: jsxA11yPlugin, | ||
['react-hooks']: reactHooksPlugin, | ||
['react']: reactPlugin, | ||
// https://github.com/facebook/react/issues/28313 | ||
['react-hooks']: fixupPluginRules(reactHooksPlugin), | ||
// https://github.com/jsx-eslint/eslint-plugin-react/issues/3699 | ||
['react']: fixupPluginRules(reactPlugin), | ||
['simple-import-sort']: simpleImportSortPlugin, | ||
['unicorn']: unicornPlugin, | ||
}, | ||
|
@@ -512,8 +518,8 @@ export default tseslint.config( | |
files: ['packages/website/**/*.{ts,tsx,mts,cts,js,jsx}'], | ||
extends: [ | ||
...compat.config(jsxA11yPlugin.configs.recommended), | ||
...compat.config(reactPlugin.configs.recommended), | ||
...compat.config(reactHooksPlugin.configs.recommended), | ||
...fixupConfigRules(compat.config(reactPlugin.configs.recommended)), | ||
...fixupConfigRules(compat.config(reactHooksPlugin.configs.recommended)), | ||
Comment on lines
+521
to
+522
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. it's so weird that we need to fixup the plugin both here and in the plugin def. 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. @bradzacher that's actually not true. This can be removed if you are OK with me editing the section at the top of this file labeled The flip side, of course, would be if you felt that it's important to preserve a complete up-front list of all plugins used in any part of the config. If we choose to keep the complete up-front list of plugins, then the reason why we have to use the compat utilities twice, is because the plugins are defined twice (again, redundantly so), and we need to make sure that in both places that each plugin is registered, it is the fixed-up version. |
||
], | ||
rules: { | ||
'@typescript-eslint/internal/prefer-ast-types-enum': 'off', | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import markdown from 'eslint-plugin-markdown'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
export default tseslint.config( | ||
tseslint.configs.base, | ||
// this will also ensure that eslint will force lint the markdown files | ||
{ plugins: { markdown }, files: ['**/*.md'], processor: 'markdown/markdown' }, | ||
{ | ||
files: ['**/*.md/*.{js,ts,jsx,tsx,javascript,node}'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'no-console': 'error', | ||
}, | ||
}, | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"type": "module", | ||
"devDependencies": { | ||
"eslint-plugin-markdown": "latest" | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
// This integration test exists to make sure that the recommended config does | ||
// not require a program to be specified to ensure a fast and simple initial | ||
// setup. Users can add on one of our other configs if they want to opt in to | ||
// more expensive checks. | ||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
], | ||
plugins: ['@typescript-eslint'], | ||
}; | ||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommended, | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"type": "module", | ||
"devDependencies": {} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import tseslint from 'typescript-eslint'; | ||
import pluginVue from 'eslint-plugin-vue'; | ||
|
||
export default tseslint.config( | ||
tseslint.configs.base, | ||
...pluginVue.configs['flat/essential'], | ||
{ | ||
languageOptions: { | ||
parserOptions: { ecmaFeatures: { jsx: true }, parser: tseslint.parser }, | ||
}, | ||
rules: { '@typescript-eslint/no-explicit-any': 'error' }, | ||
}, | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"type": "module", | ||
"devDependencies": { | ||
"vue-eslint-parser": "latest", | ||
"eslint-plugin-vue": "latest", | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pluginVue from 'eslint-plugin-vue'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
export default tseslint.config( | ||
tseslint.configs.base, | ||
...pluginVue.configs['flat/essential'], | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
parser: tseslint.parser, | ||
project: '/usr/linked/tsconfig.json', | ||
}, | ||
}, | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'@typescript-eslint/no-unnecessary-type-assertion': 'error', | ||
'semi-spacing': 'error', | ||
}, | ||
}, | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"type": "module", | ||
"devDependencies": { | ||
"vue-eslint-parser": "latest", | ||
"eslint-plugin-vue": "latest", | ||
|
Uh oh!
There was an error while loading. Please reload this page.