@sequencemedia/eslint-config-typescript 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,62 @@
1
1
  # `@sequencemedia/eslint-config-typescript`
2
2
 
3
- [Love](https://github.com/mightyiam/eslint-config-love)
3
+ TypeScript style Flat Config for ESLint `v9`
4
+
5
+ Based on [Love](https://github.com/mightyiam/eslint-config-love)
6
+
7
+ ## Install
8
+
9
+ ```shell
10
+ npm i -D @sequencemedia/eslint-config-typescript
11
+ ```
12
+
13
+ ## Use
14
+
15
+ In your `eslint.config.*` either:
16
+
17
+ ```javascript
18
+ export { default } from '@sequencemedia/eslint-config-typescript'
19
+ ```
20
+
21
+ Or:
22
+
23
+ ```javascript
24
+ import { configs } from '@sequencemedia/eslint-config-typescript'
25
+
26
+ export default [
27
+ configs.recommended
28
+ ]
29
+ ```
30
+
31
+ You can merge _changes_ in the default configuration using the `merge` utility:
32
+
33
+ ```javascript
34
+ import merge from '@sequencemedia/eslint-config-typescript/merge'
35
+
36
+ export default merge({
37
+ files: [
38
+ '**/*.{mjs,cjs}'
39
+ ],
40
+ ignores: [
41
+ 'lib'
42
+ ]
43
+ })
44
+ ```
45
+
46
+ Which is _equivalent to_:
47
+
48
+ ```javascript
49
+ import { configs } from '@sequencemedia/eslint-config-typescript'
50
+
51
+ export default [
52
+ {
53
+ ...configs.recommended,
54
+ files: [
55
+ '**/*.{mts,cts}'
56
+ ],
57
+ ignores: [
58
+ 'lib'
59
+ ]
60
+ }
61
+ ]
62
+ ```
@@ -0,0 +1,12 @@
1
+ import recommended from './recommended.mjs'
2
+ import typescript from './typescript.mjs'
3
+
4
+ export {
5
+ recommended,
6
+ typescript
7
+ }
8
+
9
+ export default {
10
+ recommended,
11
+ typescript
12
+ }
@@ -0,0 +1,26 @@
1
+ import {
2
+ parser
3
+ } from 'typescript-eslint'
4
+ import typescript from './typescript.mjs'
5
+
6
+ export default {
7
+ name: '@sequencemedia/eslint-config-typescript/recommended',
8
+ languageOptions: {
9
+ parser,
10
+ parserOptions: {
11
+ projectService: true
12
+ }
13
+ },
14
+ linterOptions: {
15
+ reportUnusedDisableDirectives: 'error'
16
+ },
17
+ files: [
18
+ '**/*.{ts,mts,cts}'
19
+ ],
20
+ plugins: {
21
+ ...typescript.plugins
22
+ },
23
+ rules: {
24
+ ...typescript.rules
25
+ }
26
+ }
@@ -0,0 +1,468 @@
1
+ import {
2
+ plugin as t
3
+ } from 'typescript-eslint'
4
+ import c from 'eslint-plugin-eslint-comments'
5
+ import n from 'eslint-plugin-n'
6
+ import p from 'eslint-plugin-promise'
7
+ import i from 'eslint-plugin-import'
8
+
9
+ export default {
10
+ name: '@sequencemedia/eslint-config-typescript/typescript',
11
+ plugins: {
12
+ '@typescript-eslint': t,
13
+ 'eslint-comments': c,
14
+ n,
15
+ promise: p,
16
+ import: i
17
+
18
+ },
19
+ rules: {
20
+ /**
21
+ * `@typescript-eslint`
22
+ */
23
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
24
+ '@typescript-eslint/array-type': [
25
+ 'error',
26
+ {
27
+ default: 'array-simple'
28
+ }
29
+ ],
30
+ '@typescript-eslint/await-thenable': 'error',
31
+ '@typescript-eslint/ban-ts-comment': [
32
+ 'error',
33
+ {
34
+ 'ts-expect-error': 'allow-with-description',
35
+ 'ts-ignore': true,
36
+ 'ts-nocheck': true,
37
+ 'ts-check': false,
38
+ minimumDescriptionLength: 3
39
+ }
40
+ ],
41
+ '@typescript-eslint/ban-tslint-comment': 'error',
42
+ '@typescript-eslint/class-literal-property-style': [
43
+ 'error',
44
+ 'fields'
45
+ ],
46
+ '@typescript-eslint/class-methods-use-this': [
47
+ 'error',
48
+ {
49
+ exceptMethods: [],
50
+ enforceForClassFields: true,
51
+ ignoreOverrideMethods: false,
52
+ ignoreClassesThatImplementAnInterface: false
53
+ }
54
+ ],
55
+ '@typescript-eslint/consistent-generic-constructors': [
56
+ 'error',
57
+ 'constructor'
58
+ ],
59
+ '@typescript-eslint/consistent-indexed-object-style': [
60
+ 'error',
61
+ 'record'
62
+ ],
63
+ '@typescript-eslint/consistent-type-assertions': [
64
+ 'error',
65
+ {
66
+ assertionStyle: 'as',
67
+ objectLiteralTypeAssertions: 'never'
68
+ }
69
+ ],
70
+ '@typescript-eslint/consistent-type-definitions': [
71
+ 'error',
72
+ 'interface'
73
+ ],
74
+ '@typescript-eslint/consistent-type-exports': [
75
+ 'error',
76
+ {
77
+ fixMixedExportsWithInlineTypeSpecifier: true
78
+ }
79
+ ],
80
+ '@typescript-eslint/consistent-type-imports': [
81
+ 'error',
82
+ {
83
+ prefer: 'type-imports',
84
+ disallowTypeAnnotations: true,
85
+ fixStyle: 'inline-type-imports'
86
+ }
87
+ ],
88
+ '@typescript-eslint/dot-notation': [
89
+ 'error',
90
+ {
91
+ allowIndexSignaturePropertyAccess: false,
92
+ allowKeywords: true,
93
+ allowPattern: '',
94
+ allowPrivateClassPropertyAccess: false,
95
+ allowProtectedClassPropertyAccess: false
96
+ }
97
+ ],
98
+ '@typescript-eslint/explicit-function-return-type': [
99
+ 'error',
100
+ {
101
+ allowExpressions: true,
102
+ allowHigherOrderFunctions: true,
103
+ allowTypedFunctionExpressions: true,
104
+ allowDirectConstAssertionInArrowFunctions: true
105
+ }
106
+ ],
107
+ '@typescript-eslint/init-declarations': [
108
+ 'error',
109
+ 'always'
110
+ ],
111
+ '@typescript-eslint/max-params': [
112
+ 'error',
113
+ {
114
+ max: 4
115
+ }
116
+ ],
117
+ '@typescript-eslint/method-signature-style': 'error',
118
+ '@typescript-eslint/naming-convention': [
119
+ 'error',
120
+ {
121
+ selector: 'variableLike',
122
+ leadingUnderscore: 'allow',
123
+ trailingUnderscore: 'allow',
124
+ format: [
125
+ 'camelCase',
126
+ 'PascalCase',
127
+ 'UPPER_CASE'
128
+ ]
129
+ }
130
+ ],
131
+ '@typescript-eslint/no-array-constructor': 'error',
132
+ '@typescript-eslint/no-array-delete': 'error',
133
+ '@typescript-eslint/no-base-to-string': 'error',
134
+ '@typescript-eslint/no-confusing-non-null-assertion': 'error',
135
+ '@typescript-eslint/no-confusing-void-expression': [
136
+ 'error',
137
+ {
138
+ ignoreArrowShorthand: false,
139
+ ignoreVoidOperator: false
140
+ }
141
+ ],
142
+ '@typescript-eslint/no-deprecated': [
143
+ 'warn'
144
+ ],
145
+ '@typescript-eslint/no-dupe-class-members': 'error',
146
+ '@typescript-eslint/no-duplicate-enum-values': 'error',
147
+ '@typescript-eslint/no-duplicate-type-constituents': [
148
+ 'error',
149
+ {
150
+ ignoreIntersections: false,
151
+ ignoreUnions: false
152
+ }
153
+ ],
154
+ '@typescript-eslint/no-dynamic-delete': 'error',
155
+ '@typescript-eslint/no-empty-function': [
156
+ 'error',
157
+ {
158
+ allow: []
159
+ }
160
+ ],
161
+ '@typescript-eslint/no-empty-object-type': [
162
+ 'error',
163
+ {
164
+ allowInterfaces: 'with-single-extends',
165
+ allowObjectTypes: 'never'
166
+ }
167
+ ],
168
+ '@typescript-eslint/no-explicit-any': [
169
+ 'error',
170
+ {
171
+ fixToUnknown: false,
172
+ ignoreRestArgs: false
173
+ }
174
+ ],
175
+ '@typescript-eslint/no-extra-non-null-assertion': 'error',
176
+ '@typescript-eslint/no-extraneous-class': [
177
+ 'error',
178
+ {
179
+ allowWithDecorator: true
180
+ }
181
+ ],
182
+ '@typescript-eslint/no-floating-promises': 'error',
183
+ '@typescript-eslint/no-for-in-array': 'error',
184
+ '@typescript-eslint/no-implied-eval': 'error',
185
+ '@typescript-eslint/no-import-type-side-effects': 'error',
186
+ '@typescript-eslint/no-inferrable-types': [
187
+ 'error',
188
+ {
189
+ ignoreParameters: false,
190
+ ignoreProperties: false
191
+ }
192
+ ],
193
+ '@typescript-eslint/no-invalid-void-type': 'error',
194
+ '@typescript-eslint/no-loop-func': 'error',
195
+ '@typescript-eslint/no-magic-numbers': [
196
+ 'error',
197
+ {
198
+ ignore: [],
199
+ ignoreArrayIndexes: false,
200
+ ignoreDefaultValues: false,
201
+ ignoreClassFieldInitialValues: false,
202
+ enforceConst: false,
203
+ detectObjects: true,
204
+ ignoreEnums: true,
205
+ ignoreNumericLiteralTypes: false,
206
+ ignoreReadonlyClassProperties: true,
207
+ ignoreTypeIndexes: false
208
+ }
209
+ ],
210
+ '@typescript-eslint/no-meaningless-void-operator': [
211
+ 'error',
212
+ {
213
+ checkNever: true
214
+ }
215
+ ],
216
+ '@typescript-eslint/no-misused-new': 'error',
217
+ '@typescript-eslint/no-misused-promises': 'error',
218
+ '@typescript-eslint/no-mixed-enums': 'error',
219
+ '@typescript-eslint/no-namespace': 'error',
220
+ '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
221
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
222
+ '@typescript-eslint/no-non-null-assertion': 'error',
223
+ '@typescript-eslint/no-redundant-type-constituents': 'error',
224
+ '@typescript-eslint/no-require-imports': [
225
+ 'error',
226
+ {
227
+ allow: [],
228
+ allowAsImport: false
229
+ }
230
+ ],
231
+ '@typescript-eslint/no-this-alias': [
232
+ 'error',
233
+ {
234
+ allowDestructuring: true
235
+ }
236
+ ],
237
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
238
+ '@typescript-eslint/no-unnecessary-condition': [
239
+ 'error',
240
+ {
241
+ allowConstantLoopConditions: true
242
+ }
243
+ ],
244
+ '@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
245
+ '@typescript-eslint/no-unnecessary-qualifier': 'error',
246
+ '@typescript-eslint/no-unnecessary-template-expression': 'error',
247
+ '@typescript-eslint/no-unnecessary-type-arguments': 'error',
248
+ '@typescript-eslint/no-unnecessary-type-assertion': 'error',
249
+ '@typescript-eslint/no-unnecessary-type-constraint': 'error',
250
+ '@typescript-eslint/no-unnecessary-type-parameters': 'error',
251
+ '@typescript-eslint/no-unsafe-argument': 'error',
252
+ '@typescript-eslint/no-unsafe-assignment': 'error',
253
+ '@typescript-eslint/no-unsafe-call': 'error',
254
+ '@typescript-eslint/no-unsafe-declaration-merging': 'error',
255
+ '@typescript-eslint/no-unsafe-enum-comparison': 'error',
256
+ '@typescript-eslint/no-unsafe-function-type': 'error',
257
+ '@typescript-eslint/no-unsafe-member-access': 'error',
258
+ '@typescript-eslint/no-unsafe-return': 'error',
259
+ '@typescript-eslint/no-unsafe-type-assertion': 'error',
260
+ '@typescript-eslint/no-unsafe-unary-minus': 'error',
261
+ '@typescript-eslint/no-unused-expressions': [
262
+ 'error',
263
+ {
264
+ allowShortCircuit: true,
265
+ allowTernary: true,
266
+ allowTaggedTemplates: true,
267
+ enforceForJSX: false
268
+ }
269
+ ],
270
+ '@typescript-eslint/no-unused-vars': [
271
+ 'error',
272
+ {
273
+ args: 'none',
274
+ caughtErrors: 'none',
275
+ ignoreRestSiblings: true,
276
+ vars: 'all'
277
+ }
278
+ ],
279
+ '@typescript-eslint/no-use-before-define': [
280
+ 'error',
281
+ {
282
+ functions: false,
283
+ classes: false,
284
+ enums: false,
285
+ variables: false,
286
+ typedefs: false
287
+ }
288
+ ],
289
+ '@typescript-eslint/no-useless-constructor': 'error',
290
+ '@typescript-eslint/no-useless-empty-export': 'error',
291
+ '@typescript-eslint/no-wrapper-object-types': 'error',
292
+ '@typescript-eslint/non-nullable-type-assertion-style': 'error',
293
+ '@typescript-eslint/only-throw-error': [
294
+ 'error',
295
+ {
296
+ allowThrowingAny: false,
297
+ allowThrowingUnknown: false
298
+ }
299
+ ],
300
+ '@typescript-eslint/prefer-as-const': 'error',
301
+ '@typescript-eslint/prefer-destructuring': [
302
+ 'error',
303
+ {
304
+ array: true,
305
+ object: true
306
+ },
307
+ {
308
+ enforceForRenamedProperties: true,
309
+ enforceForDeclarationWithTypeAnnotation: false
310
+ }
311
+ ],
312
+ '@typescript-eslint/prefer-find': 'error',
313
+ '@typescript-eslint/prefer-for-of': 'error',
314
+ '@typescript-eslint/prefer-function-type': 'error',
315
+ '@typescript-eslint/prefer-includes': 'error',
316
+ '@typescript-eslint/prefer-literal-enum-member': [
317
+ 'error',
318
+ {
319
+ allowBitwiseExpressions: true
320
+ }
321
+ ],
322
+ '@typescript-eslint/prefer-namespace-keyword': 'error',
323
+ '@typescript-eslint/prefer-nullish-coalescing': [
324
+ 'error',
325
+ {
326
+ ignoreConditionalTests: false,
327
+ ignoreMixedLogicalExpressions: false
328
+ }
329
+ ],
330
+ '@typescript-eslint/prefer-optional-chain': 'error',
331
+ '@typescript-eslint/prefer-promise-reject-errors': 'error',
332
+ '@typescript-eslint/prefer-readonly': 'error',
333
+ '@typescript-eslint/prefer-reduce-type-parameter': 'error',
334
+ '@typescript-eslint/prefer-regexp-exec': 'error',
335
+ '@typescript-eslint/prefer-return-this-type': 'error',
336
+ '@typescript-eslint/prefer-string-starts-ends-with': [
337
+ 'error',
338
+ {
339
+ allowSingleElementEquality: 'never'
340
+ }
341
+ ],
342
+ '@typescript-eslint/promise-function-async': 'error',
343
+ '@typescript-eslint/related-getter-setter-pairs': 'error',
344
+ '@typescript-eslint/require-array-sort-compare': [
345
+ 'error',
346
+ {
347
+ ignoreStringArrays: true
348
+ }
349
+ ],
350
+ '@typescript-eslint/require-await': 'error',
351
+ '@typescript-eslint/restrict-plus-operands': [
352
+ 'error',
353
+ {
354
+ skipCompoundAssignments: false
355
+ }
356
+ ],
357
+ '@typescript-eslint/restrict-template-expressions': [
358
+ 'error',
359
+ {
360
+ allowNumber: true
361
+ }
362
+ ],
363
+ '@typescript-eslint/return-await': [
364
+ 'error',
365
+ 'always'
366
+ ],
367
+ '@typescript-eslint/strict-boolean-expressions': [
368
+ 'error',
369
+ {
370
+ allowString: false,
371
+ allowNumber: false,
372
+ allowNullableObject: false,
373
+ allowNullableBoolean: false,
374
+ allowNullableString: false,
375
+ allowNullableNumber: false,
376
+ allowAny: false
377
+ }
378
+ ],
379
+ '@typescript-eslint/switch-exhaustiveness-check': [
380
+ 'error',
381
+ {
382
+ allowDefaultCaseForExhaustiveSwitch: false,
383
+ requireDefaultForNonUnion: false,
384
+ considerDefaultExhaustiveForUnions: true
385
+ }
386
+ ],
387
+ '@typescript-eslint/triple-slash-reference': [
388
+ 'error',
389
+ {
390
+ lib: 'never',
391
+ path: 'never',
392
+ types: 'never'
393
+ }
394
+ ],
395
+ '@typescript-eslint/unbound-method': [
396
+ 'error',
397
+ {
398
+ ignoreStatic: false
399
+ }
400
+ ],
401
+ '@typescript-eslint/unified-signatures': [
402
+ 'error',
403
+ {
404
+ ignoreDifferentlyNamedParameters: false
405
+ }
406
+ ],
407
+ '@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
408
+
409
+ /**
410
+ * `eslint-plugin-eslint-comments`
411
+ */
412
+ 'eslint-comments/disable-enable-pair': [
413
+ 'error',
414
+ {
415
+ allowWholeFile: true
416
+ }
417
+ ],
418
+ 'eslint-comments/no-aggregating-enable': 'error',
419
+ 'eslint-comments/no-duplicate-disable': 'error',
420
+ 'eslint-comments/no-unlimited-disable': 'error',
421
+ 'eslint-comments/no-unused-enable': 'error',
422
+ 'eslint-comments/require-description': [
423
+ 'error',
424
+ {
425
+ ignore: [
426
+ 'eslint-enable',
427
+ 'eslint-env'
428
+ ]
429
+ }
430
+ ],
431
+
432
+ /**
433
+ * `eslint-plugin-n`
434
+ */
435
+ 'n/handle-callback-err': [
436
+ 'error',
437
+ '^(err|error)$'
438
+ ],
439
+ 'n/no-callback-literal': 'error',
440
+ 'n/no-deprecated-api': 'error',
441
+ 'n/no-exports-assign': 'error',
442
+ 'n/no-new-require': 'error',
443
+ 'n/no-path-concat': 'error',
444
+ 'n/process-exit-as-throw': 'error',
445
+
446
+ /**
447
+ * `eslint-plugin-promise`
448
+ */
449
+ 'promise/param-names': 'error',
450
+
451
+ /**
452
+ * `eslint-plugin-import`
453
+ */
454
+ 'import/export': 'error',
455
+ 'import/first': 'error',
456
+ 'import/no-absolute-path': [
457
+ 'error',
458
+ {
459
+ esmodule: true,
460
+ commonjs: true,
461
+ amd: false
462
+ }
463
+ ],
464
+ 'import/no-duplicates': 'error',
465
+ 'import/no-named-default': 'error',
466
+ 'import/no-webpack-loader-syntax': 'error'
467
+ }
468
+ }
package/index.mjs CHANGED
@@ -1,11 +1,29 @@
1
- import typescript from '#eslint-config-typescript/config/typescript'
1
+ import {
2
+ parser
3
+ } from 'typescript-eslint'
4
+ import recommended from '#eslint-config-typescript/configs/recommended'
5
+ import typescript from '#eslint-config-typescript/configs/typescript'
6
+
7
+ export const configs = {
8
+ recommended,
9
+ typescript
10
+ }
2
11
 
3
12
  export default [
4
13
  {
5
14
  name: '@sequencemedia/eslint-config-typescript',
6
15
  languageOptions: {
7
- ecmaVersion: 'latest'
8
- }
16
+ parser,
17
+ parserOptions: {
18
+ projectService: true
19
+ }
20
+ },
21
+ linterOptions: {
22
+ reportUnusedDisableDirectives: 'error'
23
+ },
24
+ files: [
25
+ '**/*.{ts,mts,cts}'
26
+ ]
9
27
  },
10
28
  typescript
11
29
  ]
@@ -0,0 +1,12 @@
1
+ import merge from '@sequencemedia/eslint-merge'
2
+
3
+ import CONFIG from '#eslint-config-typescript/configs/recommended'
4
+
5
+ export default function mergeConfig (config) {
6
+ return (
7
+ merge(
8
+ CONFIG,
9
+ config
10
+ )
11
+ )
12
+ }
@@ -1,6 +1,6 @@
1
1
  import merge from '@sequencemedia/eslint-merge'
2
2
 
3
- import CONFIG from '#eslint-config-typescript/config/typescript'
3
+ import CONFIG from '#eslint-config-typescript/configs/typescript'
4
4
 
5
5
  export default function mergeConfig (config) {
6
6
  return (
package/merge.mjs CHANGED
@@ -3,11 +3,11 @@ import getMapMerge from '@sequencemedia/eslint-merge/get-map-merge'
3
3
  import eslintConfig from './index.mjs'
4
4
 
5
5
  function include ({ name }) {
6
- return name === '@sequencemedia/eslint-config-stylistic'
6
+ return name === '@sequencemedia/eslint-config-typescript'
7
7
  }
8
8
 
9
9
  function exclude ({ name }) {
10
- return name !== '@sequencemedia/eslint-config-stylistic'
10
+ return name !== '@sequencemedia/eslint-config-typescript'
11
11
  }
12
12
 
13
13
  export default function mergeESLintConfigWith (config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequencemedia/eslint-config-typescript",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "description": "TypeScript configuration for ESLint 9",
5
5
  "keywords": [
6
6
  "JavaScript TypeScript Style",
@@ -60,7 +60,7 @@
60
60
  "typescript-eslint": "^8.17.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@sequencemedia/eslint-config-standard": "^0.1.7",
63
+ "@sequencemedia/eslint-config-standard": "^0.2.0",
64
64
  "chai": "^5.1.2",
65
65
  "eslint": "^9.16.0",
66
66
  "husky": "^9.1.7",
@@ -72,16 +72,15 @@
72
72
  "imports": {
73
73
  "#eslint-config-typescript": "./index.mjs",
74
74
  "#eslint-config-typescript/common": "./common/index.mjs",
75
- "#eslint-config-typescript/config": "./config/index.mjs",
76
- "#eslint-config-typescript/config/*": "./config/*.mjs",
75
+ "#eslint-config-typescript/configs": "./configs/index.mjs",
76
+ "#eslint-config-typescript/configs/*": "./configs/*.mjs",
77
77
  "#eslint-config-typescript/merge": "./merge.mjs",
78
78
  "#eslint-config-typescript/merge/*": "./merge/*.mjs"
79
79
  },
80
80
  "exports": {
81
81
  ".": "./index.mjs",
82
- "./common": "./common/index.mjs",
83
- "./config": "./config/index.mjs",
84
- "./config/*": "./config/*.mjs",
82
+ "./configs": "./configs/index.mjs",
83
+ "./configs/*": "./configs/*.mjs",
85
84
  "./merge": "./merge.mjs",
86
85
  "./merge/*": "./merge/*.mjs"
87
86
  }
@@ -5,9 +5,9 @@ import {
5
5
  import {
6
6
  isString,
7
7
  isObject
8
- } from '@sequencemedia/eslint-config-typescript/common'
8
+ } from '#eslint-config-typescript/common'
9
9
 
10
- describe('@sequencemedia/eslint-config-typescript/common', () => {
10
+ describe('#eslint-config-typescript/common', () => {
11
11
  describe('`isString`', () => it('is a function', () => expect(isString).to.be.a('function')))
12
12
 
13
13
  describe('`isObject`', () => it('is a function', () => expect(isObject).to.be.a('function')))
@@ -0,0 +1,14 @@
1
+ import {
2
+ expect
3
+ } from 'chai'
4
+
5
+ import {
6
+ recommended,
7
+ typescript
8
+ } from '@sequencemedia/eslint-config-typescript/configs'
9
+
10
+ describe('@sequencemedia/eslint-config-typescript/configs', () => {
11
+ describe('`recommended`', () => it('is an object', () => expect(recommended).to.be.an('object')))
12
+
13
+ describe('`typescript`', () => it('is an object', () => expect(typescript).to.be.an('object')))
14
+ })
@@ -0,0 +1,9 @@
1
+ import {
2
+ expect
3
+ } from 'chai'
4
+
5
+ import recommended from '@sequencemedia/eslint-config-typescript/configs/recommended'
6
+
7
+ describe('@sequencemedia/eslint-config-typescript/configs/recommended', () => {
8
+ describe('`recommended`', () => it('is an object', () => expect(recommended).to.be.an('object')))
9
+ })
@@ -0,0 +1,9 @@
1
+ import {
2
+ expect
3
+ } from 'chai'
4
+
5
+ import typescript from '@sequencemedia/eslint-config-typescript/configs/typescript'
6
+
7
+ describe('@sequencemedia/eslint-config-typescript/configs/typescript', () => {
8
+ describe('`typescript`', () => it('is an object', () => expect(typescript).to.be.an('object')))
9
+ })
@@ -0,0 +1,75 @@
1
+ import {
2
+ expect
3
+ } from 'chai'
4
+
5
+ import RECOMMENDED from '@sequencemedia/eslint-config-typescript/configs/recommended'
6
+
7
+ import merge from '@sequencemedia/eslint-config-typescript/merge/recommended'
8
+
9
+ describe('@sequencemedia/eslint-config-typescript/merge/recommended', () => {
10
+ describe('`merge`', () => it('is a function', () => expect(merge).to.be.a('function')))
11
+
12
+ describe('`merge()`', () => {
13
+ describe('Always', () => it('returns an object', () => expect(merge()).to.be.an('object')))
14
+
15
+ describe('Merges', () => {
16
+ it('returns an object', () => {
17
+ const MOCK_FILES = [
18
+ 'MOCK FILES'
19
+ ]
20
+ const MOCK_IGNORES = [
21
+ 'MOCK IGNORES'
22
+ ]
23
+ const MOCK_LANGUAGE_OPTIONS = {
24
+ mockOption: 'MOCK LANGUAGE OPTIONS'
25
+ }
26
+ const MOCK_LINTER_OPTIONS = {
27
+ mockOptions: 'MOCK LINTER OPTIONS'
28
+ }
29
+ const MOCK_RULES = {
30
+ mockOption: 'MOCK RULES'
31
+ }
32
+ const MOCK_SETTINGS = {
33
+ mockOption: 'MOCK SETTINGS'
34
+ }
35
+
36
+ const {
37
+ languageOptions: RECOMMENDED_LANGUAGE_OPTIONS,
38
+ linterOptions: RECOMMENDED_LINTER_OPTIONS,
39
+ rules: RECOMMENDED_RULES
40
+ } = RECOMMENDED
41
+
42
+ return (
43
+ expect(
44
+ merge({
45
+ files: MOCK_FILES,
46
+ ignores: MOCK_IGNORES,
47
+ languageOptions: MOCK_LANGUAGE_OPTIONS,
48
+ linterOptions: MOCK_LINTER_OPTIONS,
49
+ rules: MOCK_RULES,
50
+ settings: MOCK_SETTINGS
51
+ })
52
+ )
53
+ .to.eql({
54
+ ...RECOMMENDED,
55
+ files: MOCK_FILES,
56
+ ignores: MOCK_IGNORES,
57
+ languageOptions: {
58
+ ...RECOMMENDED_LANGUAGE_OPTIONS,
59
+ ...MOCK_LANGUAGE_OPTIONS
60
+ },
61
+ linterOptions: {
62
+ ...RECOMMENDED_LINTER_OPTIONS,
63
+ ...MOCK_LINTER_OPTIONS
64
+ },
65
+ rules: {
66
+ ...RECOMMENDED_RULES,
67
+ ...MOCK_RULES
68
+ },
69
+ settings: MOCK_SETTINGS
70
+ })
71
+ )
72
+ })
73
+ })
74
+ })
75
+ })
@@ -2,11 +2,7 @@ import {
2
2
  expect
3
3
  } from 'chai'
4
4
 
5
- import {
6
- parser
7
- } from 'typescript-eslint'
8
-
9
- import TYPESCRIPT from '@sequencemedia/eslint-config-typescript/config/typescript'
5
+ import TYPESCRIPT from '@sequencemedia/eslint-config-typescript/configs/typescript'
10
6
 
11
7
  import merge from '@sequencemedia/eslint-config-typescript/merge/typescript'
12
8
 
@@ -25,16 +21,17 @@ describe('@sequencemedia/eslint-config-typescript/merge/typescript', () => {
25
21
  'MOCK IGNORES'
26
22
  ]
27
23
  const MOCK_LANGUAGE_OPTIONS = {
28
- parser,
29
- parserOptions: {
30
- projectService: true
31
- }
24
+ mockOption: 'MOCK LANGUAGE OPTIONS'
32
25
  }
33
26
  const MOCK_LINTER_OPTIONS = {
34
- reportUnusedDisableDirectives: 'error'
27
+ mockOptions: 'MOCK LINTER OPTIONS'
28
+ }
29
+ const MOCK_RULES = {
30
+ mockOption: 'MOCK RULES'
31
+ }
32
+ const MOCK_SETTINGS = {
33
+ mockOption: 'MOCK SETTINGS'
35
34
  }
36
- const MOCK_RULES = { mockOption: 'MOCK RULES' }
37
- const MOCK_SETTINGS = { mockOption: 'MOCK SETTINGS' }
38
35
 
39
36
  const {
40
37
  rules: TYPESCRIPT_RULES
@@ -6,7 +6,7 @@ import {
6
6
  parser
7
7
  } from 'typescript-eslint'
8
8
 
9
- import TYPESCRIPT from '@sequencemedia/eslint-config-typescript/config/typescript'
9
+ import TYPESCRIPT from '@sequencemedia/eslint-config-typescript/configs/typescript'
10
10
 
11
11
  import merge from '@sequencemedia/eslint-config-typescript/merge'
12
12
 
@@ -25,18 +25,21 @@ describe('@sequencemedia/eslint-config-typescript/merge', () => {
25
25
  'MOCK IGNORES'
26
26
  ]
27
27
  const MOCK_LANGUAGE_OPTIONS = {
28
- parser,
29
- parserOptions: {
30
- projectService: true
31
- }
28
+ mockOption: 'MOCK LANGUAGE OPTIONS'
32
29
  }
33
30
  const MOCK_LINTER_OPTIONS = {
34
- reportUnusedDisableDirectives: 'error'
31
+ mockOption: 'MOCK LINTER OPTIONS'
32
+ }
33
+ const MOCK_RULES = {
34
+ mockOption: 'MOCK RULES'
35
+ }
36
+ const MOCK_SETTINGS = {
37
+ mockOption: 'MOCK SETTINGS'
35
38
  }
36
- const MOCK_RULES = { mockOption: 'MOCK RULES' }
37
- const MOCK_SETTINGS = { mockOption: 'MOCK SETTINGS' }
38
39
 
39
40
  const {
41
+ languageOptions: TYPESCRIPT_LANGUAGE_OPTIONS,
42
+ linterOptions: TYPESCRIPT_LINTER_OPTIONS,
40
43
  rules: TYPESCRIPT_RULES
41
44
  } = TYPESCRIPT
42
45
 
@@ -54,28 +57,38 @@ describe('@sequencemedia/eslint-config-typescript/merge', () => {
54
57
  .to.eql([
55
58
  {
56
59
  name: '@sequencemedia/eslint-config-typescript',
57
- files: MOCK_FILES,
58
- ignores: MOCK_IGNORES,
59
60
  languageOptions: {
60
- ecmaVersion: 'latest',
61
- ...MOCK_LANGUAGE_OPTIONS
61
+ parser,
62
+ parserOptions: {
63
+ projectService: true
64
+ }
62
65
  },
63
- linterOptions: MOCK_LINTER_OPTIONS,
64
- rules: MOCK_RULES,
65
- settings: MOCK_SETTINGS
66
+ linterOptions: {
67
+ reportUnusedDisableDirectives: 'error'
68
+ },
69
+ files: [
70
+ '**/*.{ts,mts,cts}'
71
+ ]
66
72
  },
67
73
  {
68
74
  ...TYPESCRIPT,
69
75
  files: MOCK_FILES,
70
76
  ignores: MOCK_IGNORES,
71
- languageOptions: MOCK_LANGUAGE_OPTIONS,
72
- linterOptions: MOCK_LINTER_OPTIONS,
77
+ languageOptions: {
78
+ ...TYPESCRIPT_LANGUAGE_OPTIONS,
79
+ ...MOCK_LANGUAGE_OPTIONS
80
+ },
81
+ linterOptions: {
82
+ ...TYPESCRIPT_LINTER_OPTIONS,
83
+ ...MOCK_LINTER_OPTIONS
84
+ },
73
85
  rules: {
74
86
  ...TYPESCRIPT_RULES,
75
87
  ...MOCK_RULES
76
88
  },
77
89
  settings: MOCK_SETTINGS
78
- }])
90
+ }
91
+ ])
79
92
  )
80
93
  })
81
94
  })
package/config/index.mjs DELETED
@@ -1 +0,0 @@
1
- export { default as typescript } from './typescript.mjs'
@@ -1,350 +0,0 @@
1
- import {
2
- parser,
3
- plugin as t
4
- } from 'typescript-eslint'
5
- import c from 'eslint-plugin-eslint-comments'
6
- import n from 'eslint-plugin-n'
7
- import p from 'eslint-plugin-promise'
8
- import i from 'eslint-plugin-import'
9
-
10
- export default {
11
- name: '@sequencemedia/eslint-config-typescript/typescript',
12
- languageOptions: {
13
- parser,
14
- parserOptions: {
15
- projectService: true
16
- }
17
- },
18
- linterOptions: {
19
- reportUnusedDisableDirectives: 'error'
20
- },
21
- plugins: {
22
- '@typescript-eslint': t,
23
- 'eslint-comments': c,
24
- n,
25
- promise: p,
26
- import: i
27
- },
28
- rules: {
29
- /**
30
- * `@typescript-eslint`
31
- */
32
- '@typescript-eslint/adjacent-overload-signatures': ['error'],
33
- '@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
34
- '@typescript-eslint/await-thenable': ['error'],
35
- '@typescript-eslint/ban-ts-comment': [
36
- 'error',
37
- {
38
- 'ts-expect-error': 'allow-with-description',
39
- 'ts-ignore': true,
40
- 'ts-nocheck': true,
41
- 'ts-check': false,
42
- minimumDescriptionLength: 3
43
- }
44
- ],
45
- '@typescript-eslint/ban-tslint-comment': ['error'],
46
- '@typescript-eslint/class-literal-property-style': ['error', 'fields'],
47
- '@typescript-eslint/class-methods-use-this': [
48
- 'error',
49
- {
50
- exceptMethods: [],
51
- enforceForClassFields: true,
52
- ignoreOverrideMethods: false,
53
- ignoreClassesThatImplementAnInterface: false
54
- }
55
- ],
56
- '@typescript-eslint/consistent-generic-constructors': ['error', 'constructor'],
57
- '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
58
- '@typescript-eslint/consistent-type-assertions': [
59
- 'error',
60
- {
61
- assertionStyle: 'as',
62
- objectLiteralTypeAssertions: 'never'
63
- }
64
- ],
65
- '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
66
- '@typescript-eslint/consistent-type-exports': [
67
- 'error',
68
- {
69
- fixMixedExportsWithInlineTypeSpecifier: true
70
- }
71
- ],
72
- '@typescript-eslint/consistent-type-imports': [
73
- 'error',
74
- {
75
- prefer: 'type-imports',
76
- disallowTypeAnnotations: true,
77
- fixStyle: 'inline-type-imports'
78
- }
79
- ],
80
- '@typescript-eslint/dot-notation': [
81
- 'error',
82
- {
83
- allowIndexSignaturePropertyAccess: false,
84
- allowKeywords: true,
85
- allowPattern: '',
86
- allowPrivateClassPropertyAccess: false,
87
- allowProtectedClassPropertyAccess: false
88
- }
89
- ],
90
- '@typescript-eslint/explicit-function-return-type': [
91
- 'error',
92
- {
93
- allowExpressions: true,
94
- allowHigherOrderFunctions: true,
95
- allowTypedFunctionExpressions: true,
96
- allowDirectConstAssertionInArrowFunctions: true
97
- }
98
- ],
99
- '@typescript-eslint/init-declarations': ['error', 'always'],
100
- '@typescript-eslint/max-params': ['error', { max: 4 }],
101
- '@typescript-eslint/method-signature-style': ['error'],
102
- '@typescript-eslint/naming-convention': [
103
- 'error',
104
- {
105
- selector: 'variableLike',
106
- leadingUnderscore: 'allow',
107
- trailingUnderscore: 'allow',
108
- format: ['camelCase', 'PascalCase', 'UPPER_CASE']
109
- }
110
- ],
111
- '@typescript-eslint/no-array-constructor': ['error'],
112
- '@typescript-eslint/no-array-delete': ['error'],
113
- '@typescript-eslint/no-base-to-string': ['error'],
114
- '@typescript-eslint/no-confusing-non-null-assertion': ['error'],
115
- '@typescript-eslint/no-confusing-void-expression': [
116
- 'error',
117
- { ignoreArrowShorthand: false, ignoreVoidOperator: false }
118
- ],
119
- '@typescript-eslint/no-deprecated': ['warn'],
120
- '@typescript-eslint/no-dupe-class-members': ['error'],
121
- '@typescript-eslint/no-duplicate-enum-values': ['error'],
122
- '@typescript-eslint/no-duplicate-type-constituents': [
123
- 'error',
124
- { ignoreIntersections: false, ignoreUnions: false }
125
- ],
126
- '@typescript-eslint/no-dynamic-delete': ['error'],
127
- '@typescript-eslint/no-empty-function': [
128
- 'error',
129
- {
130
- allow: []
131
- }
132
- ],
133
- '@typescript-eslint/no-empty-object-type': [
134
- 'error',
135
- { allowInterfaces: 'with-single-extends', allowObjectTypes: 'never' }
136
- ],
137
- '@typescript-eslint/no-explicit-any': [
138
- 'error',
139
- { fixToUnknown: false, ignoreRestArgs: false }
140
- ],
141
- '@typescript-eslint/no-extra-non-null-assertion': ['error'],
142
- '@typescript-eslint/no-extraneous-class': ['error', { allowWithDecorator: true }],
143
- '@typescript-eslint/no-floating-promises': ['error'],
144
- '@typescript-eslint/no-for-in-array': ['error'],
145
- '@typescript-eslint/no-implied-eval': ['error'],
146
- '@typescript-eslint/no-import-type-side-effects': ['error'],
147
- '@typescript-eslint/no-inferrable-types': [
148
- 'error',
149
- { ignoreParameters: false, ignoreProperties: false }
150
- ],
151
- '@typescript-eslint/no-invalid-void-type': ['error'],
152
- '@typescript-eslint/no-loop-func': ['error'],
153
- '@typescript-eslint/no-magic-numbers': [
154
- 'error',
155
- {
156
- ignore: [],
157
- ignoreArrayIndexes: false,
158
- ignoreDefaultValues: false,
159
- ignoreClassFieldInitialValues: false,
160
- enforceConst: false,
161
- detectObjects: true,
162
- ignoreEnums: true,
163
- ignoreNumericLiteralTypes: false,
164
- ignoreReadonlyClassProperties: true,
165
- ignoreTypeIndexes: false
166
- }
167
- ],
168
- '@typescript-eslint/no-meaningless-void-operator': ['error', { checkNever: true }],
169
- '@typescript-eslint/no-misused-new': ['error'],
170
- '@typescript-eslint/no-misused-promises': ['error'],
171
- '@typescript-eslint/no-mixed-enums': ['error'],
172
- '@typescript-eslint/no-namespace': ['error'],
173
- '@typescript-eslint/no-non-null-asserted-nullish-coalescing': ['error'],
174
- '@typescript-eslint/no-non-null-asserted-optional-chain': ['error'],
175
- '@typescript-eslint/no-non-null-assertion': ['error'],
176
- '@typescript-eslint/no-redundant-type-constituents': ['error'],
177
- '@typescript-eslint/no-require-imports': ['error', { allow: [], allowAsImport: false }],
178
- '@typescript-eslint/no-this-alias': ['error', { allowDestructuring: true }],
179
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error'],
180
- '@typescript-eslint/no-unnecessary-condition': [
181
- 'error',
182
- {
183
- allowConstantLoopConditions: true
184
- }
185
- ],
186
- '@typescript-eslint/no-unnecessary-parameter-property-assignment': ['error'],
187
- '@typescript-eslint/no-unnecessary-qualifier': ['error'],
188
- '@typescript-eslint/no-unnecessary-template-expression': ['error'],
189
- '@typescript-eslint/no-unnecessary-type-arguments': ['error'],
190
- '@typescript-eslint/no-unnecessary-type-assertion': ['error'],
191
- '@typescript-eslint/no-unnecessary-type-constraint': ['error'],
192
- '@typescript-eslint/no-unnecessary-type-parameters': ['error'],
193
- '@typescript-eslint/no-unsafe-argument': ['error'],
194
- '@typescript-eslint/no-unsafe-assignment': ['error'],
195
- '@typescript-eslint/no-unsafe-call': ['error'],
196
- '@typescript-eslint/no-unsafe-declaration-merging': ['error'],
197
- '@typescript-eslint/no-unsafe-enum-comparison': ['error'],
198
- '@typescript-eslint/no-unsafe-function-type': ['error'],
199
- '@typescript-eslint/no-unsafe-member-access': ['error'],
200
- '@typescript-eslint/no-unsafe-return': ['error'],
201
- '@typescript-eslint/no-unsafe-type-assertion': ['error'],
202
- '@typescript-eslint/no-unsafe-unary-minus': ['error'],
203
- '@typescript-eslint/no-unused-expressions': [
204
- 'error',
205
- {
206
- allowShortCircuit: true,
207
- allowTernary: true,
208
- allowTaggedTemplates: true,
209
- enforceForJSX: false
210
- }
211
- ],
212
- '@typescript-eslint/no-unused-vars': [
213
- 'error',
214
- {
215
- args: 'none',
216
- caughtErrors: 'none',
217
- ignoreRestSiblings: true,
218
- vars: 'all'
219
- }
220
- ],
221
- '@typescript-eslint/no-use-before-define': [
222
- 'error',
223
- {
224
- functions: false,
225
- classes: false,
226
- enums: false,
227
- variables: false,
228
- typedefs: false
229
- }
230
- ],
231
- '@typescript-eslint/no-useless-constructor': ['error'],
232
- '@typescript-eslint/no-useless-empty-export': ['error'],
233
- '@typescript-eslint/no-wrapper-object-types': ['error'],
234
- '@typescript-eslint/non-nullable-type-assertion-style': ['error'],
235
- '@typescript-eslint/only-throw-error': [
236
- 'error',
237
- { allowThrowingAny: false, allowThrowingUnknown: false }
238
- ],
239
- '@typescript-eslint/prefer-as-const': ['error'],
240
- '@typescript-eslint/prefer-destructuring': [
241
- 'error',
242
- { array: true, object: true },
243
- {
244
- enforceForRenamedProperties: true,
245
- enforceForDeclarationWithTypeAnnotation: false
246
- }
247
- ],
248
- '@typescript-eslint/prefer-find': ['error'],
249
- '@typescript-eslint/prefer-for-of': ['error'],
250
- '@typescript-eslint/prefer-function-type': ['error'],
251
- '@typescript-eslint/prefer-includes': ['error'],
252
- '@typescript-eslint/prefer-literal-enum-member': ['error', { allowBitwiseExpressions: true }],
253
- '@typescript-eslint/prefer-namespace-keyword': ['error'],
254
- '@typescript-eslint/prefer-nullish-coalescing': [
255
- 'error',
256
- { ignoreConditionalTests: false, ignoreMixedLogicalExpressions: false }
257
- ],
258
- '@typescript-eslint/prefer-optional-chain': ['error'],
259
- '@typescript-eslint/prefer-promise-reject-errors': ['error'],
260
- '@typescript-eslint/prefer-readonly': ['error'],
261
- '@typescript-eslint/prefer-reduce-type-parameter': ['error'],
262
- '@typescript-eslint/prefer-regexp-exec': ['error'],
263
- '@typescript-eslint/prefer-return-this-type': ['error'],
264
- '@typescript-eslint/prefer-string-starts-ends-with': [
265
- 'error',
266
- { allowSingleElementEquality: 'never' }
267
- ],
268
- '@typescript-eslint/promise-function-async': ['error'],
269
- '@typescript-eslint/related-getter-setter-pairs': ['error'],
270
- '@typescript-eslint/require-array-sort-compare': ['error', { ignoreStringArrays: true }],
271
- '@typescript-eslint/require-await': ['error'],
272
- '@typescript-eslint/restrict-plus-operands': ['error', { skipCompoundAssignments: false }],
273
- '@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
274
- '@typescript-eslint/return-await': ['error', 'always'],
275
- '@typescript-eslint/strict-boolean-expressions': [
276
- 'error',
277
- {
278
- allowString: false,
279
- allowNumber: false,
280
- allowNullableObject: false,
281
- allowNullableBoolean: false,
282
- allowNullableString: false,
283
- allowNullableNumber: false,
284
- allowAny: false
285
- }
286
- ],
287
- '@typescript-eslint/switch-exhaustiveness-check': [
288
- 'error',
289
- {
290
- allowDefaultCaseForExhaustiveSwitch: false,
291
- requireDefaultForNonUnion: false,
292
- considerDefaultExhaustiveForUnions: true
293
- }
294
- ],
295
- '@typescript-eslint/triple-slash-reference': [
296
- 'error',
297
- { lib: 'never', path: 'never', types: 'never' }
298
- ],
299
- '@typescript-eslint/unbound-method': ['error', { ignoreStatic: false }],
300
- '@typescript-eslint/unified-signatures': [
301
- 'error',
302
- { ignoreDifferentlyNamedParameters: false }
303
- ],
304
- '@typescript-eslint/use-unknown-in-catch-callback-variable': ['error'],
305
-
306
- /**
307
- * `eslint-plugin-eslint-comments`
308
- */
309
- 'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
310
- 'eslint-comments/no-aggregating-enable': ['error'],
311
- 'eslint-comments/no-duplicate-disable': ['error'],
312
- 'eslint-comments/no-unlimited-disable': ['error'],
313
- 'eslint-comments/no-unused-enable': ['error'],
314
- 'eslint-comments/require-description': [
315
- 'error',
316
- {
317
- ignore: ['eslint-enable', 'eslint-env']
318
- }
319
- ],
320
-
321
- /**
322
- * `eslint-plugin-n`
323
- */
324
- 'n/handle-callback-err': ['error', '^(err|error)$'],
325
- 'n/no-callback-literal': ['error'],
326
- 'n/no-deprecated-api': ['error'],
327
- 'n/no-exports-assign': ['error'],
328
- 'n/no-new-require': ['error'],
329
- 'n/no-path-concat': ['error'],
330
- 'n/process-exit-as-throw': ['error'],
331
-
332
- /**
333
- * `eslint-plugin-promise`
334
- */
335
- 'promise/param-names': ['error'],
336
-
337
- /**
338
- * `eslint-plugin-import`
339
- */
340
- 'import/export': ['error'],
341
- 'import/first': ['error'],
342
- 'import/no-absolute-path': [
343
- 'error',
344
- { esmodule: true, commonjs: true, amd: false }
345
- ],
346
- 'import/no-duplicates': ['error'],
347
- 'import/no-named-default': ['error'],
348
- 'import/no-webpack-loader-syntax': ['error']
349
- }
350
- }
@@ -1,9 +0,0 @@
1
- import {
2
- expect
3
- } from 'chai'
4
-
5
- import { typescript } from '@sequencemedia/eslint-config-typescript/config'
6
-
7
- describe('@sequencemedia/eslint-config-typescript/config', () => {
8
- describe('`typescript`', () => it('is an object', () => expect(typescript).to.be.an('object')))
9
- })