-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
chore: use typescript-eslint@v6 with reworked configs #4541
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
chore: use typescript-eslint@v6 with reworked configs #4541
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@JoshuaKGoldberg is attempting to deploy a commit to the trpc Team on Vercel. A member of the Team first needs to authorize it. |
.eslintrc.js
Outdated
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/prefer-for-of': 'off', | ||
'@typescript-eslint/prefer-function-type': 'off', | ||
'@typescript-eslint/prefer-nullish-coalescing': 'off', |
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.
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?
https://typescript-eslint.io/rules/array-type
https://typescript-eslint.io/rules/class-literal-property-style
https://typescript-eslint.io/rules/dot-notation
https://typescript-eslint.io/rules/no-confusing-void-expression
https://typescript-eslint.io/rules/no-explicit-any
https://typescript-eslint.io/rules/prefer-for-of
https://typescript-eslint.io/rules/prefer-function-type
https://typescript-eslint.io/rules/prefer-nullish-coalescing
If not, I can go ahead and fix for all their complaints.
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.
We need any
s in the source code, apart from that I'm fine with swapping I think, cc @sachinraja @juliusmarminge
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'm good with all of them - the void one a bit meh but not too strong opinion
"@typescript-eslint/no-explicit-any": "off" | ||
|
||
// Consider removing these rule disables for more type safety in your app ✨ | ||
"@typescript-eslint/no-explicit-any": "off", |
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.
We right now have no-explicit-any
moved into the strict config for v6. But I'm questioning that choice - it seems like a rule some folks like. Do you have feelings on it?
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.
We need any
's throughout the codebase so it should definetely be turned off
process.on('SIGTERM', () => clearInterval(interval)); | ||
process.on('SIGTERM', () => { | ||
clearInterval(interval); | ||
}); |
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.
https://v6--typescript-eslint.netlify.app/rules/no-confusing-void-expression flags cases around void
such this: a function that returns a value being used in a place that expects it to return void
. It's in the stylistic-type-checked
config in v6, after not being in any recommended configs in v5. I worry it's too opinionated and will annoy people. Thoughts?
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 it's a good rule
| trpcNext.CreateNextContextOptions | ||
| NodeHTTPCreateContextFnOptions<IncomingMessage, ws>, | ||
| NodeHTTPCreateContextFnOptions<IncomingMessage, ws> | ||
| trpcNext.CreateNextContextOptions, |
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.
https://v6--typescript-eslint.netlify.app/rules/sort-type-constituents - is newly in the stylistic
config. While it does have an autofixer, I do worry that it's too nitpicky and will annoy people. Thoughts?
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.
If it doesn't have an autofixer it'll annoy the hell out of me :D
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.
It did break a thing so I had to disable it in a place: 794a2c8
Guessing this is if the two objects have the same property that conflicts or something?
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.
We could disable the rule until there's autofixing?
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.
We could disable the rule until there's autofixing?
There is autofixing - but the autofixer broke the type in one place. I'm guessing that's if you have something like
type X = { foo: string }
type Y = { foo: number }
type Z = Y & X;
and it changes the order to X & Y
instead
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.
...hmm. This smells like something we should fix in typescript-eslint-land. It's vaguely reminiscent of typescript-eslint/typescript-eslint#6339.
@juliusmarminge are you up to & have time for filing an issue on us? If not no worries, I can - just I like more direct attribution for reporters. 😄
d479d0f
to
56a23f6
Compare
Closes #4540
🎯 Changes
What changes are made in this PR? Is it a feature or a bug fix?
✅ Checklist
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!