-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
build: use typescript-eslint@v6 internally #3541
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
module.exports = { | ||
extends: ['react-app', 'prettier'], | ||
extends: [ | ||
'eslint:recommended', | ||
'prettier', | ||
'react-app', | ||
'plugin:node/recommended', | ||
'plugin:@typescript-eslint/recommended-type-checked', | ||
'plugin:@typescript-eslint/stylistic-type-checked', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: true, | ||
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.
|
||
tsconfigRootDir: __dirname, | ||
}, | ||
rules: { | ||
'jsx-a11y/href-no-hash': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
|
||
// Taken care of by TypeScript's `noUnusedLocals` / `noUnusedParameters` | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
// Silence some bizarre "rule not found" TSLint error | ||
'@typescript-eslint/no-angle-bracket-type-assertion': 'off', | ||
'no-redeclare': 'off', | ||
// Silence some bizarre "rule not found" TSLint error | ||
'@typescript-eslint/no-redeclare': 'off', | ||
'no-use-before-define': 'off', | ||
|
||
// These off/not-configured-the-way-we-want lint rules we like & opt into | ||
'@typescript-eslint/no-use-before-define': ['error', { functions: false }], | ||
'@typescript-eslint/consistent-type-imports': [ | ||
'error', | ||
|
@@ -24,27 +32,35 @@ module.exports = { | |
additionalHooks: '(usePossiblyImmediateEffect)', | ||
}, | ||
], | ||
|
||
// Todo: investigate whether we'd like these on | ||
'@typescript-eslint/array-type': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/ban-types': 'off', | ||
'@typescript-eslint/consistent-indexed-object-style': 'off', | ||
'@typescript-eslint/consistent-type-imports': 'off', | ||
'@typescript-eslint/consistent-type-definitions': 'off', | ||
'@typescript-eslint/no-confusing-void-expression': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
'@typescript-eslint/no-floating-promises': 'off', | ||
'@typescript-eslint/no-misused-promises': 'off', | ||
'@typescript-eslint/no-unsafe-argument': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/no-unsafe-call': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-return': 'off', | ||
'@typescript-eslint/prefer-function-type': 'off', | ||
'@typescript-eslint/require-await': 'off', | ||
'@typescript-eslint/restrict-template-expressions': 'off', | ||
'@typescript-eslint/sort-type-constituents': 'off', | ||
'@typescript-eslint/unbound-method': 'off', | ||
'@typescript-eslint/dot-notation': 'off', | ||
'no-empty': 'off', | ||
'prefer-const': 'off', | ||
'prefer-rest-params': 'off', | ||
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. Each of these had at least a few existing warnings, so I didn't want to overreach and solve for them without asking. Are any of these rules ones you feel particularly strongly about?
If not, I can go ahead and fix for all their complaints. |
||
}, | ||
overrides: [ | ||
// { | ||
// // only add after https://github.com/typescript-eslint/typescript-eslint/pull/3463 is merged | ||
// files: ['src/**/*.ts'], | ||
// excludedFiles: [ | ||
// '**/tests/*.ts', | ||
// '**/tests/**/*.ts', | ||
// '**/tests/*.tsx', | ||
// '**/tests/**/*.tsx', | ||
// ], | ||
// parserOptions: { | ||
// project: './tsconfig.json', | ||
// }, | ||
// rules: { | ||
// '@typescript-eslint/prefer-readonly-parameter-types': [ | ||
// 'warn', | ||
// { arraysAndTuplesOnly: true }, | ||
// ], | ||
// }, | ||
// }, | ||
{ | ||
files: [ | ||
'packages/toolkit/src/tests/*.ts', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
"react-dom": "^18.1.0", | ||
"react-redux": "^8.0.2", | ||
"react-scripts": "5.0.1", | ||
"typescript": "~4.2.4" | ||
"typescript": "~4.3.4" | ||
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. typescript-eslint@v6 increases the minimum TS range to 4.3. 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. Ah, it looks like the Codesandbox environment is running on a version of Node too old for nullish coalescing assignment (
Per http://kangax.github.io/compat-table/es2016plus/ > 2021 features > Logical Assignment > ??= basic support, Node 16 up is needed. |
||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
|
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.
Adding
'eslint:recommended'
is IME generally a good idea for all JS/TS codebases because it has a lot of good built-in rules. Was it intentional not to have it previously?