Introduce `@typescript-eslint` rules that extend eslint rules
See original GitHub issue@typesctript-eslint
contains a subset of rules that extend basic rules provided by eslint
, these rules usually work better and provide additional checks. The checks that are these extend-rules are listed in ESLint typescript rules at the bottom (the rules that have a reddish background).
The goal of this issue should be to implement these rules, starting with the ones that we use already but only the simple eslint
version and then all the other ones that can also be enabled, some of these might help us to get rid of our own listing.
For some of these there might be one more problem that we do not have all files covered with tsconfig.json. And some of these need a decision on which style we want to use (this is visible in the sheet)
Steps to follow to create a PR:
- Ask @Hudda to assign you to one of the issue (Assuming got assigned to
"@typescript-eslint/<rule>
) - Add
"@typescript-eslint/<rule>
: […]` in the .eslintrc file. - Run
python -m scripts.linters.pre_commit_linter --only-check-file-extensions=js --path=. --verbose
to check existing issues in the codebase. (This can take 3-5 mins mins to complete.) - If the above script takes too much time or you have a slow machine then consider pushing the code to GitHub and GitHub actions will run these checks for you.
- Fix all the issues found by running the above command.
- Commit all the changes and create a PR.
List of rules to enable:
- @typescript-eslint/await-thenable
- @typescript-eslint/consistent-type-assertions @PranshuSrivastava
- @typescript-eslint/consistent-type-definitions @nithinrdy
- @typescript-eslint/explicit-function-return-type
- @typescript-eslint/member-delimiter-style @nithinrdy
- @typescript-eslint/member-ordering
- @typescript-eslint/method-signature-style @SanjaySajuJacob
- @typescript-eslint/no-base-to-string
- @typescript-eslint/no-confusing-non-null-assertion
- @typescript-eslint/no-dynamic-delete
- @typescript-eslint/no-extraneous-class
- @typescript-eslint/no-floating-promises
- @typescript-eslint/no-for-in-array @Sora34CE
- @typescript-eslint/no-implied-eval
- @typescript-eslint/no-invalid-void-type
- @typescript-eslint/no-namespace @agizoni #16696
- @typescript-eslint/no-parameter-properties
- @typescript-eslint/no-this-alias
- @typescript-eslint/no-throw-literal
- @typescript-eslint/no-type-alias
- @typescript-eslint/no-unnecessary-boolean-literal-compare
- @typescript-eslint/no-unnecessary-condition
- @typescript-eslint/no-unnecessary-type-arguments
- @typescript-eslint/no-unsafe-assignment
- @typescript-eslint/no-unsafe-call
- @typescript-eslint/no-unsafe-member-access
- @typescript-eslint/no-unsafe-return
- @typescript-eslint/no-unused-vars-experimental
- @typescript-eslint/prefer-enum-initializers
- @typescript-eslint/prefer-for-of
- @typescript-eslint/prefer-function-type
- @typescript-eslint/prefer-includes
- @typescript-eslint/prefer-literal-enum-member
- @typescript-eslint/prefer-nullish-coalescing
- @typescript-eslint/prefer-optional-chain
- @typescript-eslint/prefer-reduce-type-parameter
- @typescript-eslint/prefer-regexp-exec
- @typescript-eslint/prefer-string-starts-ends-with
- @typescript-eslint/promise-function-async
- @typescript-eslint/require-array-sort-compare @josieecook (2022-12-10)
- @typescript-eslint/restrict-plus-operands
- @typescript-eslint/switch-exhaustiveness-check
- @typescript-eslint/type-annotation-spacing
- @typescript-eslint/unbound-method
- @typescript-eslint/unified-signatures
- @typescript-eslint/comma-spacing
- @typescript-eslint/default-param-last
- @typescript-eslint/dot-notation
- @typescript-eslint/func-call-spacing
- @typescript-eslint/keyword-spacing @Lawful2002
- @typescript-eslint/lines-between-class-members
- @typescript-eslint/no-dupe-class-members
- @typescript-eslint/no-loss-of-precision
- @typescript-eslint/no-useless-constructor
- @typescript-eslint/quotes
- @typescript-eslint/space-before-function-paren @Lawful2002
Issue Analytics
- State:
- Created 3 years ago
- Comments:62 (44 by maintainers)
Top GitHub Comments
I think false is better, also it seems to be used in the default config . I think we can just use the default config.
@Lawful2002 Hey, sorry about this, but actually I think @Hudda is wrong. What you need to do is to enable the
@typescript-eslint/space-before-function-paren
and disable thespace-before-function-paren
check. The rules for the@typescript-eslint/space-before-function-paren
should stay the same as forspace-before-function-paren
.