-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
feat: update to @typescript-eslint v6 #1222
Conversation
- Update to TypeScript ESLint v6.4.0 - Handle breaking change in @typescript-eslint/restrict-plus-operands See: https://typescript-eslint.io/blog/announcing-typescript-eslint-v6 - Enable skipLibCheck in tsconfig.json to fix harmless compile error TypeScript's documentation recommends enabling skipLibCheck too: https://www.typescriptlang.org/tsconfig#skipLibCheck
Removed dependencies detected. Learn more about Socket for GitHub ↗︎ 🚮 Removed packages: @typescript-eslint/eslint-plugin@5.52.0, @typescript-eslint/eslint-plugin@5.62.0, @typescript-eslint/parser@5.52.0, @typescript-eslint/parser@5.62.0 |
@@ -53,11 +53,11 @@ | |||
"TypeScript" | |||
], | |||
"dependencies": { | |||
"@typescript-eslint/parser": "^5.52.0", | |||
"@typescript-eslint/parser": "^6.4.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.
"@typescript-eslint/parser": "^6.4.0", | |
"@typescript-eslint/parser": "^6.0.0", |
It's the minimal version compatible with the plugin announced to the package manager
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.
The downgrade to the 6.0.0 minimum make the tests fail because of a bug in @typescript-eslint ...
I think it's safe to require 6.4.0 as a minimum version bug free with that module.
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.
Which bug, please?
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.
With the rules handling comma, StandardJS style was not properly followed.
"eslint-config-standard": "17.1.0" | ||
}, | ||
"peerDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.52.0", | ||
"@typescript-eslint/eslint-plugin": "^6.4.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.
"@typescript-eslint/eslint-plugin": "^6.4.0", | |
"@typescript-eslint/eslint-plugin": "^6.0.0", |
"@typescript-eslint_bottom/eslint-plugin": "npm:@typescript-eslint/eslint-plugin@5.52.0", | ||
"@typescript-eslint_bottom/parser": "npm:@typescript-eslint/parser@5.52.0", | ||
"@typescript-eslint/eslint-plugin": "5.62.0", | ||
"@typescript-eslint_bottom/eslint-plugin": "npm:@typescript-eslint/eslint-plugin@6.4.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.
"@typescript-eslint_bottom/eslint-plugin": "npm:@typescript-eslint/eslint-plugin@6.4.0", | |
"@typescript-eslint_bottom/eslint-plugin": "npm:@typescript-eslint/eslint-plugin@6.0.0", |
"@typescript-eslint_bottom/parser": "npm:@typescript-eslint/parser@5.52.0", | ||
"@typescript-eslint/eslint-plugin": "5.62.0", | ||
"@typescript-eslint_bottom/eslint-plugin": "npm:@typescript-eslint/eslint-plugin@6.4.0", | ||
"@typescript-eslint_bottom/parser": "npm:@typescript-eslint/parser@6.4.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.
"@typescript-eslint_bottom/parser": "npm:@typescript-eslint/parser@6.4.0", | |
"@typescript-eslint_bottom/parser": "npm:@typescript-eslint/parser@6.0.0", |
'@typescript-eslint/restrict-plus-operands': ['error', { checkCompoundAssignments: true }], | ||
'@typescript-eslint/restrict-plus-operands': 'error', |
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.
@@ -1,7 +1,8 @@ | |||
{ | |||
"extends": "tsconfigs/nodejs-module", | |||
"compilerOptions": { | |||
"outDir": "lib" | |||
"outDir": "lib", | |||
"skipLibCheck": true |
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.
This may have been the reason I wasn't able to upgrade.
I wouldn't like to accept this. Can you find a different way to solve or work around the issue?
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.
The alternatives are:
- switch the project to ESM, which is a lot of work:
{
"module": "ES2022",
"moduleResolution": "Node16",
}
And "type": "module" in package.json
- overload locally the culprit library type (@typescript-eslint/eslint-plugin)
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.
Tell me more about this wrapping, please.
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.
- overload locally the culprit library type (@typescript-eslint/eslint-plugin)
I do not see how to make it works in a very hackish way, the original culprit types are already an ugly hack:
- @typescript-eslint/eslint-plugin/index.d.ts:1:31
- @typescript-eslint/eslint-plugin/rules.d.ts::38:33
Maybe by redefining the imported types locally or with patch-package to fix the types declaration for the TS configuration: self-contained without import. It's still an ugly hack requiring quite of work.
Code defining custom rules with @typescript-eslint/eslint-plugin needs to switch to "Bundler" module resolution. And the amount of work to do it properly is less than trying to find a working workaround not requiring "skipLibCheck" given the repo TS code surface.
So, maybe accepts temporary the current solution to support v6 and prepares a PR for the proper v6 support by switching to ESM and module resolution to "Bundler". It's easier because there's already ESM wrapper to deal with dependencies using CommonJS.
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.
The patch-package
approach sounds reasonable. Also, progress is being made upstream eslint-config-standard. If that turns into an ESM, then we would be able to turn this package ESM, as well..
## [38.0.0](v37.0.0...v38.0.0) (2023-08-20) ### ⚠ BREAKING CHANGES * minimum @typescript-eslint packages bumped to v6.1.0 * there will be some ### Build system / dependencies * bump package-lock.json on release ([d42bf5b](d42bf5b)) * moduleResolution: nodenext ([1f31e2b](1f31e2b)) * package-lock.json ([b3a6535](b3a6535)), closes [#1193](#1193) * shared commitlint config ([bdd6e2d](bdd6e2d)) * use extracted releaserc ([877b004](877b004)) ### Features * [@typescript-eslint](https://github.com/typescript-eslint) 6 ([166e189](166e189)) * bump minimum [@typescript-eslint](https://github.com/typescript-eslint) to v6.1.0 ([77202d1](77202d1)), closes [#1222](#1222) [#1188](#1188)
🎉 This issue has been resolved in version 38.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thank you for your efforts and participation. Sorry it wasn't your PR that got merged. We just had a great session, @rostislav-simonik and I in the mob and figured it out in a couple of PRs. You're welcome to apply to join us in the mob and help drive this project forward.. |
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[ ] Bug fix
[X] New feature
[ ] Other, please explain:
What changes did you make? (Give an overview)
See: https://typescript-eslint.io/blog/announcing-typescript-eslint-v6
TypeScript's documentation recommends enabling skipLibCheck too:
https://www.typescriptlang.org/tsconfig#skipLibCheck
Which issue (if any) does this pull request address?
Fixes #1188
Is there anything you'd like reviewers to focus on?