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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,15 +62,14 @@ const config = { | |
overrides: [ | ||
{ | ||
files: ["**/*.ts?(x)"], | ||
extends: ["plugin:import/typescript"], | ||
extends: [ | ||
"plugin:import/typescript", | ||
"plugin:@typescript-eslint/recommended", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
sourceType: "module", | ||
ecmaVersion: 2019, | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
warnOnUnsupportedTypeScriptVersion: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}, | ||
plugins: ["@typescript-eslint"], | ||
rules: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,53 @@ | ||
const OFF = 0; | ||
const WARN = 1; | ||
const ERROR = 2; | ||
|
||
brophdawg11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
module.exports = { | ||
"no-dupe-class-members": OFF, | ||
"no-undef": OFF, | ||
|
||
// Add TypeScript specific rules (and turn off ESLint equivalents) | ||
"@typescript-eslint/consistent-type-assertions": WARN, | ||
"@typescript-eslint/consistent-type-imports": WARN, | ||
|
||
brophdawg11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"no-array-constructor": OFF, | ||
"@typescript-eslint/no-array-constructor": WARN, | ||
|
||
// There is a bug w/ @typescript-eslint/no-duplicate-imports triggered | ||
// by multiple imports inside of module declarations. We should reenable | ||
// this rule when the bug is fixed. | ||
// https://github.com/typescript-eslint/typescript-eslint/issues/3071 | ||
"no-duplicate-imports": OFF, | ||
// "@typescript-eslint/no-duplicate-imports": WARN, | ||
// TODO: These rules might be nice to enable... we should investigate eventually! | ||
brophdawg11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"@typescript-eslint/ban-ts-comment": "off", | ||
"@typescript-eslint/ban-types": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"@typescript-eslint/no-empty-interface": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-inferrable-types": "off", | ||
"@typescript-eslint/no-namespace": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"@typescript-eslint/no-var-requires": "off", | ||
"no-var": "off", | ||
"prefer-rest-params": "off", | ||
|
||
"no-redeclare": OFF, | ||
"@typescript-eslint/no-redeclare": ERROR, | ||
"no-use-before-define": OFF, | ||
brophdawg11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// These rules are nice and we want to configure over the defaults | ||
"@typescript-eslint/no-use-before-define": [ | ||
WARN, | ||
"error", | ||
{ | ||
brophdawg11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
functions: false, | ||
classes: false, | ||
variables: false, | ||
typedefs: false, | ||
}, | ||
], | ||
"no-unused-expressions": OFF, | ||
"@typescript-eslint/no-unused-expressions": [ | ||
WARN, | ||
"error", | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
allowTaggedTemplates: true, | ||
}, | ||
], | ||
"no-unused-vars": OFF, | ||
"@typescript-eslint/no-unused-vars": [ | ||
WARN, | ||
"error", | ||
{ | ||
args: "none", | ||
ignoreRestSiblings: true, | ||
}, | ||
], | ||
"no-useless-constructor": OFF, | ||
"@typescript-eslint/no-useless-constructor": WARN, | ||
|
||
brophdawg11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// These rules are turned on in the core rules but aren't needed for TypeScript code | ||
"no-dupe-class-members": "off", | ||
"no-undef": "off", | ||
|
||
// These stylistic rules don't match our preferences | ||
"no-use-before-define": "off", | ||
"prefer-const": "off", | ||
|
||
// These rules should eventually come from @typescript-eslint/stylistic | ||
// in typescript-eslint@6 | ||
"@typescript-eslint/consistent-type-assertions": "warn", | ||
"@typescript-eslint/consistent-type-imports": "warn", | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,17 +24,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 commentThe reason will be displayed to describe this comment to others. Learn more. https://typescript-eslint.io/rules/no-unnecessary-type-constraint - There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The docs are talking about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great point 😄 thanks! Filed typescript-eslint/typescript-eslint#6973. |
||
export type JsonFunction = <Data>( | ||
data: Data, | ||
init?: number | ResponseInit | ||
) => TypedResponse<Data>; | ||
|
||
// must be a type since this is a subtype of response | ||
// interfaces must conform to the types they extend | ||
export type TypedResponse<T extends unknown = unknown> = Omit< | ||
Response, | ||
"json" | ||
> & { | ||
export type TypedResponse<T = unknown> = Omit<Response, "json"> & { | ||
json(): Promise<T>; | ||
}; | ||
|
||
|
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.