@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/overrides.js CHANGED
@@ -1,28 +1,58 @@
1
- const path = require('node:path')
2
-
3
- const { jsoncFiles, nonJsonRcFiles, preferPrettier } = require('@1stg/config')
4
- const { isPkgAvailable, tryFile, tryPkg } = require('@pkgr/utils')
5
-
6
- const { isTsAvailable, magicNumbers, prettierExtends } = require('./_util')
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
- files: ['*.cjs', '*.mjs', '*.js', '*.jsx'],
15
- parser: '@babel/eslint-parser',
16
- parserOptions: configFile
17
- ? {
18
- babelOptions: {
19
- configFile,
20
- },
21
- }
22
- : {
23
- requireConfigFile: false,
24
- },
25
- plugins: ['@babel'],
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
- exports.js = {
73
+ const jsdocConfig = jsdoc.configs['flat/recommended']
74
+
75
+ export const js = tseslint.config({
44
76
  ...jsBase,
45
- extends: ['plugin:jsdoc/recommended'],
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
- typescript: {
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
- files: ['*.cts', '*.mts', '*.ts', '*.tsx'],
89
- parserOptions: {
90
- project,
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
- 'plugin:@typescript-eslint/eslint-recommended',
94
- 'plugin:@typescript-eslint/recommended',
95
- 'plugin:import/typescript',
96
- ...prettierExtends,
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
- '@typescript-eslint/naming-convention': 0, // TODO: find better config
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
- exports.ts = [
238
+ export const ts = tseslint.config(
210
239
  tsBase,
211
240
  {
212
- files: '{bin,cli}.ts',
241
+ name: '@1stg/cli',
242
+ files: ['**/{bin,cli}.ts'],
213
243
  rules: {
214
244
  'n/shebang': 0,
215
245
  },
216
246
  },
217
247
  {
218
- files: '**/*.{md,mdx}/**/*.{cts,mts,ts,tsx}',
219
- parserOptions: {
220
- project: null,
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
- files: '*.{cts,mts,ts,tsx}',
225
- excludedFiles: ['**/*.{md,mdx}/**/*.{cts,mts,ts,tsx}', '*.d.{cts,mts,ts}'],
226
- extends: ['plugin:@typescript-eslint/recommended-requiring-type-checking'],
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
- exports.dTs = {
266
- files: ['*.d.cts', '*.d.mts', '*.d.ts'],
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
- extends: ['standard-react', 'plugin:react/recommended', ...prettierExtends],
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
- exports.react = [
325
+ export const react = tseslint.config(
287
326
  {
288
- files: '*.{js,jsx,tsx}',
327
+ name: '@1stg/react',
328
+ files: ['**/*.{js,jsx,tsx}'],
329
+ extends: [reactJsx],
289
330
  rules: {
290
- 'react/jsx-boolean-value': [2, 'always'],
291
- 'react/jsx-handler-names': [
292
- 2,
293
- {
294
- eventHandlerPrefix: false,
295
- eventHandlerPropPrefix: 'on',
296
- },
297
- ],
298
- 'sonar/function-name': isTsAvailable
299
- ? [2, { format: '^_?[a-zA-Z][a-zA-Z0-9]*\\$?$' }]
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
- files: '*.tsx',
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
- exports.reactHooks = {
313
- files: '*.{js,jsx,ts,tsx}',
314
- plugins: ['react-hooks'],
315
- rules: {
316
- 'react-hooks/rules-of-hooks': 2,
317
- 'react-hooks/exhaustive-deps': 2,
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
- exports.reactTs = {
322
- files: '*.{ts,tsx}',
323
- rules: {
324
- 'no-restricted-imports': [2, 'prop-types'],
325
- 'react/prop-types': 0,
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 = ['plugin:vue/recommended', ...prettierExtends]
370
+ const vueExtends = tseslint.config(
371
+ vue_.configs['flat/recommended'],
372
+ prettierExtends,
373
+ )
330
374
 
331
- exports.vue = [
375
+ export const vue = tseslint.config(
332
376
  {
333
377
  ...jsBase,
334
- files: [...jsBase.files, !isTsAvailable && '*.vue'].filter(Boolean),
335
- parser: 'vue-eslint-parser',
336
- parserOptions: {
337
- ...jsBase.parserOptions,
338
- parser: jsBase.parser,
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
- ...tsBase,
344
- files: [...tsBase.files, '*.vue'],
345
- parser: 'vue-eslint-parser',
346
- parserOptions: {
347
- parser: '@typescript-eslint/parser',
348
- extraFileExtensions: ['.vue'],
349
- },
350
- extends: [...tsBase.extends, ...vueExtends],
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
- files: '*.vue',
406
+ name: '@1stg/vue',
407
+ files: ['**/*.vue'],
354
408
  extends: [
355
- // eslint-disable-next-line sonarjs/no-duplicate-string
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
- ].filter(Boolean)
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
- exports.svelte = isTsAvailable
381
- ? {
382
- ...tsBase,
383
- ...svelteBase,
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
- extraFileExtensions: ['.svelte'],
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
- 'plugin:@angular-eslint/recommended',
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
- files: '*.html',
436
+ name: '@1stg/angular-template',
437
+ files: ['**/*.html'],
411
438
  extends: [
412
- 'plugin:@angular-eslint/template/recommended',
413
- 'plugin:markup/recommended',
414
- ...prettierExtends,
439
+ angular_.configs.templateRecommended,
440
+ // 'plugin:markup/recommended',
441
+ prettierExtends,
415
442
  ],
416
- parser: 'angular-eslint-template-parser',
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: '*inline-template-*.component.html',
458
+ files: ['**/*inline-template-*.component.html'],
435
459
  rules: {
436
460
  'unicorn/no-empty-file': 0,
437
461
  },
438
462
  },
439
- ]
440
-
441
- exports.markup = [
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
- files: '*.html',
444
- extends: 'plugin:markup/recommended',
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
- files: '*.pug',
456
- extends: ['plugin:markup/recommended', ...prettierExtends],
457
- },
458
- ]
495
+ mdx_.configs.flatCodeBlocks,
496
+ )
459
497
 
460
- exports.md = {
461
- files: '*.md',
462
- extends: ['plugin:mdx/recommended'],
463
- rules: {
464
- 'prettier/prettier': preferPrettier ? 0 : 2,
465
- },
466
- }
467
-
468
- exports.mdx = {
469
- files: '*.mdx',
470
- extends: [...reactJsx.extends, 'plugin:mdx/recommended'],
471
- parserOptions: jsBase.parserOptions,
472
- settings: { ...reactJsx.settings, ...resolveSettings },
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
- exports.test = {
485
- files: '**/{__test__,test,tests}/**/*',
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
- exports.jest = {
490
- files: '*.{spec,test}.{js,jsx,ts,tsx}',
491
- extends: ['plugin:jest/recommended'],
492
- rules: exports.test.rules,
493
- }
494
-
495
- exports.script = exports.scripts = {
496
- files: '**/scripts/**/*',
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
- exports.story = exports.stories = {
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
- exports.config = exports.configs = {
506
- files: ['.*.js', '*.config.{js,ts}'],
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
- exports.json = {
511
- files: ['.*rc', '*.json'],
512
- excludedFiles: [...nonJsonRcFiles, ...jsoncFiles],
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
- 'plugin:jsonc/recommended-with-json',
515
- // eslint-disable-next-line sonarjs/no-duplicate-string
516
- 'plugin:jsonc/prettier',
577
+ jsonc_.configs['flat/recommended-with-json'],
578
+ jsonc_.configs['flat/prettier'],
517
579
  ],
518
- }
580
+ })
519
581
 
520
- exports.jsonc = {
582
+ export const jsonc = tseslint.config({
583
+ name: '@1stg/jsonc',
521
584
  files: jsoncFiles,
522
- extends: ['plugin:jsonc/recommended-with-jsonc', 'plugin:jsonc/prettier'],
523
- }
585
+ extends: [
586
+ jsonc_.configs['flat/recommended-with-jsonc'],
587
+ jsonc_.configs['flat/prettier'],
588
+ ],
589
+ })
524
590
 
525
- exports.json5 = {
526
- files: '*.json5',
527
- extends: ['plugin:jsonc/recommended-with-json5', 'plugin:jsonc/prettier'],
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
- exports.toml = {
531
- files: '*.toml',
532
- extends: ['plugin:toml/recommended'],
533
- }
600
+ export const toml = tseslint.config({
601
+ name: '@1stg/toml',
602
+ files: ['**/*.toml'],
603
+ extends: [toml_.configs['flat/recommended']],
604
+ })
534
605
 
535
- exports.yml = exports.yaml = {
536
- files: ['*.yml', '*.yaml'],
537
- extends: ['plugin:yml/recommended', 'plugin:yml/prettier'],
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
- exports.overrides = []
543
- // eslint-disable-next-line unicorn/prefer-spread
544
- .concat(
545
- isPkgAvailable('@babel/core') && exports.js,
546
- isTsAvailable && exports.ts,
547
- isReactAvailable && exports.react,
548
- isReactAvailable && exports.reactHooks,
549
- isReactAvailable && isTsAvailable && exports.reactTs,
550
- // The order matters, the later should to be preferred
551
- exports.markup,
552
- isPkgAvailable('@angular/core') && exports.angular,
553
- isPkgAvailable('vue') && exports.vue,
554
- isPkgAvailable('svelte') && exports.svelte,
555
- exports.md,
556
- exports.mdx,
557
- isPkgAvailable('jest') && exports.jest,
558
- exports.test,
559
- exports.scripts,
560
- exports.stories,
561
- exports.configs,
562
- exports.dTs,
563
- exports.json,
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
+ )