Skip to content

Commit 4e48fdc

Browse files
committed
fix: sort the rules by type
This config replaces several ESLint rules with @typescript-eslint equivalents, as well as adding its own rules. Both kinds were mixed together, so separate them by type for easier ongoing maintenance.
1 parent 4c66679 commit 4e48fdc

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

src/index.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ export = {
66
{
77
files: ['*.ts', '*.tsx'],
88
rules: {
9-
camelcase: 'off', // in favor of TypeScript rule
9+
// TypeScript has this functionality by default:
10+
'no-undef': 'off',
11+
12+
// Rules replaced by @typescript-eslint versions:
13+
camelcase: 'off',
1014
indent: 'off',
1115
'no-array-constructor': 'off',
12-
'no-undef': 'off', // TypeScript has this functionality by default
13-
'no-unused-vars': 'off', // in favor of TypeScript rule
16+
'no-unused-vars': 'off',
1417
'no-useless-constructor': 'off',
15-
'@typescript-eslint/adjacent-overload-signatures': 'error',
16-
'@typescript-eslint/array-type': ['error', 'array-simple'],
18+
19+
// @typescript-eslint versions of Standard.js rules:
1720
'@typescript-eslint/camelcase': ['error', { properties: 'never' }],
18-
'@typescript-eslint/explicit-function-return-type': ['error', {
19-
allowHigherOrderFunctions: true
20-
}],
21-
'@typescript-eslint/explicit-member-accessibility': 'error',
2221
'@typescript-eslint/indent': ['error', 2, {
2322
SwitchCase: 1,
2423
VariableDeclarator: 1,
@@ -33,6 +32,18 @@ export = {
3332
flatTernaryExpressions: false,
3433
ignoreComments: false
3534
}],
35+
'@typescript-eslint/no-array-constructor': 'error',
36+
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
37+
'@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false, variables: false, typedefs: false }],
38+
'@typescript-eslint/no-useless-constructor': 'error',
39+
40+
// New Typescript-only rules:
41+
'@typescript-eslint/adjacent-overload-signatures': 'error',
42+
'@typescript-eslint/array-type': ['error', 'array-simple'],
43+
'@typescript-eslint/explicit-function-return-type': ['error', {
44+
allowHigherOrderFunctions: true
45+
}],
46+
'@typescript-eslint/explicit-member-accessibility': 'error',
3647
'@typescript-eslint/member-delimiter-style': [
3748
'error',
3849
{
@@ -41,7 +52,6 @@ export = {
4152
}
4253
],
4354
'@typescript-eslint/no-angle-bracket-type-assertion': 'error',
44-
'@typescript-eslint/no-array-constructor': 'error',
4555
'@typescript-eslint/no-empty-interface': 'error',
4656
'@typescript-eslint/no-extraneous-class': 'error',
4757
'@typescript-eslint/no-for-in-array': 'error',
@@ -52,15 +62,12 @@ export = {
5262
'@typescript-eslint/no-this-alias': ['error', { allowDestructuring: true }],
5363
'@typescript-eslint/no-triple-slash-reference': 'error',
5464
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
55-
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
56-
'@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false, variables: false, typedefs: false }],
57-
'@typescript-eslint/no-useless-constructor': 'error',
5865
'@typescript-eslint/no-var-requires': 'error',
5966
'@typescript-eslint/prefer-function-type': 'error',
6067
'@typescript-eslint/prefer-interface': 'error',
6168
'@typescript-eslint/promise-function-async': 'error',
62-
'@typescript-eslint/restrict-plus-operands': 'error',
6369
'@typescript-eslint/require-array-sort-compare': 'error',
70+
'@typescript-eslint/restrict-plus-operands': 'error',
6471
'@typescript-eslint/type-annotation-spacing': 'error'
6572
}
6673
}

0 commit comments

Comments
 (0)