@@ -2,11 +2,16 @@ import { Linter } from 'eslint';
2
2
3
3
export const base : Linter . Config = {
4
4
extends : [
5
- 'plugin:@typescript-eslint/recommended' ,
6
- 'plugin:@typescript-eslint/recommended-requiring-type-checking'
5
+ // TODO: Look at enabling recommended eslint options
6
+ // 'eslint:recommended',
7
+ 'plugin:@typescript-eslint/recommended-type-checked' ,
8
+ // TODO: Look at enabling recommended typescript stylistic options
9
+ // 'plugin:@typescript-eslint/stylistic-type-checked',
7
10
] ,
11
+ parser : '@typescript-eslint/parser' ,
8
12
plugins : [
9
13
'@typescript-eslint' ,
14
+ '@stylistic' ,
10
15
'import' ,
11
16
'mocha' ,
12
17
'prefer-arrow' ,
@@ -16,21 +21,21 @@ export const base: Linter.Config = {
16
21
'@typescript-eslint/await-thenable' : 'error' ,
17
22
'@typescript-eslint/ban-ts-comment' : 'error' ,
18
23
'@typescript-eslint/ban-types' : 'off' ,
19
- '@typescript-eslint /brace-style' : 'error' ,
20
- '@typescript-eslint /comma-spacing' : 'error' ,
24
+ '@stylistic /brace-style' : 'error' ,
25
+ '@stylistic /comma-spacing' : 'error' ,
21
26
'@typescript-eslint/consistent-type-assertions' : 'error' ,
22
27
'@typescript-eslint/consistent-type-definitions' : 'error' ,
23
28
'@typescript-eslint/explicit-function-return-type' : 'off' ,
24
29
'@typescript-eslint/explicit-member-accessibility' : [ 'error' , { accessibility : 'explicit' } ] ,
25
30
'@typescript-eslint/explicit-module-boundary-types' : 'off' ,
26
- '@typescript-eslint /func-call-spacing' : 'error' ,
27
- '@typescript-eslint /indent' : [ 'error' , 2 , {
31
+ '@stylistic /func-call-spacing' : 'error' ,
32
+ '@stylistic /indent' : [ 'error' , 2 , {
28
33
FunctionDeclaration : { parameters : 'first' } ,
29
34
FunctionExpression : { parameters : 'first' } ,
30
35
SwitchCase : 1
31
36
} ] ,
32
- '@typescript-eslint /keyword-spacing' : 'error' ,
33
- '@typescript-eslint /member-delimiter-style' : [ 'error' , {
37
+ '@stylistic /keyword-spacing' : 'error' ,
38
+ '@stylistic /member-delimiter-style' : [ 'error' , {
34
39
multiline : { delimiter : 'semi' , requireLast : true } ,
35
40
singleline : { delimiter : 'semi' , requireLast : false }
36
41
} ] ,
@@ -42,40 +47,48 @@ export const base: Linter.Config = {
42
47
format : [ 'PascalCase' ]
43
48
}
44
49
] ,
45
- '@typescript-eslint/no-duplicate-imports' : 'error' ,
46
50
'@typescript-eslint/no-empty-interface' : 'off' ,
47
51
'@typescript-eslint/no-for-in-array' : 'error' ,
48
52
'@typescript-eslint/no-implied-eval' : 'error' ,
49
53
'@typescript-eslint/no-inferrable-types' : [ 'error' , { ignoreParameters : true , ignoreProperties : true } ] ,
50
54
'@typescript-eslint/no-namespace' : 'error' ,
51
- '@typescript-eslint/no- parameter-properties' : 'error' ,
55
+ '@typescript-eslint/parameter-properties' : 'error' ,
52
56
'@typescript-eslint/no-shadow' : [ 'error' , { hoist : 'all' } ] ,
53
57
'@typescript-eslint/no-unused-vars' : [ 'warn' , {
54
58
vars : 'all' ,
55
59
args : 'after-used' ,
60
+ argsIgnorePattern : '^_' ,
61
+ caughtErrors : 'all' ,
62
+ caughtErrorsIgnorePattern : '^_' ,
63
+ destructuredArrayIgnorePattern : '^_' ,
56
64
ignoreRestSiblings : true ,
57
- argsIgnorePattern : '^_'
58
65
} ] ,
59
- '@typescript-eslint /object-curly-spacing' : [ 'error' , 'always' , { objectsInObjects : false } ] ,
66
+ '@stylistic /object-curly-spacing' : [ 'error' , 'always' , { objectsInObjects : false } ] ,
60
67
'@typescript-eslint/prefer-for-of' : 'error' ,
61
68
'@typescript-eslint/prefer-function-type' : 'error' ,
62
- '@typescript-eslint /quotes' : [ 'error' , 'single' , { allowTemplateLiterals : true } ] ,
69
+ '@stylistic /quotes' : [ 'error' , 'single' , { allowTemplateLiterals : true } ] ,
63
70
'@typescript-eslint/require-await' : 'off' ,
64
71
'@typescript-eslint/restrict-plus-operands' : 'off' ,
65
72
'@typescript-eslint/restrict-template-expressions' : 'off' ,
66
- '@typescript-eslint/semi' : [ 'error' , 'always' ] ,
67
- '@typescript-eslint/space-before-blocks' : 'error' ,
68
- '@typescript-eslint/space-before-function-paren' : [ 'error' , { anonymous : 'always' , named : 'never' } ] ,
69
- '@typescript-eslint/space-infix-ops' : 'error' ,
70
- '@typescript-eslint/switch-exhaustiveness-check' : 'error' ,
71
- '@typescript-eslint/type-annotation-spacing' : 'error' ,
73
+ '@stylistic/semi' : [ 'error' , 'always' ] ,
74
+ '@stylistic/space-before-blocks' : 'error' ,
75
+ '@stylistic/space-before-function-paren' : [ 'error' , { anonymous : 'always' , named : 'never' } ] ,
76
+ '@stylistic/space-infix-ops' : 'error' ,
77
+ '@stylistic/type-annotation-spacing' : 'error' ,
72
78
'@typescript-eslint/unified-signatures' : 'error' ,
73
79
'@typescript-eslint/no-floating-promises' : [
74
80
'error' ,
75
81
{
76
82
ignoreVoid : false
77
83
}
78
84
] ,
85
+ // TODO: Look at setting all exhaustive-check options to false to be stricter
86
+ '@typescript-eslint/switch-exhaustiveness-check' : [
87
+ 'error' ,
88
+ {
89
+ considerDefaultExhaustiveForUnions : true
90
+ }
91
+ ] ,
79
92
80
93
// TODO: Enable once we no longer support IE 11
81
94
'@typescript-eslint/prefer-includes' : 'off' ,
@@ -92,30 +105,34 @@ export const base: Linter.Config = {
92
105
'@typescript-eslint/no-use-before-define' : 'off' ,
93
106
'@typescript-eslint/prefer-as-const' : 'off' ,
94
107
'@typescript-eslint/strict-boolean-expressions' : 'off' , // Needs StrictNullChecks
108
+ '@typescript-eslint/no-empty-object-type' : 'off' ,
109
+ '@typescript-eslint/no-unsafe-function-type' : 'off' ,
110
+ '@typescript-eslint/prefer-promise-reject-errors' : 'off' ,
111
+ '@typescript-eslint/no-base-to-string' : 'off' ,
95
112
96
- 'array-bracket-spacing' : [ 'error' , 'always' , { objectsInArrays : false , arraysInArrays : false } ] ,
113
+ '@stylistic/ array-bracket-spacing' : [ 'error' , 'always' , { objectsInArrays : false , arraysInArrays : false } ] ,
97
114
'arrow-body-style' : 'error' ,
98
- 'arrow-parens' : [ 'error' , 'always' ] ,
99
- 'arrow-spacing' : 'error' ,
100
- 'comma-dangle' : 'off' ,
115
+ '@stylistic/ arrow-parens' : [ 'error' , 'always' ] ,
116
+ '@stylistic/ arrow-spacing' : 'error' ,
117
+ '@stylistic/ comma-dangle' : 'off' ,
101
118
'complexity' : 'off' ,
102
- 'computed-property-spacing' : 'error' ,
119
+ '@stylistic/ computed-property-spacing' : 'error' ,
103
120
'constructor-super' : 'error' ,
104
121
'curly' : 'error' ,
105
- 'dot-location' : [ 'error' , 'property' ] ,
122
+ '@stylistic/ dot-location' : [ 'error' , 'property' ] ,
106
123
'dot-notation' : 'error' ,
107
- 'eol-last' : 'off' ,
124
+ '@stylistic/ eol-last' : 'off' ,
108
125
'eqeqeq' : [ 'error' , 'smart' ] ,
109
126
'guard-for-in' : 'error' ,
110
127
'id-blacklist' : 'error' ,
111
128
'id-match' : 'error' ,
112
129
'import/order' : 'off' ,
113
- 'key-spacing' : [ 'error' , { beforeColon : false , afterColon : true , mode : 'strict' } ] ,
130
+ '@stylistic/ key-spacing' : [ 'error' , { beforeColon : false , afterColon : true , mode : 'strict' } ] ,
114
131
'max-classes-per-file' : [ 'error' , 1 ] ,
115
132
'max-len' : [ 'warn' , 160 ] ,
116
133
'mocha/no-exclusive-tests' : 'error' ,
117
134
'mocha/no-identical-title' : 'error' ,
118
- 'new-parens' : 'error' ,
135
+ '@stylistic/ new-parens' : 'error' ,
119
136
'no-bitwise' : 'error' ,
120
137
'no-caller' : 'error' ,
121
138
'no-cond-assign' : 'error' ,
@@ -125,45 +142,41 @@ export const base: Linter.Config = {
125
142
'no-eval' : 'error' ,
126
143
'no-fallthrough' : 'error' ,
127
144
'no-invalid-this' : 'off' ,
128
- 'no-multi-spaces' : [ 'error' , { ignoreEOLComments : true } ] ,
129
- 'no-multiple-empty-lines' : [ 'error' , { max : 1 } ] ,
145
+ '@stylistic/ no-multi-spaces' : [ 'error' , { ignoreEOLComments : true } ] ,
146
+ '@stylistic/ no-multiple-empty-lines' : [ 'error' , { max : 1 } ] ,
130
147
'no-nested-ternary' : 'error' ,
131
148
'no-new-wrappers' : 'error' ,
132
149
'no-throw-literal' : 'error' ,
133
- 'no-trailing-spaces' : 'error' ,
150
+ '@stylistic/ no-trailing-spaces' : 'error' ,
134
151
'no-undef-init' : 'error' ,
135
152
'no-underscore-dangle' : 'error' ,
136
153
'no-unsafe-finally' : 'error' ,
137
- 'no-unused-expressions' : [ 'error' , { allowTernary : true } ] ,
154
+ '@typescript-eslint/ no-unused-expressions' : [ 'error' , { allowTernary : true } ] ,
138
155
'no-unused-labels' : 'error' ,
139
- 'no-whitespace-before-property' : 'error' ,
156
+ '@stylistic/ no-whitespace-before-property' : 'error' ,
140
157
'object-shorthand' : 'error' ,
141
158
'one-var' : [ 'error' , 'never' ] ,
142
159
'prefer-arrow-callback' : 'off' , // Covered by prefer-arrow-functions
143
160
'prefer-arrow/prefer-arrow-functions' : 'error' ,
144
- 'quote-props' : [ 'error' , 'consistent-as-needed' ] ,
161
+ '@stylistic/ quote-props' : [ 'error' , 'consistent-as-needed' ] ,
145
162
'radix' : 'error' ,
146
- 'rest-spread-spacing' : 'error' ,
147
- 'semi-spacing' : 'error' ,
148
- 'spaced-comment' : 'error' ,
149
- 'space-unary-ops' : 'error' ,
150
- 'switch-colon-spacing' : 'error' ,
151
- 'template-curly-spacing' : 'error' ,
163
+ '@stylistic/ rest-spread-spacing' : 'error' ,
164
+ '@stylistic/ semi-spacing' : 'error' ,
165
+ '@stylistic/ spaced-comment' : 'error' ,
166
+ '@stylistic/ space-unary-ops' : 'error' ,
167
+ '@stylistic/ switch-colon-spacing' : 'error' ,
168
+ '@stylistic/ template-curly-spacing' : 'error' ,
152
169
'use-isnan' : 'error' ,
153
170
'valid-typeof' : 'off' , // Disabled as it's handled by TypeScript
154
171
155
172
// Disabled since we're using the equivalent typescript-eslint rule
156
- 'brace-style' : 'off' ,
157
- 'comma-spacing' : 'off' ,
158
- 'func-call-spacing' : 'off' ,
159
- 'indent' : 'off' ,
160
- 'keyword-spacing' : 'off' ,
161
- 'no-duplicate-imports' : 'off' ,
162
173
'no-shadow' : 'off' ,
163
- 'object-curly-spacing' : 'off' ,
164
- 'space-before-blocks' : 'off' ,
165
- 'space-before-function-paren' : 'off' ,
166
- 'space-infix-ops' : 'off' ,
174
+
175
+ 'import/no-duplicates' : 'off' ,
176
+ 'no-duplicate-imports' : 'error' ,
177
+ // Continue using default max-len option to avoid changing too many files that
178
+ // have max-len ignore comments
179
+ '@stylistic/max-len' : 'off'
167
180
}
168
181
} ;
169
182
0 commit comments