Skip to content

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

Merged
merged 13 commits into from
Jun 28, 2023

Conversation

JoshuaKGoldberg
Copy link
Contributor

Closes #4540

🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

✅ Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

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!

@vercel
Copy link

vercel bot commented Jun 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-prisma-starter 🔄 Building (Inspect) Jun 28, 2023 0:13am
og-image 🔄 Building (Inspect) Jun 28, 2023 0:13am
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2023 0:13am

@vercel
Copy link

vercel bot commented Jun 19, 2023

@JoshuaKGoldberg is attempting to deploy a commit to the trpc Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added @trpc/next @trpc/react-query @trpc/server 🕸 www Stuff to do with the website (`/www` folder) labels Jun 19, 2023
.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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@KATT KATT Jun 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need anys in the source code, apart from that I'm fine with swapping I think, cc @sachinraja @juliusmarminge

Copy link
Member

@juliusmarminge juliusmarminge Jun 27, 2023

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",
Copy link
Contributor Author

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?

Copy link
Member

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);
});
Copy link
Contributor Author

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?

Copy link
Member

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,
Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Member

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?

Copy link
Member

@KATT KATT Jun 28, 2023

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?

Copy link
Member

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

Copy link
Contributor Author

@JoshuaKGoldberg JoshuaKGoldberg Jun 28, 2023

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. 😄

@KATT KATT changed the title feat: use typescript-eslint@v6 with reworked configs chore: use typescript-eslint@v6 with reworked configs Jun 28, 2023
@juliusmarminge juliusmarminge merged commit 2bc867f into trpc:main Jun 28, 2023
@JoshuaKGoldberg JoshuaKGoldberg deleted the typescript-eslint-v6 branch June 28, 2023 16:09
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Use typescript-eslint@v6 & its reworked configs
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy