-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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(remix-eslint-config): extend from typescript-eslint/recommended #6248
feat(remix-eslint-config): extend from typescript-eslint/recommended #6248
Conversation
|
@@ -1,4 +1,3 @@ | |||
/* eslint-disable no-unreachable */ |
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 rule is explicitly turned off in typescript-eslint configs because it's covered by TypeScript.
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
warnOnUnsupportedTypeScriptVersion: 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.
warnOnUnsupportedTypeScriptVersion
is enabled by default: https://typescript-eslint.io/architecture/parser/#warnonunsupportedtypescriptversion
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
sourceType: "module", | ||
ecmaVersion: 2019, | ||
ecmaFeatures: { | ||
jsx: 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.
ecmaFeatures.jsx
is enabled by default for .tsx
files.
@@ -21,17 +21,14 @@ export type DeferFunction = <Data extends Record<string, unknown>>( | |||
init?: number | ResponseInit | |||
) => TypedDeferredData<Data>; | |||
|
|||
export type JsonFunction = <Data extends unknown>( |
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://typescript-eslint.io/rules/no-unnecessary-type-constraint - extends unknown
is redundant for these type parameters.
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 docs are talking about any
only, but this had unknown
Does the same apply?
If so, I guess it would be a good idea to update the docs?
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.
Great point 😄 thanks! Filed typescript-eslint/typescript-eslint#6973.
@JoshuaKGoldberg What would it take to enable |
Yeah enabling plugin:@typescript-eslint/recommended-requiring-type-checking would be a very good next step after this. If the powers-that-be are particularly interested, it could certainly be done either as a followup or as part of this PR. The main reason I didn't add type checked rules in this PR was type aware rule performance.
I'd want (someone or myself) to investigate how to improve that specifically for Remix's setup. E.g. typescript-eslint/typescript-eslint#6754 |
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.
Thanks Josh! Just a few questions on some existing rules and if we're losing them
Sorry for taking a couple weeks to respond to your comments @brophdawg11! I lost track of this while traveling 😅. But I'm glad you're looking at it! I responded to each thread inline - for each, let me know and I'm happy to make the change. |
@JoshuaKGoldberg It seems like you missed something that causes an ESLint error Do you want to fix that one please? |
Aha, introduced merging from |
This should go to |
4a617f6
into
remix-run:brophdawg11/typescript-eslint-recommended
…6248) Co-authored-by: Matt Brophy <matt@brophy.org>
Wipes out most of the existing
typescript.js
lint rules, in favor of directly extendingplugin:@typescript-eslint/recommended
. Remaining rule configurations are grouped with comments:rules/core.js
that aren't needed for TypeScript codeAddresses: #6126
[ ] Tests:yarn lint
still passes, yes?Testing Strategy: I'd encourage folks to try this out on any large Remix repository written with TypeScript. And let me know what those are so I can test them out too? 😄
Note that this does not (yet?) tackle two good next steps:
plugin:@typescript-eslint/recommended-requiring-type-checking
Any code changes are commented inline.