-
Notifications
You must be signed in to change notification settings - Fork 149
chore: upgrade @typescript-eslint
#852
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
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,7 +1,12 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
node: true, | ||
}, | ||
extends: [ | ||
'kentcdodds', | ||
'eslint:recommended', | ||
'plugin:import/recommended', | ||
'plugin:jest/recommended', | ||
'plugin:jest-formatting/recommended', | ||
'prettier', | ||
|
@@ -33,6 +38,12 @@ module.exports = { | |
}, | ||
}, | ||
], | ||
'import/first': 'error', | ||
'import/no-empty-named-blocks': 'error', | ||
'import/no-extraneous-dependencies': 'error', | ||
'import/no-mutable-exports': 'error', | ||
'import/no-named-default': 'error', | ||
'import/no-relative-packages': 'warn', | ||
}, | ||
overrides: [ | ||
{ | ||
|
@@ -44,8 +55,8 @@ module.exports = { | |
project: ['./tsconfig.eslint.json'], | ||
}, | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
'plugin:@typescript-eslint/strict-type-checked', | ||
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 can also add |
||
'plugin:import/typescript', | ||
], | ||
rules: { | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
|
@@ -54,6 +65,25 @@ module.exports = { | |
{ argsIgnorePattern: '^_' }, | ||
], | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'@typescript-eslint/no-unnecessary-condition': '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. Disabled that rule because we have a lot of errors from it in the project and fixing it might cause some issues. If we want to enable this rule, we need to fix it carefully. |
||
|
||
// Import | ||
// Rules enabled by `import/recommended` but are better handled by | ||
// TypeScript and @typescript-eslint. | ||
'import/default': 'off', | ||
'import/export': 'off', | ||
'import/namespace': 'off', | ||
'import/no-unresolved': 'off', | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.jsx', '.ts', '.tsx'], | ||
}, | ||
typescript: { | ||
alwaysTryTypes: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
# The .x indicates "the most recent one" | ||
node: [19.x, 18.x, 17.x, 16.x, 14.x, 14.17.0, 12.x, 12.22.0] | ||
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. Dropped support for Node.js versions lower than 16. They're not maintained for a long time and don't support package.json |
||
node: [21.x, 20.x, 18.x, 16.x] | ||
eslint: [7.5, 7, 8] | ||
|
||
steps: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16 | ||
18 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Files | ||
package-lock.json | ||
|
||
# Folders | ||
node_modules/ | ||
dist/ | ||
Comment on lines
+1
to
+6
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. Add |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,7 @@ export default createTestingLibraryRule<Options, MessageIds>({ | |
property.id.name === 'delay' && | ||
isLiteral(property.init) && | ||
property.init.value && | ||
// @ts-expect-error -- TODO: fix me | ||
property.init.value > 0 | ||
Comment on lines
+79
to
80
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. Previously, we had I think we should fix such places but it's better to do it in a separate PR. |
||
); | ||
}, | ||
|
@@ -88,6 +89,7 @@ export default createTestingLibraryRule<Options, MessageIds>({ | |
isLiteral(node.right) && | ||
node.right.value !== null | ||
) { | ||
// @ts-expect-error -- TODO: fix me | ||
hasDelayDeclarationOrAssignmentGTZero = node.right.value > 0; | ||
} | ||
}, | ||
|
@@ -141,6 +143,7 @@ export default createTestingLibraryRule<Options, MessageIds>({ | |
property.key.name === 'delay' && | ||
isLiteral(property.value) && | ||
!!property.value.value && | ||
// @ts-expect-error -- TODO: fix me | ||
property.value.value > 0 | ||
); | ||
|
||
|
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.
eslint-config-kentcdodds
uses some outdated packages which block us from upgrading TypeScript dependencies properly. It didn't bring many rules so decided just useeslint:recommended
,plugin:import/recommended
and configure some rules manually.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 like this change! We should apply it anyway.