Skip to content

Commit

Permalink
feat: Add all @typescript-eslint Supported Rules
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Nov 9, 2020
1 parent 5c1eba3 commit 3ed93c2
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
53 changes: 53 additions & 0 deletions best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,59 @@ module.exports = {

'require-await': 'off',
'@typescript-eslint/require-await': 'error',

'@typescript-eslint/array-type': 'off',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-types': 'off', // not useful in a reusable config
'@typescript-eslint/class-literal-property-style': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/no-base-to-string': 'warn',
'@typescript-eslint/no-confusing-void-expression': 'off', // honestly, it's probably a good rule, but I do this all the time so...
'@typescript-eslint/no-dynamic-delete': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-extraneous-class': 'error', // stay away from classes when you can
'@typescript-eslint/no-floating-promises': 'warn', // not a bad rule, but can be annoying
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-implicit-any-catch': 'warn',
'@typescript-eslint/no-inferrable-types': 'off', // I personally prefer relying on inference where possible, but I don't want to lint for it.
'@typescript-eslint/no-invalid-void-type': 'warn',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-require-imports': 'off', // sometimes you can't do it any other way
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'warn', // I'm not sure I understand this one
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-enum-initializers': 'error', // makes total sense
'@typescript-eslint/prefer-function-type': 'off', // though I'm not sure I understand it
'@typescript-eslint/prefer-includes': 'error', // normally I wouldn't but includes is just so much better
'@typescript-eslint/prefer-literal-enum-member': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-readonly': 'off',
'@typescript-eslint/prefer-reduce-type-parameter': 'warn',
'@typescript-eslint/prefer-regexp-exec': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'error',
'@typescript-eslint/promise-function-async': 'off',
'@typescript-eslint/require-array-sort-compare': 'off',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/restrict-template-expressions': 'error',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
'@typescript-eslint/unbound-method': 'error',

// variables
'@typescript-eslint/unified-signatures': 'warn',
},
},
],
Expand Down
7 changes: 7 additions & 0 deletions possible-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ module.exports = {

'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error', 'nofunc'],

'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-unsafe-assignment': 'warn', // seems like an ok idea, but I don't have enough experience with TS yet.
'@typescript-eslint/no-unsafe-call': 'warn', // seems like an ok idea, but I don't have enough experience with TS yet.
'@typescript-eslint/no-unsafe-member-access': 'warn', // seems like an ok idea, but I don't have enough experience with TS yet.
'@typescript-eslint/no-unsafe-return': 'warn', // seems like an ok idea, but I don't have enough experience with TS yet.
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
},
},
],
Expand Down
22 changes: 22 additions & 0 deletions stylistic.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,28 @@ module.exports = {
// variables
'init-declarations': 'off',
'@typescript-eslint/init-declarations': 'off',

'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/ban-tslint-comment': 'error',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/consistent-type-imports': 'off', // I think I prefer typed imports, but you can't always use them
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/method-signature-style': 'off',
'@typescript-eslint/no-confusing-non-null-assertion': 'off', // prettier reformats their "correct" example anyway 🤷‍♂️
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-parameter-properties': 'error', // yeah, I don't like this feature
'@typescript-eslint/no-type-alias': 'off',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
'@typescript-eslint/prefer-for-of': 'off', // I prefer for of, but I don't want to lint for it
'@typescript-eslint/typedef': 'off',

// variables
'@typescript-eslint/naming-convention': 'off',
},
},
],
Expand Down

0 comments on commit 3ed93c2

Please sign in to comment.