-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: use typescript-eslint@v6's reworked configs #7425
Conversation
|
@@ -28,7 +28,7 @@ | |||
"test:e2e": "cd packages/astro && pnpm playwright install && pnpm run test:e2e", | |||
"test:e2e:match": "cd packages/astro && pnpm playwright install && pnpm run test:e2e:match", | |||
"benchmark": "astro-benchmark", | |||
"lint": "eslint --cache .", | |||
"lint": "eslint . --report-unused-disable-directives", |
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.
Not strictly necessary, but I've found this to be a nice cleanup.
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 think we'd want to still keep the --cache
too?
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.
Ehh I've found the cache to be ... unreliable when working with type checking. Theoretically a file's lint result could be impacted by a couple of other factors -other files it imports types from, TSConfig settings- so caching becomes difficult.
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 won't deny that I've seen --cache
acting strange before, so I could be persuaded removing it for now if there's no rejections from others.
@@ -160,9 +160,8 @@ function prefixError(err: any, prefix: string) { | |||
const wrappedError = new Error(`${prefix}${err ? `: ${err}` : ''}`); | |||
try { | |||
wrappedError.stack = err.stack; | |||
// @ts-expect-error | |||
wrappedError.cause = err; |
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 added target: ES2022
in the tsconfig.json
so this line wouldn't need a // @ts-expect-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.
I noticed that some changes use the bang operator !
. I consider this very unsafe, and I wonder if we should change our code there or at least leave some comments explaining why it's safe. cc @withastro/maintainers-core
...works on my machine! (as in, |
@@ -1,23 +1,53 @@ | |||
module.exports = { | |||
extends: [ |
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 wonder, since this is a breaking change, should we try to move to use the new eslint configuration format? https://eslint.org/docs/latest/use/configure/configuration-files-new
Changes
Posting this as a reference for https://discord.com/channels/830184174198718474/845430950191038464/1120563248782114986:
Edit: the response there was positive, so un-drafting! Thanks!
Upgraded typescript-eslint to v6, with reworked ESLint configurations.
You can read https://typescript-eslint.io/blog/announcing-typescript-eslint-v6-beta#user-facing-breaking-changes for the rationale behind the config changes. Essentially, the new recommended starter configs are:
"plugin:@typescript-eslint/recommended-type-checked"
"plugin:@typescript-eslint/stylistic-type-checked"
I've commented any changes I suspect you might disagree with inline, for discussion. Would love to know what you all think!