@1stg/eslint-config 8.0.0 → 8.0.1
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/CHANGELOG.md +7 -0
- package/_util.js +25 -14
- package/base.d.ts +3 -0
- package/base.js +160 -109
- package/index.d.ts +1 -0
- package/index.js +1 -6
- package/loose.d.ts +3 -0
- package/loose.js +38 -30
- package/overrides.d.ts +24 -0
- package/overrides.js +330 -265
- package/package.json +43 -38
- package/recommended.d.ts +3 -0
- package/recommended.js +6 -1
package/overrides.js
CHANGED
|
@@ -1,28 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @import {Linter} from 'eslint'
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import path from 'node:path'
|
|
8
|
+
|
|
9
|
+
import { jsoncFiles, nonJsonRcFiles, preferPrettier } from '@1stg/config'
|
|
10
|
+
import babelParser from '@babel/eslint-parser'
|
|
11
|
+
import babel from '@babel/eslint-plugin'
|
|
12
|
+
import react_ from '@eslint-react/eslint-plugin'
|
|
13
|
+
import { isPkgAvailable, tryFile, tryPkg } from '@pkgr/utils'
|
|
14
|
+
import angular_ from 'angular-eslint'
|
|
15
|
+
import angularTemplateParser from 'angular-eslint-template-parser'
|
|
16
|
+
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
|
|
17
|
+
import eslintMdx from 'eslint-mdx'
|
|
18
|
+
import importX from 'eslint-plugin-import-x'
|
|
19
|
+
import jest_ from 'eslint-plugin-jest'
|
|
20
|
+
import jsdoc from 'eslint-plugin-jsdoc'
|
|
21
|
+
import jsonc_ from 'eslint-plugin-jsonc'
|
|
22
|
+
import * as mdx_ from 'eslint-plugin-mdx'
|
|
23
|
+
import * as reactHooks_ from 'eslint-plugin-react-hooks'
|
|
24
|
+
import toml_ from 'eslint-plugin-toml'
|
|
25
|
+
import vue_ from 'eslint-plugin-vue'
|
|
26
|
+
import yml_ from 'eslint-plugin-yml'
|
|
27
|
+
import tseslint from 'typescript-eslint'
|
|
28
|
+
import vueParser from 'vue-eslint-parser'
|
|
29
|
+
|
|
30
|
+
import { isTsAvailable, magicNumbers, prettierExtends } from './_util.js'
|
|
7
31
|
|
|
8
32
|
const configFile =
|
|
9
33
|
tryFile(path.resolve('babel.config.js')) ||
|
|
10
34
|
tryFile(path.resolve('.babelrc.js')) ||
|
|
11
35
|
tryPkg('@1stg/babel-preset/config')
|
|
12
36
|
|
|
37
|
+
/**
|
|
38
|
+
* @satisfies {Linter.Config}
|
|
39
|
+
*/
|
|
13
40
|
const jsBase = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
41
|
+
name: '@1stg/js-base',
|
|
42
|
+
files: ['**/*.cjs', '**/*.mjs', '**/*.js', '**/*.jsx'],
|
|
43
|
+
languageOptions: {
|
|
44
|
+
parser: babelParser,
|
|
45
|
+
parserOptions: configFile
|
|
46
|
+
? {
|
|
47
|
+
babelOptions: {
|
|
48
|
+
configFile,
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
: { requireConfigFile: false },
|
|
52
|
+
},
|
|
53
|
+
plugins: {
|
|
54
|
+
'@babel': babel,
|
|
55
|
+
},
|
|
26
56
|
rules: {
|
|
27
57
|
camelcase: [
|
|
28
58
|
2,
|
|
@@ -40,9 +70,12 @@ const jsBase = {
|
|
|
40
70
|
},
|
|
41
71
|
}
|
|
42
72
|
|
|
43
|
-
|
|
73
|
+
const jsdocConfig = jsdoc.configs['flat/recommended']
|
|
74
|
+
|
|
75
|
+
export const js = tseslint.config({
|
|
44
76
|
...jsBase,
|
|
45
|
-
|
|
77
|
+
name: '@1stg/js',
|
|
78
|
+
extends: [jsdocConfig],
|
|
46
79
|
rules: {
|
|
47
80
|
...jsBase.rules,
|
|
48
81
|
'jsdoc/require-jsdoc': 0,
|
|
@@ -62,7 +95,7 @@ exports.js = {
|
|
|
62
95
|
},
|
|
63
96
|
}
|
|
64
97
|
: undefined,
|
|
65
|
-
}
|
|
98
|
+
})
|
|
66
99
|
|
|
67
100
|
const project =
|
|
68
101
|
tryFile(path.resolve('tsconfig.eslint.json')) ||
|
|
@@ -71,29 +104,32 @@ const project =
|
|
|
71
104
|
tryPkg('@1stg/tsconfig')
|
|
72
105
|
|
|
73
106
|
const resolveSettings = {
|
|
74
|
-
'import/external-module-folders': [
|
|
107
|
+
'import-x/external-module-folders': [
|
|
75
108
|
'node_modules',
|
|
76
109
|
'node_modules/@d-ts',
|
|
77
110
|
'node_modules/@types',
|
|
78
111
|
],
|
|
79
|
-
'import/resolver':
|
|
80
|
-
|
|
112
|
+
'import-x/resolver-next': [
|
|
113
|
+
createTypeScriptImportResolver({
|
|
81
114
|
alwaysTryTypes: true,
|
|
82
115
|
project,
|
|
83
|
-
},
|
|
84
|
-
|
|
116
|
+
}),
|
|
117
|
+
],
|
|
85
118
|
}
|
|
86
119
|
|
|
87
|
-
const tsBase = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
120
|
+
const tsBase = tseslint.config({
|
|
121
|
+
name: '@1stg/ts-base',
|
|
122
|
+
files: ['**/*.cts', '**/*.mts', '**/*.ts', '**/*.tsx'],
|
|
123
|
+
languageOptions: {
|
|
124
|
+
parserOptions: {
|
|
125
|
+
project,
|
|
126
|
+
},
|
|
91
127
|
},
|
|
92
128
|
extends: [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
129
|
+
tseslint.configs.eslintRecommended,
|
|
130
|
+
tseslint.configs.recommended,
|
|
131
|
+
importX.flatConfigs.typescript,
|
|
132
|
+
prettierExtends,
|
|
97
133
|
],
|
|
98
134
|
settings: resolveSettings,
|
|
99
135
|
rules: {
|
|
@@ -105,14 +141,6 @@ const tsBase = {
|
|
|
105
141
|
},
|
|
106
142
|
],
|
|
107
143
|
'@typescript-eslint/ban-ts-comment': 0,
|
|
108
|
-
'@typescript-eslint/ban-types': [
|
|
109
|
-
2,
|
|
110
|
-
{
|
|
111
|
-
types: {
|
|
112
|
-
object: false,
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
144
|
'@typescript-eslint/consistent-type-definitions': [2, 'interface'],
|
|
117
145
|
'@typescript-eslint/explicit-function-return-type': 0,
|
|
118
146
|
'@typescript-eslint/explicit-member-accessibility': [
|
|
@@ -126,7 +154,8 @@ const tsBase = {
|
|
|
126
154
|
],
|
|
127
155
|
'@typescript-eslint/explicit-module-boundary-types': 0,
|
|
128
156
|
'@typescript-eslint/member-ordering': 2,
|
|
129
|
-
|
|
157
|
+
// eslint-disable-line sonarjs/todo-tag -- TODO: find better config
|
|
158
|
+
'@typescript-eslint/naming-convention': 0,
|
|
130
159
|
'@typescript-eslint/no-empty-function': 2,
|
|
131
160
|
'@typescript-eslint/no-extraneous-class': [
|
|
132
161
|
2,
|
|
@@ -174,12 +203,12 @@ const tsBase = {
|
|
|
174
203
|
],
|
|
175
204
|
'@typescript-eslint/unified-signatures': 2,
|
|
176
205
|
camelcase: 0,
|
|
177
|
-
'import/default': 0,
|
|
178
|
-
'import/named': 0,
|
|
179
|
-
'import/namespace': 0,
|
|
180
|
-
'import/no-duplicates': 2,
|
|
181
|
-
'import/no-named-as-default': 0,
|
|
182
|
-
'import/no-named-as-default-member': 0,
|
|
206
|
+
'import-x/default': 0,
|
|
207
|
+
'import-x/named': 0,
|
|
208
|
+
'import-x/namespace': 0,
|
|
209
|
+
'import-x/no-duplicates': 2,
|
|
210
|
+
'import-x/no-named-as-default': 0,
|
|
211
|
+
'import-x/no-named-as-default-member': 0,
|
|
183
212
|
'no-empty-function': 0,
|
|
184
213
|
'no-restricted-syntax': [
|
|
185
214
|
2,
|
|
@@ -204,26 +233,31 @@ const tsBase = {
|
|
|
204
233
|
// covered by @typescript-eslint/no-this-alias
|
|
205
234
|
'unicorn/no-this-assignment': 0,
|
|
206
235
|
},
|
|
207
|
-
}
|
|
236
|
+
})
|
|
208
237
|
|
|
209
|
-
|
|
238
|
+
export const ts = tseslint.config(
|
|
210
239
|
tsBase,
|
|
211
240
|
{
|
|
212
|
-
|
|
241
|
+
name: '@1stg/cli',
|
|
242
|
+
files: ['**/{bin,cli}.ts'],
|
|
213
243
|
rules: {
|
|
214
244
|
'n/shebang': 0,
|
|
215
245
|
},
|
|
216
246
|
},
|
|
217
247
|
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
248
|
+
name: '@1stg/code-block',
|
|
249
|
+
files: ['**/*.{md,mdx}/**/*.{cts,mts,ts,tsx}'],
|
|
250
|
+
languageOptions: {
|
|
251
|
+
parserOptions: {
|
|
252
|
+
project: null,
|
|
253
|
+
},
|
|
221
254
|
},
|
|
222
255
|
},
|
|
223
256
|
{
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
257
|
+
name: '@1stg/ts',
|
|
258
|
+
files: ['**/*.{cts,mts,ts,tsx}'],
|
|
259
|
+
ignores: ['**/*.{md,mdx}/**/*.{cts,mts,ts,tsx}', '*.d.{cts,mts,ts}'],
|
|
260
|
+
extends: [tseslint.configs.recommendedTypeChecked],
|
|
227
261
|
rules: {
|
|
228
262
|
'@typescript-eslint/no-floating-promises': [
|
|
229
263
|
2,
|
|
@@ -260,100 +294,119 @@ exports.ts = [
|
|
|
260
294
|
'no-magic-numbers': 0,
|
|
261
295
|
},
|
|
262
296
|
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @type {Linter.Config}
|
|
301
|
+
*/
|
|
302
|
+
export const dTs = {
|
|
303
|
+
name: '@1stg/d-ts',
|
|
304
|
+
files: ['**/*.d.cts', '**/*.d.mts', '**/*.d.ts'],
|
|
267
305
|
rules: {
|
|
268
306
|
'@typescript-eslint/no-explicit-any': 0,
|
|
269
307
|
'@typescript-eslint/no-extraneous-class': 0,
|
|
270
308
|
'@typescript-eslint/no-namespace': 0,
|
|
271
309
|
'@typescript-eslint/no-unused-vars': 0,
|
|
272
|
-
'import/no-duplicates': 0,
|
|
273
|
-
'import/order': 0,
|
|
310
|
+
'import-x/no-duplicates': 0,
|
|
311
|
+
'import-x/order': 0,
|
|
274
312
|
},
|
|
275
313
|
}
|
|
276
314
|
|
|
277
|
-
const reactJsx = {
|
|
278
|
-
|
|
315
|
+
const reactJsx = tseslint.config({
|
|
316
|
+
name: '@1stg/react-jsx',
|
|
317
|
+
extends: [react_.configs.recommended, prettierExtends],
|
|
279
318
|
settings: {
|
|
280
319
|
react: {
|
|
281
320
|
version: 'detect',
|
|
282
321
|
},
|
|
283
322
|
},
|
|
284
|
-
}
|
|
323
|
+
})
|
|
285
324
|
|
|
286
|
-
|
|
325
|
+
export const react = tseslint.config(
|
|
287
326
|
{
|
|
288
|
-
|
|
327
|
+
name: '@1stg/react',
|
|
328
|
+
files: ['**/*.{js,jsx,tsx}'],
|
|
329
|
+
extends: [reactJsx],
|
|
289
330
|
rules: {
|
|
290
|
-
'react/
|
|
291
|
-
'react/
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
],
|
|
298
|
-
'
|
|
299
|
-
? [2, { format:
|
|
331
|
+
'@eslint-react/avoid-shorthand-boolean': 2,
|
|
332
|
+
// '@eslint-react/naming-convention/handler-prop': [
|
|
333
|
+
// 2,
|
|
334
|
+
// {
|
|
335
|
+
// eventHandlerPrefix: false,
|
|
336
|
+
// eventHandlerPropPrefix: 'on',
|
|
337
|
+
// },
|
|
338
|
+
// ],
|
|
339
|
+
'sonarjs/function-name': isTsAvailable
|
|
340
|
+
? [2, { format: String.raw`^_?[a-zA-Z][a-zA-Z0-9]*\$?$` }]
|
|
300
341
|
: 0,
|
|
301
342
|
},
|
|
302
|
-
...reactJsx,
|
|
303
343
|
},
|
|
304
344
|
{
|
|
305
|
-
|
|
345
|
+
name: '@1stg/react-tsx',
|
|
346
|
+
files: ['**/*.tsx'],
|
|
306
347
|
rules: {
|
|
307
|
-
'react/display-name': 0,
|
|
348
|
+
'@eslint-react/display-name': 0,
|
|
308
349
|
},
|
|
309
350
|
},
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
351
|
+
{
|
|
352
|
+
name: '@1stg/react-hooks',
|
|
353
|
+
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
354
|
+
plugins: { 'react-hooks': reactHooks_ },
|
|
355
|
+
rules: {
|
|
356
|
+
'react-hooks/rules-of-hooks': 2,
|
|
357
|
+
'react-hooks/exhaustive-deps': 2,
|
|
358
|
+
},
|
|
318
359
|
},
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
360
|
+
{
|
|
361
|
+
name: '@1stg/react-ts',
|
|
362
|
+
files: ['**/*.{ts,tsx}'],
|
|
363
|
+
rules: {
|
|
364
|
+
'no-restricted-imports': [2, 'prop-types'],
|
|
365
|
+
'@eslint-react/prop-types': 0,
|
|
366
|
+
},
|
|
326
367
|
},
|
|
327
|
-
|
|
368
|
+
)
|
|
328
369
|
|
|
329
|
-
const vueExtends =
|
|
370
|
+
const vueExtends = tseslint.config(
|
|
371
|
+
vue_.configs['flat/recommended'],
|
|
372
|
+
prettierExtends,
|
|
373
|
+
)
|
|
330
374
|
|
|
331
|
-
|
|
375
|
+
export const vue = tseslint.config(
|
|
332
376
|
{
|
|
333
377
|
...jsBase,
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
378
|
+
name: '@1stg/js-vue',
|
|
379
|
+
files: /** @type {string[]} */ (
|
|
380
|
+
[...jsBase.files, !isTsAvailable && '**/*.vue'].filter(Boolean)
|
|
381
|
+
),
|
|
382
|
+
languageOptions: {
|
|
383
|
+
parser: vueParser,
|
|
384
|
+
parserOptions: {
|
|
385
|
+
parser: babelParser,
|
|
386
|
+
...jsBase.languageOptions.parserOptions,
|
|
387
|
+
},
|
|
339
388
|
},
|
|
340
389
|
extends: vueExtends,
|
|
341
390
|
},
|
|
342
|
-
isTsAvailable
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
391
|
+
isTsAvailable
|
|
392
|
+
? {
|
|
393
|
+
name: '@1stg/ts-vue',
|
|
394
|
+
extends: [...tsBase, ...vueExtends],
|
|
395
|
+
files: [.../** @type {string[]} */ (tsBase[0].files), '**/*.vue'],
|
|
396
|
+
languageOptions: {
|
|
397
|
+
parser: vueParser,
|
|
398
|
+
parserOptions: {
|
|
399
|
+
parser: tseslint.parser,
|
|
400
|
+
extraFileExtensions: ['.vue'],
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
}
|
|
404
|
+
: [],
|
|
352
405
|
{
|
|
353
|
-
|
|
406
|
+
name: '@1stg/vue',
|
|
407
|
+
files: ['**/*.vue'],
|
|
354
408
|
extends: [
|
|
355
|
-
//
|
|
356
|
-
'plugin:markup/recommended',
|
|
409
|
+
// 'plugin:markup/recommended',
|
|
357
410
|
...vueExtends,
|
|
358
411
|
],
|
|
359
412
|
rules: {
|
|
@@ -361,59 +414,33 @@ exports.vue = [
|
|
|
361
414
|
'@typescript-eslint/no-unused-vars': 0,
|
|
362
415
|
},
|
|
363
416
|
},
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const svelteBase = {
|
|
367
|
-
files: '*.svelte',
|
|
368
|
-
extends: [
|
|
369
|
-
'plugin:markup/recommended',
|
|
370
|
-
'plugin:svelte/recommended',
|
|
371
|
-
'plugin:svelte/prettier',
|
|
372
|
-
...prettierExtends,
|
|
373
|
-
],
|
|
374
|
-
rules: {
|
|
375
|
-
'sonar/label-position': 0,
|
|
376
|
-
'sonar/no-labels': 0,
|
|
377
|
-
},
|
|
378
|
-
}
|
|
417
|
+
)
|
|
379
418
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
419
|
+
export const angular = tseslint.config(
|
|
420
|
+
{
|
|
421
|
+
files: ['**/*.ts'],
|
|
422
|
+
ignores: ['**/*.d.ts'],
|
|
423
|
+
languageOptions: {
|
|
384
424
|
parserOptions: {
|
|
385
|
-
|
|
425
|
+
project,
|
|
386
426
|
},
|
|
387
|
-
}
|
|
388
|
-
: {
|
|
389
|
-
...jsBase,
|
|
390
|
-
...svelteBase,
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
exports.angular = [
|
|
394
|
-
{
|
|
395
|
-
files: '*.ts',
|
|
396
|
-
excludedFiles: '*.d.ts',
|
|
397
|
-
parserOptions: {
|
|
398
|
-
project,
|
|
399
427
|
},
|
|
400
|
-
extends: [
|
|
401
|
-
|
|
402
|
-
'plugin:@angular-eslint/template/process-inline-templates',
|
|
403
|
-
...prettierExtends,
|
|
404
|
-
],
|
|
428
|
+
extends: [angular_.configs.tsRecommended, prettierExtends],
|
|
429
|
+
processor: angular_.processInlineTemplates,
|
|
405
430
|
rules: {
|
|
406
431
|
'@angular-eslint/prefer-on-push-component-change-detection': 1,
|
|
407
432
|
},
|
|
408
433
|
},
|
|
409
434
|
{
|
|
410
|
-
files: '
|
|
435
|
+
files: ['**/*.html'],
|
|
411
436
|
extends: [
|
|
412
|
-
|
|
413
|
-
'plugin:markup/recommended',
|
|
414
|
-
|
|
437
|
+
angular_.configs.templateRecommended,
|
|
438
|
+
// 'plugin:markup/recommended',
|
|
439
|
+
prettierExtends,
|
|
415
440
|
],
|
|
416
|
-
|
|
441
|
+
languageOptions: {
|
|
442
|
+
parser: angularTemplateParser,
|
|
443
|
+
},
|
|
417
444
|
rules: {
|
|
418
445
|
'@angular-eslint/template/eqeqeq': [
|
|
419
446
|
2,
|
|
@@ -421,149 +448,187 @@ exports.angular = [
|
|
|
421
448
|
allowNullOrUndefined: true,
|
|
422
449
|
},
|
|
423
450
|
],
|
|
424
|
-
'prettier/prettier': [
|
|
425
|
-
preferPrettier ? 0 : 2,
|
|
426
|
-
{
|
|
427
|
-
parser: 'angular',
|
|
428
|
-
},
|
|
429
|
-
],
|
|
451
|
+
'prettier/prettier': preferPrettier ? 0 : [2, { parser: 'angular' }],
|
|
430
452
|
'spaced-comment': 0,
|
|
431
453
|
},
|
|
432
454
|
},
|
|
433
455
|
{
|
|
434
|
-
files: '
|
|
456
|
+
files: ['**/*inline-template-*.component.html'],
|
|
435
457
|
rules: {
|
|
436
458
|
'unicorn/no-empty-file': 0,
|
|
437
459
|
},
|
|
438
460
|
},
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
461
|
+
)
|
|
462
|
+
|
|
463
|
+
/* eslint-disable sonarjs/no-commented-code */
|
|
464
|
+
// export const markup = [
|
|
465
|
+
// {
|
|
466
|
+
// files: '**/*.html',
|
|
467
|
+
// extends: 'plugin:markup/recommended',
|
|
468
|
+
// rules: {
|
|
469
|
+
// 'prettier/prettier': [
|
|
470
|
+
// preferPrettier ? 0 : 2,
|
|
471
|
+
// {
|
|
472
|
+
// parser: 'html',
|
|
473
|
+
// },
|
|
474
|
+
// ],
|
|
475
|
+
// },
|
|
476
|
+
// },
|
|
477
|
+
// {
|
|
478
|
+
// files: '**/*.pug',
|
|
479
|
+
// extends: ['plugin:markup/recommended', ...prettierExtends],
|
|
480
|
+
// },
|
|
481
|
+
// ]
|
|
482
|
+
/* eslint-enable sonarjs/no-commented-code */
|
|
483
|
+
|
|
484
|
+
export const md = tseslint.config(
|
|
442
485
|
{
|
|
443
|
-
|
|
444
|
-
|
|
486
|
+
name: '@1stg/md',
|
|
487
|
+
files: ['**/*.md'],
|
|
488
|
+
extends: [mdx_.configs.flat],
|
|
445
489
|
rules: {
|
|
446
|
-
'prettier/prettier':
|
|
447
|
-
preferPrettier ? 0 : 2,
|
|
448
|
-
{
|
|
449
|
-
parser: 'html',
|
|
450
|
-
},
|
|
451
|
-
],
|
|
490
|
+
'prettier/prettier': preferPrettier ? 0 : 2,
|
|
452
491
|
},
|
|
453
492
|
},
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
extends: ['plugin:markup/recommended', ...prettierExtends],
|
|
457
|
-
},
|
|
458
|
-
]
|
|
493
|
+
mdx_.configs.flatCodeBlocks,
|
|
494
|
+
)
|
|
459
495
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
rules: {
|
|
474
|
-
'prettier/prettier': preferPrettier ? 0 : 2,
|
|
496
|
+
export const mdx = tseslint.config(
|
|
497
|
+
{
|
|
498
|
+
name: '@1stg/mdx',
|
|
499
|
+
files: ['**/*.mdx'],
|
|
500
|
+
extends: [reactJsx, mdx_.configs.flat],
|
|
501
|
+
languageOptions: {
|
|
502
|
+
...jsBase.languageOptions,
|
|
503
|
+
parser: eslintMdx,
|
|
504
|
+
},
|
|
505
|
+
settings: { ...reactJsx[0].settings, ...resolveSettings },
|
|
506
|
+
rules: {
|
|
507
|
+
'prettier/prettier': preferPrettier ? 0 : 2,
|
|
508
|
+
},
|
|
475
509
|
},
|
|
476
|
-
|
|
510
|
+
mdx_.configs.flatCodeBlocks,
|
|
511
|
+
)
|
|
477
512
|
|
|
478
|
-
const nonSourceRules = {
|
|
513
|
+
const nonSourceRules = /** @type {const} */ ({
|
|
479
514
|
'n/no-extraneous-import': 0,
|
|
480
515
|
'n/no-extraneous-require': 0,
|
|
481
516
|
'n/no-unsupported-features/es-builtins': 0,
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
517
|
+
})
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* @type {Linter.Config}
|
|
521
|
+
*/
|
|
522
|
+
export const test = {
|
|
523
|
+
name: '@1stg/test',
|
|
524
|
+
files: ['**/{__test__,test,tests}/**/*'],
|
|
486
525
|
rules: nonSourceRules,
|
|
487
526
|
}
|
|
488
527
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
528
|
+
export const tests = test
|
|
529
|
+
|
|
530
|
+
export const jest = tseslint.config({
|
|
531
|
+
name: '@1stg/jest',
|
|
532
|
+
files: ['**/*.{spec,test}.{js,jsx,ts,tsx}'],
|
|
533
|
+
extends: [jest_.configs['flat/recommended']],
|
|
534
|
+
rules: test.rules,
|
|
535
|
+
})
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* @type {Linter.Config}
|
|
539
|
+
*/
|
|
540
|
+
export const script = {
|
|
541
|
+
name: '@1stg/script',
|
|
542
|
+
files: ['**/scripts/**/*'],
|
|
497
543
|
rules: nonSourceRules,
|
|
498
544
|
}
|
|
499
545
|
|
|
500
|
-
|
|
546
|
+
export const scripts = script
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* @type {Linter.Config}
|
|
550
|
+
*/
|
|
551
|
+
export const story = {
|
|
552
|
+
name: '@1stg/story',
|
|
501
553
|
files: ['**/.storybook/**/*', '**/stories/**/*'],
|
|
502
554
|
rules: nonSourceRules,
|
|
503
555
|
}
|
|
504
556
|
|
|
505
|
-
|
|
506
|
-
|
|
557
|
+
export const stories = story
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* @type {Linter.Config}
|
|
561
|
+
*/
|
|
562
|
+
export const config = {
|
|
563
|
+
name: '@1stg/config',
|
|
564
|
+
files: ['**/.*.js', '**/*.config.{js,ts}'],
|
|
507
565
|
rules: nonSourceRules,
|
|
508
566
|
}
|
|
509
567
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
568
|
+
export const configs = config
|
|
569
|
+
|
|
570
|
+
export const json = tseslint.config({
|
|
571
|
+
name: '@1stg/json',
|
|
572
|
+
files: ['**/.*rc', '**/*.json'],
|
|
573
|
+
ignores: [...nonJsonRcFiles, ...jsoncFiles],
|
|
513
574
|
extends: [
|
|
514
|
-
'
|
|
515
|
-
|
|
516
|
-
'plugin:jsonc/prettier',
|
|
575
|
+
jsonc_.configs['flat/recommended-with-json'],
|
|
576
|
+
jsonc_.configs['flat/prettier'],
|
|
517
577
|
],
|
|
518
|
-
}
|
|
578
|
+
})
|
|
519
579
|
|
|
520
|
-
|
|
580
|
+
export const jsonc = tseslint.config({
|
|
581
|
+
name: '@1stg/jsonc',
|
|
521
582
|
files: jsoncFiles,
|
|
522
|
-
extends: [
|
|
523
|
-
|
|
583
|
+
extends: [
|
|
584
|
+
jsonc_.configs['flat/recommended-with-jsonc'],
|
|
585
|
+
jsonc_.configs['flat/prettier'],
|
|
586
|
+
],
|
|
587
|
+
})
|
|
524
588
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
589
|
+
export const json5 = tseslint.config({
|
|
590
|
+
name: '@1stg/json5',
|
|
591
|
+
files: ['**/*.json5'],
|
|
592
|
+
extends: [
|
|
593
|
+
jsonc_.configs['flat/recommended-with-json5'],
|
|
594
|
+
jsonc_.configs['flat/prettier'],
|
|
595
|
+
],
|
|
596
|
+
})
|
|
529
597
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
598
|
+
export const toml = tseslint.config({
|
|
599
|
+
name: '@1stg/toml',
|
|
600
|
+
files: ['**/*.toml'],
|
|
601
|
+
extends: [toml_.configs['flat/recommended']],
|
|
602
|
+
})
|
|
534
603
|
|
|
535
|
-
|
|
536
|
-
files: ['
|
|
537
|
-
extends: ['
|
|
538
|
-
}
|
|
604
|
+
export const yaml = tseslint.config({
|
|
605
|
+
files: ['**/*.yml', '**/*.yaml'],
|
|
606
|
+
extends: [yml_.configs['flat/recommended'], yml_.configs['flat/prettier']],
|
|
607
|
+
})
|
|
608
|
+
|
|
609
|
+
export const yml = yaml
|
|
539
610
|
|
|
540
611
|
const isReactAvailable = isPkgAvailable('react')
|
|
541
612
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
exports.jsonc,
|
|
565
|
-
exports.json5,
|
|
566
|
-
exports.toml,
|
|
567
|
-
exports.yaml,
|
|
568
|
-
)
|
|
569
|
-
.filter(Boolean)
|
|
613
|
+
export const overrides = tseslint.config(
|
|
614
|
+
isPkgAvailable('@babel/core') ? js : [],
|
|
615
|
+
isTsAvailable ? ts : [],
|
|
616
|
+
isReactAvailable ? react : [],
|
|
617
|
+
// The order matters, the later should to be preferred
|
|
618
|
+
// markup,
|
|
619
|
+
isPkgAvailable('vue') ? vue : [],
|
|
620
|
+
isPkgAvailable('@angular/core') ? angular : [],
|
|
621
|
+
md,
|
|
622
|
+
mdx,
|
|
623
|
+
isPkgAvailable('jest') ? jest : [],
|
|
624
|
+
test,
|
|
625
|
+
scripts,
|
|
626
|
+
stories,
|
|
627
|
+
configs,
|
|
628
|
+
dTs,
|
|
629
|
+
json,
|
|
630
|
+
jsonc,
|
|
631
|
+
json5,
|
|
632
|
+
toml,
|
|
633
|
+
yaml,
|
|
634
|
+
)
|