@sequencemedia/eslint-config-typescript 0.0.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 +3 -0
- package/common/index.mjs +10 -0
- package/common/merge.mjs +79 -0
- package/config/typescript.mjs +350 -0
- package/index.mjs +11 -0
- package/merge/typescript.mjs +38 -0
- package/merge.mjs +47 -0
- package/package.json +86 -0
- package/test/common/index.spec.mjs +34 -0
- package/test/common/merge.spec.mjs +109 -0
- package/test/merge/typescript.spec.mjs +70 -0
- package/test/merge.spec.mjs +83 -0
package/README.md
ADDED
package/common/index.mjs
ADDED
package/common/merge.mjs
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
function hasLanguageOptionsParser ({ languageOptions: { parser = null } = {} }) {
|
|
2
|
+
return Boolean(parser)
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function getLanguageOptionsParser ({ languageOptions: { parser = null } = {} }) {
|
|
6
|
+
return parser
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function filterLanguageOptionsEntriesbyKey ([key]) {
|
|
10
|
+
return key !== 'parser'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getLanguageOptions ({ languageOptions = {} }) {
|
|
14
|
+
const entries = Object.entries(languageOptions)
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
Object.fromEntries(
|
|
18
|
+
entries.filter(filterLanguageOptionsEntriesbyKey)
|
|
19
|
+
)
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getLinterOptions ({ linterOptions = {} }) {
|
|
24
|
+
return linterOptions
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getProcessor ({ processor = {} }) {
|
|
28
|
+
return processor
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getRules ({ rules = {} }) {
|
|
32
|
+
return rules
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getSettings ({ settings = {} }) {
|
|
36
|
+
return settings
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function mergeLanguageOptions (alpha = {}, omega = {}) {
|
|
40
|
+
return (
|
|
41
|
+
Object
|
|
42
|
+
.assign(
|
|
43
|
+
hasLanguageOptionsParser(alpha) ? { parser: getLanguageOptionsParser(alpha) } : {},
|
|
44
|
+
structuredClone(getLanguageOptions(alpha)),
|
|
45
|
+
hasLanguageOptionsParser(omega) ? { parser: getLanguageOptionsParser(omega) } : {},
|
|
46
|
+
getLanguageOptions(omega)
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function mergeLinterOptions (alpha = {}, omega = {}) {
|
|
52
|
+
return (
|
|
53
|
+
Object
|
|
54
|
+
.assign(
|
|
55
|
+
structuredClone(getLinterOptions(alpha)),
|
|
56
|
+
getLinterOptions(omega)
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function mergeRules (alpha = {}, omega = {}) {
|
|
62
|
+
return (
|
|
63
|
+
Object
|
|
64
|
+
.assign(
|
|
65
|
+
structuredClone(getRules(alpha)),
|
|
66
|
+
getRules(omega)
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function mergeSettings (alpha = {}, omega = {}) {
|
|
72
|
+
return (
|
|
73
|
+
Object
|
|
74
|
+
.assign(
|
|
75
|
+
structuredClone(getSettings(alpha)),
|
|
76
|
+
getSettings(omega)
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
}
|
|
@@ -0,0 +1,350 @@
|
|
|
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
|
+
linterOptions: {
|
|
13
|
+
reportUnusedDisableDirectives: 'error'
|
|
14
|
+
},
|
|
15
|
+
languageOptions: {
|
|
16
|
+
parser,
|
|
17
|
+
parserOptions: {
|
|
18
|
+
projectService: true
|
|
19
|
+
}
|
|
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
|
+
}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import typescript from '#eslint-config-typescript/config/typescript'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
mergeLanguageOptions,
|
|
5
|
+
mergeLinterOptions,
|
|
6
|
+
mergeRules,
|
|
7
|
+
mergeSettings
|
|
8
|
+
} from '#eslint-config-typescript/common/merge'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* name - A name for the configuration object. This is used in error messages and config inspector to help identify which configuration object is being used. (Naming Convention)
|
|
12
|
+
* files - An array of glob patterns indicating the files that the configuration object should apply to. If not specified, the configuration object applies to all files matched by any other configuration object.
|
|
13
|
+
* ignores - An array of glob patterns indicating the files that the configuration object should not apply to. If not specified, the configuration object applies to all files matched by files. If ignores is used without any other keys in the configuration object, then the patterns act as global ignores.
|
|
14
|
+
* languageOptions - An object containing settings related to how JavaScript is configured for linting.
|
|
15
|
+
* - ecmaVersion - The version of ECMAScript to support. May be any year (i.e., 2022) or version (i.e., 5). Set to "latest" for the most recent supported version. (default: "latest")
|
|
16
|
+
* - sourceType - The type of JavaScript source code. Possible values are "script" for traditional script files, "module" for ECMAScript modules (ESM), and "commonjs" for CommonJS files. (default: "module" for .js and .mjs files; "commonjs" for .cjs files)
|
|
17
|
+
* - globals - An object specifying additional objects that should be added to the global scope during linting.
|
|
18
|
+
* - parser - An object containing a parse() method or a parseForESLint() method. (default: espree)
|
|
19
|
+
* - parserOptions - An object specifying additional options that are passed directly to the parse() or parseForESLint() method on the parser. The available options are parser-dependent.
|
|
20
|
+
* linterOptions - An object containing settings related to the linting process.
|
|
21
|
+
* - noInlineConfig - A Boolean value indicating if inline configuration is allowed.
|
|
22
|
+
* - reportUnusedDisableDirectives - A severity string indicating if and how unused disable and enable directives should be tracked and reported. For legacy compatibility, true is equivalent to "warn" and false is equivalent to "off". (default: "warn").
|
|
23
|
+
* processor - Either an object containing preprocess() and postprocess() methods or a string indicating the name of a processor inside of a plugin (i.e., "pluginName/processorName").
|
|
24
|
+
* plugins - An object containing a name-value mapping of plugin names to plugin objects. When files is specified, these plugins are only available to the matching files.
|
|
25
|
+
* rules - An object containing the configured rules. When files or ignores are specified, these rule configurations are only available to the matching files.
|
|
26
|
+
* settings - An object containing name-value pairs of information that should be available to all rules.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export default function merge (configuration) {
|
|
30
|
+
return {
|
|
31
|
+
...typescript,
|
|
32
|
+
...configuration,
|
|
33
|
+
languageOptions: mergeLanguageOptions(typescript, configuration),
|
|
34
|
+
linterOptions: mergeLinterOptions(typescript, configuration),
|
|
35
|
+
rules: mergeRules(typescript, configuration),
|
|
36
|
+
settings: mergeSettings(typescript, configuration)
|
|
37
|
+
}
|
|
38
|
+
}
|
package/merge.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import typescript from '#eslint-config-typescript'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
mergeLanguageOptions,
|
|
5
|
+
mergeLinterOptions,
|
|
6
|
+
mergeRules,
|
|
7
|
+
mergeSettings
|
|
8
|
+
} from '#eslint-config-typescript/common/merge'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* name - A name for the configuration object. This is used in error messages and config inspector to help identify which configuration object is being used. (Naming Convention)
|
|
12
|
+
* files - An array of glob patterns indicating the files that the configuration object should apply to. If not specified, the configuration object applies to all files matched by any other configuration object.
|
|
13
|
+
* ignores - An array of glob patterns indicating the files that the configuration object should not apply to. If not specified, the configuration object applies to all files matched by files. If ignores is used without any other keys in the configuration object, then the patterns act as global ignores.
|
|
14
|
+
* languageOptions - An object containing settings related to how JavaScript is configured for linting.
|
|
15
|
+
* - ecmaVersion - The version of ECMAScript to support. May be any year (i.e., 2022) or version (i.e., 5). Set to "latest" for the most recent supported version. (default: "latest")
|
|
16
|
+
* - sourceType - The type of JavaScript source code. Possible values are "script" for traditional script files, "module" for ECMAScript modules (ESM), and "commonjs" for CommonJS files. (default: "module" for .js and .mjs files; "commonjs" for .cjs files)
|
|
17
|
+
* - globals - An object specifying additional objects that should be added to the global scope during linting.
|
|
18
|
+
* - parser - An object containing a parse() method or a parseForESLint() method. (default: espree)
|
|
19
|
+
* - parserOptions - An object specifying additional options that are passed directly to the parse() or parseForESLint() method on the parser. The available options are parser-dependent.
|
|
20
|
+
* linterOptions - An object containing settings related to the linting process.
|
|
21
|
+
* - noInlineConfig - A Boolean value indicating if inline configuration is allowed.
|
|
22
|
+
* - reportUnusedDisableDirectives - A severity string indicating if and how unused disable and enable directives should be tracked and reported. For legacy compatibility, true is equivalent to "warn" and false is equivalent to "off". (default: "warn").
|
|
23
|
+
* processor - Either an object containing preprocess() and postprocess() methods or a string indicating the name of a processor inside of a plugin (i.e., "pluginName/processorName").
|
|
24
|
+
* plugins - An object containing a name-value mapping of plugin names to plugin objects. When files is specified, these plugins are only available to the matching files.
|
|
25
|
+
* rules - An object containing the configured rules. When files or ignores are specified, these rule configurations are only available to the matching files.
|
|
26
|
+
* settings - An object containing name-value pairs of information that should be available to all rules.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
function toMergeWith (omega) {
|
|
30
|
+
return function mergeWith (alpha) {
|
|
31
|
+
return {
|
|
32
|
+
...alpha,
|
|
33
|
+
...omega,
|
|
34
|
+
languageOptions: mergeLanguageOptions(alpha, omega),
|
|
35
|
+
linterOptions: mergeLinterOptions(alpha, omega),
|
|
36
|
+
rules: mergeRules(alpha, omega),
|
|
37
|
+
settings: mergeSettings(alpha, omega)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default function merge (omega) {
|
|
43
|
+
return (
|
|
44
|
+
typescript
|
|
45
|
+
.map(toMergeWith(omega))
|
|
46
|
+
)
|
|
47
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sequencemedia/eslint-config-typescript",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "TypeScript configuration for ESLint 9",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"JavaScript TypeScript Style",
|
|
7
|
+
"check",
|
|
8
|
+
"checker",
|
|
9
|
+
"code",
|
|
10
|
+
"code checker",
|
|
11
|
+
"code linter",
|
|
12
|
+
"code standards",
|
|
13
|
+
"code style",
|
|
14
|
+
"enforce",
|
|
15
|
+
"eslint",
|
|
16
|
+
"eslintconfig",
|
|
17
|
+
"hint",
|
|
18
|
+
"jscs",
|
|
19
|
+
"jshint",
|
|
20
|
+
"lint",
|
|
21
|
+
"policy",
|
|
22
|
+
"quality",
|
|
23
|
+
"simple",
|
|
24
|
+
"typescript",
|
|
25
|
+
"typescript style",
|
|
26
|
+
"style",
|
|
27
|
+
"style checker",
|
|
28
|
+
"style linter",
|
|
29
|
+
"verify"
|
|
30
|
+
],
|
|
31
|
+
"main": "./index.mjs",
|
|
32
|
+
"type": "module",
|
|
33
|
+
"author": {
|
|
34
|
+
"name": "Jonathan Perry for Sequence Media Limited",
|
|
35
|
+
"email": "sequencemedia@sequencemedia.net",
|
|
36
|
+
"url": "https://sequencemedia.net"
|
|
37
|
+
},
|
|
38
|
+
"license": "ISC",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+ssh://git@github.com/sequencemedia/eslint-config-typescript.git"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/sequencemedia/eslint-config-typescript#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/sequencemedia/eslint-config-typescript/issues"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"lint": "eslint .",
|
|
49
|
+
"lint:fix": "npm run lint -- --fix",
|
|
50
|
+
"prepare": "husky",
|
|
51
|
+
"test": "mocha test --recursive --verbose --color"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
55
|
+
"eslint-plugin-import": "^2.31.0",
|
|
56
|
+
"eslint-plugin-n": "^17.14.0",
|
|
57
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
58
|
+
"globals": "^15.13.0",
|
|
59
|
+
"typescript-eslint": "^8.15.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@sequencemedia/eslint-config-standard": "^0.1.1",
|
|
63
|
+
"chai": "^5.1.2",
|
|
64
|
+
"eslint": "^9.16.0",
|
|
65
|
+
"husky": "^9.1.7",
|
|
66
|
+
"mocha": "^11.0.1"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"eslint": ">=9"
|
|
70
|
+
},
|
|
71
|
+
"imports": {
|
|
72
|
+
"#eslint-config-typescript": "./index.mjs",
|
|
73
|
+
"#eslint-config-typescript/common": "./common/index.mjs",
|
|
74
|
+
"#eslint-config-typescript/common/merge": "./common/merge.mjs",
|
|
75
|
+
"#eslint-config-typescript/common/merge/*": "./common/merge/*.mjs",
|
|
76
|
+
"#eslint-config-typescript/config/*": "./config/*.mjs",
|
|
77
|
+
"#eslint-config-typescript/merge": "./merge.mjs",
|
|
78
|
+
"#eslint-config-typescript/merge/*": "./merge/*.mjs"
|
|
79
|
+
},
|
|
80
|
+
"exports": {
|
|
81
|
+
".": "./index.mjs",
|
|
82
|
+
"./config/*": "./config/*.mjs",
|
|
83
|
+
"./merge": "./merge.mjs",
|
|
84
|
+
"./merge/*": "./merge/*.mjs"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect
|
|
3
|
+
} from 'chai'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
isString,
|
|
7
|
+
isObject
|
|
8
|
+
} from '#eslint-config-typescript/common'
|
|
9
|
+
|
|
10
|
+
describe('#eslint-config-typescript/common', () => {
|
|
11
|
+
describe('`isString`', () => it('is a function', () => expect(isString).to.be.a('function')))
|
|
12
|
+
|
|
13
|
+
describe('`isObject`', () => it('is a function', () => expect(isObject).to.be.a('function')))
|
|
14
|
+
|
|
15
|
+
describe('`isString()`', () => {
|
|
16
|
+
describe('argument is a string', () => it('returns true', () => expect(isString('')).to.true))
|
|
17
|
+
describe('argument is a number', () => it('returns false', () => expect(isString(1)).to.be.false))
|
|
18
|
+
describe('argument is null', () => it('returns false', () => expect(isString(null)).to.be.false))
|
|
19
|
+
describe('argument is undefined', () => it('returns false', () => expect(isString()).to.be.false))
|
|
20
|
+
describe('argument is a boolean', () => it('returns false', () => expect(isString(true)).to.be.false))
|
|
21
|
+
describe('argument is an object', () => it('returns false', () => expect(isString({})).to.be.false))
|
|
22
|
+
describe('argument is an array', () => it('returns false', () => expect(isString([])).to.be.false))
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe('`isObject()`', () => {
|
|
26
|
+
describe('argument is a string', () => it('returns false', () => expect(isObject('')).to.false))
|
|
27
|
+
describe('argument is a number', () => it('returns false', () => expect(isObject(1)).to.be.false))
|
|
28
|
+
describe('argument is null', () => it('returns false', () => expect(isObject(null)).to.be.false))
|
|
29
|
+
describe('argument is undefined', () => it('returns false', () => expect(isObject()).to.be.false))
|
|
30
|
+
describe('argument is a boolean', () => it('returns false', () => expect(isObject(true)).to.be.false))
|
|
31
|
+
describe('argument is an object', () => it('returns true', () => expect(isObject({})).to.be.true))
|
|
32
|
+
describe('argument is an array', () => it('returns false', () => expect(isObject([])).to.be.false))
|
|
33
|
+
})
|
|
34
|
+
})
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect
|
|
3
|
+
} from 'chai'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
getLanguageOptions,
|
|
7
|
+
getLinterOptions,
|
|
8
|
+
getRules,
|
|
9
|
+
getSettings,
|
|
10
|
+
mergeLanguageOptions,
|
|
11
|
+
mergeLinterOptions,
|
|
12
|
+
mergeRules,
|
|
13
|
+
mergeSettings
|
|
14
|
+
} from '#eslint-config-typescript/common/merge'
|
|
15
|
+
|
|
16
|
+
describe('#eslint-config-typescript/common/merge', () => {
|
|
17
|
+
const MOCK_LANGUAGE_OPTIONS = {}
|
|
18
|
+
const MOCK_LINTER_OPTIONS = {}
|
|
19
|
+
const MOCK_RULES = {}
|
|
20
|
+
const MOCK_SETTINGS = {}
|
|
21
|
+
|
|
22
|
+
describe('`getLanguageOptions`', () => {
|
|
23
|
+
it('is a function', () => expect(getLanguageOptions).to.be.a('function'))
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
describe('`getLinterOptions`', () => {
|
|
27
|
+
it('is a function', () => expect(getLinterOptions).to.be.a('function'))
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
describe('`getRules`', () => {
|
|
31
|
+
it('is a function', () => expect(getRules).to.be.a('function'))
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe('`getSettings`', () => {
|
|
35
|
+
it('is a function', () => expect(getSettings).to.be.a('function'))
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
describe('`mergeLanguageOptions`', () => {
|
|
39
|
+
it('is a function', () => expect(mergeLanguageOptions).to.be.a('function'))
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe('`mergeLinterOptions`', () => {
|
|
43
|
+
it('is a function', () => expect(mergeLinterOptions).to.be.a('function'))
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
describe('`mergeRules`', () => {
|
|
47
|
+
it('is a function', () => expect(mergeRules).to.be.a('function'))
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
describe('`mergeSettings`', () => {
|
|
51
|
+
it('is a function', () => expect(mergeSettings).to.be.a('function'))
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
describe('`getLanguageOptions()`', () => {
|
|
55
|
+
it('returns an object', () => (
|
|
56
|
+
expect(getLanguageOptions({ languageOptions: MOCK_LANGUAGE_OPTIONS }))
|
|
57
|
+
.to.eql(MOCK_LANGUAGE_OPTIONS) // not identical
|
|
58
|
+
))
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
describe('`getLinterOptions()`', () => {
|
|
62
|
+
it('returns an object', () => (
|
|
63
|
+
expect(getLinterOptions({ linterOptions: MOCK_LINTER_OPTIONS }))
|
|
64
|
+
.to.equal(MOCK_LINTER_OPTIONS)
|
|
65
|
+
))
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
describe('`getRules()`', () => {
|
|
69
|
+
it('returns an object', () => (
|
|
70
|
+
expect(getRules({ rules: MOCK_RULES }))
|
|
71
|
+
.to.equal(MOCK_RULES)
|
|
72
|
+
))
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
describe('`getSettings()`', () => {
|
|
76
|
+
it('returns an object', () => (
|
|
77
|
+
expect(getSettings({ settings: MOCK_SETTINGS }))
|
|
78
|
+
.to.equal(MOCK_SETTINGS)
|
|
79
|
+
))
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
describe('`mergeLanguageOptions()`', () => {
|
|
83
|
+
it('returns an object', () => (
|
|
84
|
+
expect(mergeLanguageOptions({ languageOptions: { mockOption: 'alpha' } }, { languageOptions: { mockOption: 'omega' } }))
|
|
85
|
+
.to.eql({ mockOption: 'omega' })
|
|
86
|
+
))
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
describe('`mergeLinterOptions()`', () => {
|
|
90
|
+
it('returns an object', () => (
|
|
91
|
+
expect(mergeLinterOptions({ linterOptions: { mockOption: 'alpha' } }, { linterOptions: { mockOption: 'omega' } }))
|
|
92
|
+
.to.eql({ mockOption: 'omega' })
|
|
93
|
+
))
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
describe('`mergeRules()`', () => {
|
|
97
|
+
it('returns an object', () => (
|
|
98
|
+
expect(mergeRules({ rules: { mockOption: 'alpha' } }, { rules: { mockOption: 'omega' } }))
|
|
99
|
+
.to.eql({ mockOption: 'omega' })
|
|
100
|
+
))
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
describe('`mergeSettings()`', () => {
|
|
104
|
+
it('returns an object', () => (
|
|
105
|
+
expect(mergeSettings({ settings: { mockOption: 'alpha' } }, { settings: { mockOption: 'omega' } }))
|
|
106
|
+
.to.eql({ mockOption: 'omega' })
|
|
107
|
+
))
|
|
108
|
+
})
|
|
109
|
+
})
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect
|
|
3
|
+
} from 'chai'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
parser
|
|
7
|
+
} from 'typescript-eslint'
|
|
8
|
+
|
|
9
|
+
import TYPESCRIPT from '#eslint-config-typescript/config/typescript'
|
|
10
|
+
|
|
11
|
+
import merge from '#eslint-config-typescript/merge/typescript'
|
|
12
|
+
|
|
13
|
+
describe('#eslint-config-typescript/merge/typescript', () => {
|
|
14
|
+
describe('`merge`', () => it('is a function', () => expect(merge).to.be.a('function')))
|
|
15
|
+
|
|
16
|
+
describe('`merge()`', () => {
|
|
17
|
+
describe('Always', () => it('returns an object', () => expect(merge()).to.be.an('object')))
|
|
18
|
+
|
|
19
|
+
describe('Merges', () => {
|
|
20
|
+
it('returns an object', () => {
|
|
21
|
+
const MOCK_FILES = [
|
|
22
|
+
'MOCK FILES'
|
|
23
|
+
]
|
|
24
|
+
const MOCK_IGNORES = [
|
|
25
|
+
'MOCK IGNORES'
|
|
26
|
+
]
|
|
27
|
+
const MOCK_LANGUAGE_OPTIONS = {
|
|
28
|
+
parser,
|
|
29
|
+
parserOptions: {
|
|
30
|
+
projectService: true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const MOCK_LINTER_OPTIONS = {
|
|
34
|
+
reportUnusedDisableDirectives: 'error'
|
|
35
|
+
}
|
|
36
|
+
const MOCK_RULES = { mockOption: 'MOCK RULES' }
|
|
37
|
+
const MOCK_SETTINGS = { mockOption: 'MOCK SETTINGS' }
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
rules: TYPESCRIPT_RULES
|
|
41
|
+
} = TYPESCRIPT
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
expect(
|
|
45
|
+
merge({
|
|
46
|
+
files: MOCK_FILES,
|
|
47
|
+
ignores: MOCK_IGNORES,
|
|
48
|
+
languageOptions: MOCK_LANGUAGE_OPTIONS,
|
|
49
|
+
linterOptions: MOCK_LINTER_OPTIONS,
|
|
50
|
+
rules: MOCK_RULES,
|
|
51
|
+
settings: MOCK_SETTINGS
|
|
52
|
+
})
|
|
53
|
+
)
|
|
54
|
+
.to.eql({
|
|
55
|
+
...TYPESCRIPT,
|
|
56
|
+
files: MOCK_FILES,
|
|
57
|
+
ignores: MOCK_IGNORES,
|
|
58
|
+
languageOptions: MOCK_LANGUAGE_OPTIONS,
|
|
59
|
+
linterOptions: MOCK_LINTER_OPTIONS,
|
|
60
|
+
rules: {
|
|
61
|
+
...TYPESCRIPT_RULES,
|
|
62
|
+
...MOCK_RULES
|
|
63
|
+
},
|
|
64
|
+
settings: MOCK_SETTINGS
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
})
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect
|
|
3
|
+
} from 'chai'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
parser
|
|
7
|
+
} from 'typescript-eslint'
|
|
8
|
+
|
|
9
|
+
import TYPESCRIPT from '#eslint-config-typescript/config/typescript'
|
|
10
|
+
|
|
11
|
+
import merge from '#eslint-config-typescript/merge'
|
|
12
|
+
|
|
13
|
+
describe('#eslint-config-typescript/merge', () => {
|
|
14
|
+
describe('`merge`', () => it('is a function', () => expect(merge).to.be.a('function')))
|
|
15
|
+
|
|
16
|
+
describe('`merge()`', () => {
|
|
17
|
+
describe('Always', () => it('returns an array', () => expect(merge()).to.be.an('array')))
|
|
18
|
+
|
|
19
|
+
describe('Merges', () => {
|
|
20
|
+
it('returns an array', () => {
|
|
21
|
+
const MOCK_FILES = [
|
|
22
|
+
'MOCK FILES'
|
|
23
|
+
]
|
|
24
|
+
const MOCK_IGNORES = [
|
|
25
|
+
'MOCK IGNORES'
|
|
26
|
+
]
|
|
27
|
+
const MOCK_LANGUAGE_OPTIONS = {
|
|
28
|
+
parser,
|
|
29
|
+
parserOptions: {
|
|
30
|
+
projectService: true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const MOCK_LINTER_OPTIONS = {
|
|
34
|
+
reportUnusedDisableDirectives: 'error'
|
|
35
|
+
}
|
|
36
|
+
const MOCK_RULES = { mockOption: 'MOCK RULES' }
|
|
37
|
+
const MOCK_SETTINGS = { mockOption: 'MOCK SETTINGS' }
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
rules: TYPESCRIPT_RULES
|
|
41
|
+
} = TYPESCRIPT
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
expect(
|
|
45
|
+
merge({
|
|
46
|
+
files: MOCK_FILES,
|
|
47
|
+
ignores: MOCK_IGNORES,
|
|
48
|
+
languageOptions: MOCK_LANGUAGE_OPTIONS,
|
|
49
|
+
linterOptions: MOCK_LINTER_OPTIONS,
|
|
50
|
+
rules: MOCK_RULES,
|
|
51
|
+
settings: MOCK_SETTINGS
|
|
52
|
+
})
|
|
53
|
+
)
|
|
54
|
+
.to.eql([
|
|
55
|
+
{
|
|
56
|
+
name: '@sequencemedia/eslint-config-typescript',
|
|
57
|
+
files: MOCK_FILES,
|
|
58
|
+
ignores: MOCK_IGNORES,
|
|
59
|
+
languageOptions: {
|
|
60
|
+
ecmaVersion: 'latest',
|
|
61
|
+
...MOCK_LANGUAGE_OPTIONS
|
|
62
|
+
},
|
|
63
|
+
linterOptions: MOCK_LINTER_OPTIONS,
|
|
64
|
+
rules: MOCK_RULES,
|
|
65
|
+
settings: MOCK_SETTINGS
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
...TYPESCRIPT,
|
|
69
|
+
files: MOCK_FILES,
|
|
70
|
+
ignores: MOCK_IGNORES,
|
|
71
|
+
languageOptions: MOCK_LANGUAGE_OPTIONS,
|
|
72
|
+
linterOptions: MOCK_LINTER_OPTIONS,
|
|
73
|
+
rules: {
|
|
74
|
+
...TYPESCRIPT_RULES,
|
|
75
|
+
...MOCK_RULES
|
|
76
|
+
},
|
|
77
|
+
settings: MOCK_SETTINGS
|
|
78
|
+
}])
|
|
79
|
+
)
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
})
|