Skip to content
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

build: use typescript-eslint@v6 internally #3541

Closed

Conversation

JoshuaKGoldberg
Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg commented Jun 19, 2023

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 ripe for discussion internally. This one was pretty straightforward compared to others though.

Note: This is just a Draft PR to serve as a point of comparison. There are very likely build failures that would happen if the CI builds were to be approved.

@codesandbox
Copy link

codesandbox bot commented Jun 19, 2023

This branch is running in CodeSandbox. Use the links below to review this PR faster.


CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders | Preview

@@ -1,18 +1,26 @@
module.exports = {
extends: ['react-app', 'prettier'],
extends: [
'eslint:recommended',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding 'eslint:recommended' is IME generally a good idea for all JS/TS codebases because it has a lot of good built-in rules. Was it intentional not to have it previously?

parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

project: true is already in typescript-eslint@v5. It's just a nice way to enable parserOptions.project 😄

'@typescript-eslint/dot-notation': 'off',
'no-empty': 'off',
'prefer-const': 'off',
'prefer-rest-params': '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.

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?

If not, I can go ahead and fix for all their complaints.

@@ -12,7 +12,7 @@
"react-dom": "^18.1.0",
"react-redux": "^8.0.2",
"react-scripts": "5.0.1",
"typescript": "~4.2.4"
"typescript": "~4.3.4"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

typescript-eslint@v6 increases the minimum TS range to 4.3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, it looks like the Codesandbox environment is running on a version of Node too old for nullish coalescing assignment (??=)

+ node -v (in /tmp/4c6c9715)
v14.21.1
/tmp/4c6c9715/node_modules/@typescript-eslint/eslint-plugin/dist/util/getStringLength.js:16
    splitter ??= new grapheme_splitter_1.default();
             ^^^

SyntaxError: Unexpected token '??='
    at new Script (vm.js:102:7)

Per http://kangax.github.io/compat-table/es2016plus/ > 2021 features > Logical Assignment > ??= basic support, Node 16 up is needed.

[injectEndpointsObjectLiteralExpression]
)
),
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like this file wasn't fully formatted with Prettier before? (will check back in after CI finishes)

@netlify
Copy link

netlify bot commented Jun 19, 2023

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit 07caf8d
🔍 Latest deploy log https://app.netlify.com/sites/redux-starter-kit-docs/deploys/6490c56d6d3e88000836f442
😎 Deploy Preview https://deploy-preview-3541--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@JoshuaKGoldberg
Copy link
Contributor Author

Closing as I forgot this was open and there are a bagillion merge conflicts. Let me know if you do have the time for this and I can help out. 😄

@JoshuaKGoldberg JoshuaKGoldberg deleted the typescript-eslint-v6 branch January 20, 2024 00:02
@nickserv
Copy link
Collaborator

@JoshuaKGoldberg What are you looking for? Time to review? I might be able to help out if it doesn't take too long, though I haven't been actively maintaining so it would be good to at least have a high level approval from someone who is.

@JoshuaKGoldberg
Copy link
Contributor Author

JoshuaKGoldberg commented Jan 31, 2024

Getting approval from an active maintainer would be good, yes please! 😄

I've been swamped lately and the typescript-eslint v6 push was quite a few months ago. So I can't commit to working on this PR anytime soon. But if you folks want help with it, I'm happy to give advice.

Once our v7 push rolls around -should be this calendar year! 🤞- I'd be happy to come back around do this again.

@EskiMojo14
Copy link
Collaborator

for what it's worth, we're working on consolidating our configs including eslint: #4138

we can definitely consider including the update to latest typescript-eslint as part of that, or as follow-up work :)

apologies this was missed until now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants