@1stg/eslint-config 8.0.0 → 8.0.2
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 +13 -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 +25 -0
- package/overrides.js +332 -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,35 @@ 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
|
+
name: '@1stg/angular-ts',
|
|
422
|
+
files: ['**/*.ts'],
|
|
423
|
+
ignores: ['**/*.d.ts'],
|
|
424
|
+
languageOptions: {
|
|
384
425
|
parserOptions: {
|
|
385
|
-
|
|
426
|
+
project,
|
|
386
427
|
},
|
|
387
|
-
}
|
|
388
|
-
: {
|
|
389
|
-
...jsBase,
|
|
390
|
-
...svelteBase,
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
exports.angular = [
|
|
394
|
-
{
|
|
395
|
-
files: '*.ts',
|
|
396
|
-
excludedFiles: '*.d.ts',
|
|
397
|
-
parserOptions: {
|
|
398
|
-
project,
|
|
399
428
|
},
|
|
400
|
-
extends: [
|
|
401
|
-
|
|
402
|
-
'plugin:@angular-eslint/template/process-inline-templates',
|
|
403
|
-
...prettierExtends,
|
|
404
|
-
],
|
|
429
|
+
extends: [angular_.configs.tsRecommended, prettierExtends],
|
|
430
|
+
processor: angular_.processInlineTemplates,
|
|
405
431
|
rules: {
|
|
406
432
|
'@angular-eslint/prefer-on-push-component-change-detection': 1,
|
|
407
433
|
},
|
|
408
434
|
},
|
|
409
435
|
{
|
|
410
|
-
|
|
436
|
+
name: '@1stg/angular-template',
|
|
437
|
+
files: ['**/*.html'],
|
|
411
438
|
extends: [
|
|
412
|
-
|
|
413
|
-
'plugin:markup/recommended',
|
|
414
|
-
|
|
439
|
+
angular_.configs.templateRecommended,
|
|
440
|
+
// 'plugin:markup/recommended',
|
|
441
|
+
prettierExtends,
|
|
415
442
|
],
|
|
416
|
-
|
|
443
|
+
languageOptions: {
|
|
444
|
+
parser: angularTemplateParser,
|
|
445
|
+
},
|
|
417
446
|
rules: {
|
|
418
447
|
'@angular-eslint/template/eqeqeq': [
|
|
419
448
|
2,
|
|
@@ -421,149 +450,187 @@ exports.angular = [
|
|
|
421
450
|
allowNullOrUndefined: true,
|
|
422
451
|
},
|
|
423
452
|
],
|
|
424
|
-
'prettier/prettier': [
|
|
425
|
-
preferPrettier ? 0 : 2,
|
|
426
|
-
{
|
|
427
|
-
parser: 'angular',
|
|
428
|
-
},
|
|
429
|
-
],
|
|
453
|
+
'prettier/prettier': preferPrettier ? 0 : [2, { parser: 'angular' }],
|
|
430
454
|
'spaced-comment': 0,
|
|
431
455
|
},
|
|
432
456
|
},
|
|
433
457
|
{
|
|
434
|
-
files: '
|
|
458
|
+
files: ['**/*inline-template-*.component.html'],
|
|
435
459
|
rules: {
|
|
436
460
|
'unicorn/no-empty-file': 0,
|
|
437
461
|
},
|
|
438
462
|
},
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
/* eslint-disable sonarjs/no-commented-code */
|
|
466
|
+
// export const markup = [
|
|
467
|
+
// {
|
|
468
|
+
// files: '**/*.html',
|
|
469
|
+
// extends: 'plugin:markup/recommended',
|
|
470
|
+
// rules: {
|
|
471
|
+
// 'prettier/prettier': [
|
|
472
|
+
// preferPrettier ? 0 : 2,
|
|
473
|
+
// {
|
|
474
|
+
// parser: 'html',
|
|
475
|
+
// },
|
|
476
|
+
// ],
|
|
477
|
+
// },
|
|
478
|
+
// },
|
|
479
|
+
// {
|
|
480
|
+
// files: '**/*.pug',
|
|
481
|
+
// extends: ['plugin:markup/recommended', ...prettierExtends],
|
|
482
|
+
// },
|
|
483
|
+
// ]
|
|
484
|
+
/* eslint-enable sonarjs/no-commented-code */
|
|
485
|
+
|
|
486
|
+
export const md = tseslint.config(
|
|
442
487
|
{
|
|
443
|
-
|
|
444
|
-
|
|
488
|
+
name: '@1stg/md',
|
|
489
|
+
files: ['**/*.md'],
|
|
490
|
+
extends: [mdx_.configs.flat],
|
|
445
491
|
rules: {
|
|
446
|
-
'prettier/prettier':
|
|
447
|
-
preferPrettier ? 0 : 2,
|
|
448
|
-
{
|
|
449
|
-
parser: 'html',
|
|
450
|
-
},
|
|
451
|
-
],
|
|
492
|
+
'prettier/prettier': preferPrettier ? 0 : 2,
|
|
452
493
|
},
|
|
453
494
|
},
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
extends: ['plugin:markup/recommended', ...prettierExtends],
|
|
457
|
-
},
|
|
458
|
-
]
|
|
495
|
+
mdx_.configs.flatCodeBlocks,
|
|
496
|
+
)
|
|
459
497
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
rules: {
|
|
474
|
-
'prettier/prettier': preferPrettier ? 0 : 2,
|
|
498
|
+
export const mdx = tseslint.config(
|
|
499
|
+
{
|
|
500
|
+
name: '@1stg/mdx',
|
|
501
|
+
files: ['**/*.mdx'],
|
|
502
|
+
extends: [reactJsx, mdx_.configs.flat],
|
|
503
|
+
languageOptions: {
|
|
504
|
+
...jsBase.languageOptions,
|
|
505
|
+
parser: eslintMdx,
|
|
506
|
+
},
|
|
507
|
+
settings: { ...reactJsx[0].settings, ...resolveSettings },
|
|
508
|
+
rules: {
|
|
509
|
+
'prettier/prettier': preferPrettier ? 0 : 2,
|
|
510
|
+
},
|
|
475
511
|
},
|
|
476
|
-
|
|
512
|
+
mdx_.configs.flatCodeBlocks,
|
|
513
|
+
)
|
|
477
514
|
|
|
478
|
-
const nonSourceRules = {
|
|
515
|
+
const nonSourceRules = /** @type {const} */ ({
|
|
479
516
|
'n/no-extraneous-import': 0,
|
|
480
517
|
'n/no-extraneous-require': 0,
|
|
481
518
|
'n/no-unsupported-features/es-builtins': 0,
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
519
|
+
})
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* @type {Linter.Config}
|
|
523
|
+
*/
|
|
524
|
+
export const test = {
|
|
525
|
+
name: '@1stg/test',
|
|
526
|
+
files: ['**/{__test__,test,tests}/**/*'],
|
|
486
527
|
rules: nonSourceRules,
|
|
487
528
|
}
|
|
488
529
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
530
|
+
export const tests = test
|
|
531
|
+
|
|
532
|
+
export const jest = tseslint.config({
|
|
533
|
+
name: '@1stg/jest',
|
|
534
|
+
files: ['**/*.{spec,test}.{js,jsx,ts,tsx}'],
|
|
535
|
+
extends: [jest_.configs['flat/recommended']],
|
|
536
|
+
rules: test.rules,
|
|
537
|
+
})
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* @type {Linter.Config}
|
|
541
|
+
*/
|
|
542
|
+
export const script = {
|
|
543
|
+
name: '@1stg/script',
|
|
544
|
+
files: ['**/scripts/**/*'],
|
|
497
545
|
rules: nonSourceRules,
|
|
498
546
|
}
|
|
499
547
|
|
|
500
|
-
|
|
548
|
+
export const scripts = script
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* @type {Linter.Config}
|
|
552
|
+
*/
|
|
553
|
+
export const story = {
|
|
554
|
+
name: '@1stg/story',
|
|
501
555
|
files: ['**/.storybook/**/*', '**/stories/**/*'],
|
|
502
556
|
rules: nonSourceRules,
|
|
503
557
|
}
|
|
504
558
|
|
|
505
|
-
|
|
506
|
-
|
|
559
|
+
export const stories = story
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* @type {Linter.Config}
|
|
563
|
+
*/
|
|
564
|
+
export const config = {
|
|
565
|
+
name: '@1stg/config',
|
|
566
|
+
files: ['**/.*.js', '**/*.config.{js,ts}'],
|
|
507
567
|
rules: nonSourceRules,
|
|
508
568
|
}
|
|
509
569
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
570
|
+
export const configs = config
|
|
571
|
+
|
|
572
|
+
export const json = tseslint.config({
|
|
573
|
+
name: '@1stg/json',
|
|
574
|
+
files: ['**/.*rc', '**/*.json'],
|
|
575
|
+
ignores: [...nonJsonRcFiles, ...jsoncFiles],
|
|
513
576
|
extends: [
|
|
514
|
-
'
|
|
515
|
-
|
|
516
|
-
'plugin:jsonc/prettier',
|
|
577
|
+
jsonc_.configs['flat/recommended-with-json'],
|
|
578
|
+
jsonc_.configs['flat/prettier'],
|
|
517
579
|
],
|
|
518
|
-
}
|
|
580
|
+
})
|
|
519
581
|
|
|
520
|
-
|
|
582
|
+
export const jsonc = tseslint.config({
|
|
583
|
+
name: '@1stg/jsonc',
|
|
521
584
|
files: jsoncFiles,
|
|
522
|
-
extends: [
|
|
523
|
-
|
|
585
|
+
extends: [
|
|
586
|
+
jsonc_.configs['flat/recommended-with-jsonc'],
|
|
587
|
+
jsonc_.configs['flat/prettier'],
|
|
588
|
+
],
|
|
589
|
+
})
|
|
524
590
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
591
|
+
export const json5 = tseslint.config({
|
|
592
|
+
name: '@1stg/json5',
|
|
593
|
+
files: ['**/*.json5'],
|
|
594
|
+
extends: [
|
|
595
|
+
jsonc_.configs['flat/recommended-with-json5'],
|
|
596
|
+
jsonc_.configs['flat/prettier'],
|
|
597
|
+
],
|
|
598
|
+
})
|
|
529
599
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
600
|
+
export const toml = tseslint.config({
|
|
601
|
+
name: '@1stg/toml',
|
|
602
|
+
files: ['**/*.toml'],
|
|
603
|
+
extends: [toml_.configs['flat/recommended']],
|
|
604
|
+
})
|
|
534
605
|
|
|
535
|
-
|
|
536
|
-
files: ['
|
|
537
|
-
extends: ['
|
|
538
|
-
}
|
|
606
|
+
export const yaml = tseslint.config({
|
|
607
|
+
files: ['**/*.yml', '**/*.yaml'],
|
|
608
|
+
extends: [yml_.configs['flat/recommended'], yml_.configs['flat/prettier']],
|
|
609
|
+
})
|
|
610
|
+
|
|
611
|
+
export const yml = yaml
|
|
539
612
|
|
|
540
613
|
const isReactAvailable = isPkgAvailable('react')
|
|
541
614
|
|
|
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)
|
|
615
|
+
export const overrides = tseslint.config(
|
|
616
|
+
isPkgAvailable('@babel/core') ? js : [],
|
|
617
|
+
isTsAvailable ? ts : [],
|
|
618
|
+
isReactAvailable ? react : [],
|
|
619
|
+
// The order matters, the later should to be preferred
|
|
620
|
+
// markup,
|
|
621
|
+
isPkgAvailable('vue') ? vue : [],
|
|
622
|
+
isPkgAvailable('@angular/core') ? angular : [],
|
|
623
|
+
md,
|
|
624
|
+
mdx,
|
|
625
|
+
isPkgAvailable('jest') ? jest : [],
|
|
626
|
+
test,
|
|
627
|
+
scripts,
|
|
628
|
+
stories,
|
|
629
|
+
configs,
|
|
630
|
+
dTs,
|
|
631
|
+
json,
|
|
632
|
+
jsonc,
|
|
633
|
+
json5,
|
|
634
|
+
toml,
|
|
635
|
+
yaml,
|
|
636
|
+
)
|