@@ -2,11 +2,16 @@ import { Linter } from 'eslint';
22
33export const base : Linter . Config = {
44 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',
710 ] ,
11+ parser : '@typescript-eslint/parser' ,
812 plugins : [
913 '@typescript-eslint' ,
14+ '@stylistic' ,
1015 'import' ,
1116 'mocha' ,
1217 'prefer-arrow' ,
@@ -16,21 +21,21 @@ export const base: Linter.Config = {
1621 '@typescript-eslint/await-thenable' : 'error' ,
1722 '@typescript-eslint/ban-ts-comment' : 'error' ,
1823 '@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' ,
2126 '@typescript-eslint/consistent-type-assertions' : 'error' ,
2227 '@typescript-eslint/consistent-type-definitions' : 'error' ,
2328 '@typescript-eslint/explicit-function-return-type' : 'off' ,
2429 '@typescript-eslint/explicit-member-accessibility' : [ 'error' , { accessibility : 'explicit' } ] ,
2530 '@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 , {
2833 FunctionDeclaration : { parameters : 'first' } ,
2934 FunctionExpression : { parameters : 'first' } ,
3035 SwitchCase : 1
3136 } ] ,
32- '@typescript-eslint /keyword-spacing' : 'error' ,
33- '@typescript-eslint /member-delimiter-style' : [ 'error' , {
37+ '@stylistic /keyword-spacing' : 'error' ,
38+ '@stylistic /member-delimiter-style' : [ 'error' , {
3439 multiline : { delimiter : 'semi' , requireLast : true } ,
3540 singleline : { delimiter : 'semi' , requireLast : false }
3641 } ] ,
@@ -42,40 +47,48 @@ export const base: Linter.Config = {
4247 format : [ 'PascalCase' ]
4348 }
4449 ] ,
45- '@typescript-eslint/no-duplicate-imports' : 'error' ,
4650 '@typescript-eslint/no-empty-interface' : 'off' ,
4751 '@typescript-eslint/no-for-in-array' : 'error' ,
4852 '@typescript-eslint/no-implied-eval' : 'error' ,
4953 '@typescript-eslint/no-inferrable-types' : [ 'error' , { ignoreParameters : true , ignoreProperties : true } ] ,
5054 '@typescript-eslint/no-namespace' : 'error' ,
51- '@typescript-eslint/no- parameter-properties' : 'error' ,
55+ '@typescript-eslint/parameter-properties' : 'error' ,
5256 '@typescript-eslint/no-shadow' : [ 'error' , { hoist : 'all' } ] ,
5357 '@typescript-eslint/no-unused-vars' : [ 'warn' , {
5458 vars : 'all' ,
5559 args : 'after-used' ,
60+ argsIgnorePattern : '^_' ,
61+ caughtErrors : 'all' ,
62+ caughtErrorsIgnorePattern : '^_' ,
63+ destructuredArrayIgnorePattern : '^_' ,
5664 ignoreRestSiblings : true ,
57- argsIgnorePattern : '^_'
5865 } ] ,
59- '@typescript-eslint /object-curly-spacing' : [ 'error' , 'always' , { objectsInObjects : false } ] ,
66+ '@stylistic /object-curly-spacing' : [ 'error' , 'always' , { objectsInObjects : false } ] ,
6067 '@typescript-eslint/prefer-for-of' : 'error' ,
6168 '@typescript-eslint/prefer-function-type' : 'error' ,
62- '@typescript-eslint /quotes' : [ 'error' , 'single' , { allowTemplateLiterals : true } ] ,
69+ '@stylistic /quotes' : [ 'error' , 'single' , { allowTemplateLiterals : true } ] ,
6370 '@typescript-eslint/require-await' : 'off' ,
6471 '@typescript-eslint/restrict-plus-operands' : 'off' ,
6572 '@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' ,
7278 '@typescript-eslint/unified-signatures' : 'error' ,
7379 '@typescript-eslint/no-floating-promises' : [
7480 'error' ,
7581 {
7682 ignoreVoid : false
7783 }
7884 ] ,
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+ ] ,
7992
8093 // TODO: Enable once we no longer support IE 11
8194 '@typescript-eslint/prefer-includes' : 'off' ,
@@ -92,30 +105,34 @@ export const base: Linter.Config = {
92105 '@typescript-eslint/no-use-before-define' : 'off' ,
93106 '@typescript-eslint/prefer-as-const' : 'off' ,
94107 '@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' ,
95112
96- 'array-bracket-spacing' : [ 'error' , 'always' , { objectsInArrays : false , arraysInArrays : false } ] ,
113+ '@stylistic/ array-bracket-spacing' : [ 'error' , 'always' , { objectsInArrays : false , arraysInArrays : false } ] ,
97114 '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' ,
101118 'complexity' : 'off' ,
102- 'computed-property-spacing' : 'error' ,
119+ '@stylistic/ computed-property-spacing' : 'error' ,
103120 'constructor-super' : 'error' ,
104121 'curly' : 'error' ,
105- 'dot-location' : [ 'error' , 'property' ] ,
122+ '@stylistic/ dot-location' : [ 'error' , 'property' ] ,
106123 'dot-notation' : 'error' ,
107- 'eol-last' : 'off' ,
124+ '@stylistic/ eol-last' : 'off' ,
108125 'eqeqeq' : [ 'error' , 'smart' ] ,
109126 'guard-for-in' : 'error' ,
110127 'id-blacklist' : 'error' ,
111128 'id-match' : 'error' ,
112129 'import/order' : 'off' ,
113- 'key-spacing' : [ 'error' , { beforeColon : false , afterColon : true , mode : 'strict' } ] ,
130+ '@stylistic/ key-spacing' : [ 'error' , { beforeColon : false , afterColon : true , mode : 'strict' } ] ,
114131 'max-classes-per-file' : [ 'error' , 1 ] ,
115132 'max-len' : [ 'warn' , 160 ] ,
116133 'mocha/no-exclusive-tests' : 'error' ,
117134 'mocha/no-identical-title' : 'error' ,
118- 'new-parens' : 'error' ,
135+ '@stylistic/ new-parens' : 'error' ,
119136 'no-bitwise' : 'error' ,
120137 'no-caller' : 'error' ,
121138 'no-cond-assign' : 'error' ,
@@ -125,45 +142,41 @@ export const base: Linter.Config = {
125142 'no-eval' : 'error' ,
126143 'no-fallthrough' : 'error' ,
127144 '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 } ] ,
130147 'no-nested-ternary' : 'error' ,
131148 'no-new-wrappers' : 'error' ,
132149 'no-throw-literal' : 'error' ,
133- 'no-trailing-spaces' : 'error' ,
150+ '@stylistic/ no-trailing-spaces' : 'error' ,
134151 'no-undef-init' : 'error' ,
135152 'no-underscore-dangle' : 'error' ,
136153 'no-unsafe-finally' : 'error' ,
137- 'no-unused-expressions' : [ 'error' , { allowTernary : true } ] ,
154+ '@typescript-eslint/ no-unused-expressions' : [ 'error' , { allowTernary : true } ] ,
138155 'no-unused-labels' : 'error' ,
139- 'no-whitespace-before-property' : 'error' ,
156+ '@stylistic/ no-whitespace-before-property' : 'error' ,
140157 'object-shorthand' : 'error' ,
141158 'one-var' : [ 'error' , 'never' ] ,
142159 'prefer-arrow-callback' : 'off' , // Covered by prefer-arrow-functions
143160 'prefer-arrow/prefer-arrow-functions' : 'error' ,
144- 'quote-props' : [ 'error' , 'consistent-as-needed' ] ,
161+ '@stylistic/ quote-props' : [ 'error' , 'consistent-as-needed' ] ,
145162 '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' ,
152169 'use-isnan' : 'error' ,
153170 'valid-typeof' : 'off' , // Disabled as it's handled by TypeScript
154171
155172 // 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' ,
162173 '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'
167180 }
168181} ;
169182
0 commit comments