@ntnyq/eslint-config 4.0.0-beta.3 → 4.0.0-beta.5

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.
Files changed (4) hide show
  1. package/README.md +5 -7
  2. package/dist/index.d.ts +15033 -13897
  3. package/dist/index.js +1182 -994
  4. package/package.json +23 -18
package/dist/index.js CHANGED
@@ -4,13 +4,15 @@ import { FlatConfigComposer } from "eslint-flat-config-utils";
4
4
  // src/configs/vue.ts
5
5
  import { mergeProcessors as mergeProcessors2 } from "eslint-merge-processors";
6
6
 
7
+ // src/eslint/configs.ts
8
+ import { configs } from "typescript-eslint";
9
+
7
10
  // src/eslint/parsers.ts
8
- import tseslint from "typescript-eslint";
9
11
  import * as parserVue from "vue-eslint-parser";
10
12
  import * as parserToml from "toml-eslint-parser";
11
13
  import * as parserYaml from "yaml-eslint-parser";
12
14
  import * as parserJsonc from "jsonc-eslint-parser";
13
- var parserTypeScript = tseslint.parser;
15
+ import { parser } from "typescript-eslint";
14
16
  var parserPlain = {
15
17
  meta: {
16
18
  name: "plain-eslint-parser"
@@ -33,33 +35,31 @@ var parserPlain = {
33
35
  };
34
36
 
35
37
  // src/eslint/plugins.ts
36
- import * as pluginRegexp from "eslint-plugin-regexp";
37
38
  import * as pluginDepend from "eslint-plugin-depend";
39
+ import * as pluginRegexp from "eslint-plugin-regexp";
38
40
  import { default as default2 } from "eslint-plugin-n";
39
41
  import { default as default3 } from "eslint-plugin-vue";
40
42
  import { default as default4 } from "eslint-plugin-yml";
41
43
  import { default as default5 } from "eslint-plugin-svgo";
42
44
  import { default as default6 } from "eslint-plugin-toml";
43
- import { default as default7 } from "eslint-plugin-pinia";
44
- import { default as default8 } from "@eslint/markdown";
45
- import { default as default9 } from "eslint-plugin-antfu";
46
- import { default as default10 } from "eslint-plugin-jsdoc";
47
- import { default as default11 } from "eslint-plugin-jsonc";
48
- import { plugin } from "typescript-eslint";
45
+ import { default as default7 } from "@eslint/markdown";
46
+ import { default as default8 } from "eslint-plugin-antfu";
47
+ import { default as default9 } from "eslint-plugin-jsdoc";
48
+ import { default as default10 } from "eslint-plugin-jsonc";
49
+ import { default as default11 } from "eslint-plugin-pinia";
49
50
  import { default as default12 } from "eslint-plugin-format";
51
+ import { plugin } from "typescript-eslint";
50
52
  import { default as default13 } from "@unocss/eslint-plugin";
51
53
  import { default as default14 } from "@vitest/eslint-plugin";
52
54
  import { default as default15 } from "eslint-plugin-unicorn";
53
55
  import { default as default16 } from "eslint-plugin-import-x";
54
56
  import { default as default17 } from "eslint-plugin-prettier";
55
- import { default as default18 } from "eslint-plugin-no-only-tests";
56
- import { default as default19 } from "eslint-plugin-github-action";
57
- import { default as default20 } from "eslint-plugin-perfectionist";
58
- import { default as default21 } from "eslint-plugin-unused-imports";
59
- import { default as default22 } from "@eslint-community/eslint-plugin-eslint-comments";
60
-
61
- // src/eslint/configs.ts
62
- import { configs } from "typescript-eslint";
57
+ import { default as default18 } from "eslint-plugin-de-morgan";
58
+ import { default as default19 } from "eslint-plugin-no-only-tests";
59
+ import { default as default20 } from "eslint-plugin-github-action";
60
+ import { default as default21 } from "eslint-plugin-perfectionist";
61
+ import { default as default22 } from "eslint-plugin-unused-imports";
62
+ import { default as default23 } from "@eslint-community/eslint-plugin-eslint-comments";
63
63
 
64
64
  // src/eslint/resolvers.ts
65
65
  import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
@@ -68,22 +68,29 @@ var createNodeResolver = default16.createNodeResolver;
68
68
  // src/eslint/processors.ts
69
69
  import { mergeProcessors } from "eslint-merge-processors";
70
70
  import { processorPassThrough } from "eslint-merge-processors";
71
- import { default as default23 } from "eslint-processor-vue-blocks";
71
+ import { default as default24 } from "eslint-processor-vue-blocks";
72
72
 
73
73
  // src/globs.ts
74
74
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
75
75
  var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
76
76
  var GLOB_JS = "**/*.?([cm])js";
77
77
  var GLOB_JSX = `${GLOB_JS}x`;
78
+ var GLOB_JSX_ONLY = "**/*.jsx";
78
79
  var GLOB_TS = "**/*.?([cm])ts";
79
80
  var GLOB_TSX = `${GLOB_TS}x`;
81
+ var GLOB_TSX_ONLY = "**/*.tsx";
80
82
  var GLOB_DTS = "**/*.d.?([cm])ts";
81
83
  var GLOB_TYPES = [GLOB_DTS, `**/types/${GLOB_TS}`, `**/types.ts`];
84
+ var GLOB_TYPE_TEST = [
85
+ `**/*.test-d.${GLOB_SRC_EXT}`,
86
+ `**/*.spec-d.${GLOB_SRC_EXT}`
87
+ ];
82
88
  var GLOB_TEST = [
83
89
  `**/*.test.${GLOB_SRC_EXT}`,
84
90
  `**/*.spec.${GLOB_SRC_EXT}`,
85
91
  `**/*.bench.${GLOB_SRC_EXT}`,
86
- `**/*.benchmark.${GLOB_SRC_EXT}`
92
+ `**/*.benchmark.${GLOB_SRC_EXT}`,
93
+ ...GLOB_TYPE_TEST
87
94
  ];
88
95
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
89
96
  var GLOB_CSS = "**/*.css";
@@ -94,6 +101,7 @@ var GLOB_JSON = "**/*.json";
94
101
  var GLOB_JSON5 = "**/*.json5";
95
102
  var GLOB_JSONC = "**/*.jsonc";
96
103
  var GLOB_PACKAGE_JSON = "**/package.json";
104
+ var GLOB_TSCONFIG_JSON = ["**/tsconfig.json", "**/tsconfig.*.json"];
97
105
  var GLOB_SVG = "**/*.svg";
98
106
  var GLOB_VUE = "**/*.vue";
99
107
  var GLOB_YAML = "**/*.y?(a)ml";
@@ -184,58 +192,45 @@ var sharedRules = {
184
192
  ...default3.configs["vue3-recommended"].rules
185
193
  };
186
194
  var disabledRules = {
187
- "vue/no-v-html": "off",
188
- "vue/require-prop-types": "off",
189
- "vue/require-default-prop": "off",
190
195
  "vue/multi-word-component-names": "off",
196
+ "vue/no-setup-props-reactivity-loss": "off",
197
+ "vue/no-v-html": "off",
191
198
  "vue/no-v-text-v-html-on-component": "off",
192
- "vue/no-setup-props-reactivity-loss": "off"
199
+ "vue/require-default-prop": "off",
200
+ "vue/require-prop-types": "off"
193
201
  };
194
202
  var extensionRules = {
195
- "vue/prefer-template": "error",
196
- "vue/no-sparse-arrays": "error",
197
- "vue/no-empty-pattern": "error",
198
- "vue/space-infix-ops": "error",
199
- "vue/no-loss-of-precision": "error",
200
- "vue/no-constant-condition": "error",
201
- "vue/template-curly-spacing": "error",
202
- "vue/eqeqeq": ["error", "smart"],
203
- "vue/comma-style": ["error", "last"],
204
- "vue/block-spacing": ["error", "always"],
205
- "vue/dot-location": ["error", "property"],
206
- "vue/space-in-parens": ["error", "never"],
207
- "vue/operator-linebreak": ["error", "before"],
208
- "vue/no-extra-parens": ["error", "functions"],
209
203
  "vue/array-bracket-spacing": ["error", "never"],
210
- "vue/object-curly-spacing": ["error", "always"],
211
- "vue/comma-dangle": ["error", "always-multiline"],
212
- "vue/quote-props": ["error", "consistent-as-needed"],
213
- "vue/arrow-spacing": ["error", { before: true, after: true }],
204
+ "vue/arrow-spacing": ["error", { after: true, before: true }],
205
+ "vue/block-spacing": ["error", "always"],
214
206
  "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
215
- "vue/comma-spacing": ["error", { before: false, after: true }],
207
+ "vue/comma-dangle": ["error", "always-multiline"],
208
+ "vue/comma-spacing": ["error", { after: true, before: false }],
209
+ "vue/comma-style": ["error", "last"],
210
+ "vue/dot-location": ["error", "property"],
216
211
  "vue/dot-notation": ["error", { allowKeywords: true }],
217
- "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
218
- "vue/keyword-spacing": ["error", { before: true, after: true }],
212
+ "vue/eqeqeq": ["error", "smart"],
213
+ "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
214
+ "vue/keyword-spacing": ["error", { after: true, before: true }],
215
+ "vue/no-constant-condition": "error",
216
+ "vue/no-empty-pattern": "error",
217
+ "vue/no-extra-parens": ["error", "functions"],
218
+ "vue/no-loss-of-precision": "error",
219
219
  "vue/no-restricted-syntax": [
220
220
  "error",
221
221
  "DebuggerStatement",
222
222
  "LabeledStatement",
223
223
  "WithStatement"
224
224
  ],
225
- "vue/space-unary-ops": [
226
- "error",
227
- {
228
- words: true,
229
- nonwords: false
230
- }
231
- ],
225
+ "vue/no-sparse-arrays": "error",
232
226
  "vue/object-curly-newline": [
233
227
  "error",
234
228
  {
235
- multiline: true,
236
- consistent: true
229
+ consistent: true,
230
+ multiline: true
237
231
  }
238
232
  ],
233
+ "vue/object-curly-spacing": ["error", "always"],
239
234
  "vue/object-property-newline": [
240
235
  "error",
241
236
  {
@@ -246,139 +241,152 @@ var extensionRules = {
246
241
  "error",
247
242
  "always",
248
243
  {
249
- ignoreConstructors: false,
250
- avoidQuotes: true
244
+ avoidQuotes: true,
245
+ ignoreConstructors: false
251
246
  }
252
- ]
247
+ ],
248
+ "vue/operator-linebreak": ["error", "before"],
249
+ "vue/prefer-template": "error",
250
+ "vue/quote-props": ["error", "consistent-as-needed"],
251
+ "vue/space-in-parens": ["error", "never"],
252
+ "vue/space-infix-ops": "error",
253
+ "vue/space-unary-ops": [
254
+ "error",
255
+ {
256
+ nonwords: false,
257
+ words: true
258
+ }
259
+ ],
260
+ "vue/template-curly-spacing": "error"
253
261
  };
254
262
  var unCategorizedRules = {
255
- "vue/no-v-text": "error",
256
- "vue/no-useless-v-bind": "error",
257
- "vue/valid-define-options": "error",
258
- "vue/prefer-define-options": "error",
259
- "vue/prefer-use-template-ref": "error",
260
- "vue/no-irregular-whitespace": "error",
261
- "vue/no-use-v-else-with-v-for": "error",
262
- "vue/no-deprecated-delete-set": "error",
263
- "vue/no-empty-component-block": "error",
264
- "vue/require-typed-object-prop": "error",
265
- "vue/no-unused-emit-declarations": "error",
266
- "vue/padding-line-between-blocks": "error",
267
- "vue/no-multiple-objects-in-class": "error",
268
- "vue/prefer-separate-static-class": "error",
269
- "vue/no-ref-object-reactivity-loss": "error",
270
- "vue/prefer-prop-type-boolean-first": "error",
271
- "vue/html-comment-indent": ["error", 2],
272
- "vue/next-tick-style": ["error", "promise"],
273
- "vue/v-for-delimiter-style": ["error", "in"],
274
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
275
- "vue/slot-name-casing": ["error", "kebab-case"],
276
- "vue/custom-event-name-casing": ["error", "camelCase"],
277
- "vue/define-props-declaration": ["error", "type-based"],
278
- "vue/define-emits-declaration": ["error", "type-literal"],
279
- "vue/prefer-true-attribute-shorthand": ["error", "always"],
280
- "vue/component-options-name-casing": ["error", "PascalCase"],
281
- "vue/component-api-style": ["error", ["script-setup", "composition"]],
282
- "vue/html-button-has-type": [
263
+ "vue/block-order": [
283
264
  "error",
284
265
  {
285
- button: true,
286
- submit: true,
287
- reset: true
266
+ order: ["script", "template", "style"]
288
267
  }
289
268
  ],
290
- "vue/no-duplicate-attr-inheritance": [
269
+ "vue/block-tag-newline": [
291
270
  "error",
292
271
  {
293
- checkMultiRootNodes: true
272
+ multiline: "always",
273
+ singleline: "always"
294
274
  }
295
275
  ],
296
- "vue/block-order": [
276
+ "vue/component-api-style": ["error", ["script-setup", "composition"]],
277
+ "vue/component-name-in-template-casing": [
297
278
  "error",
279
+ "PascalCase",
298
280
  {
299
- order: ["script", "template", "style"]
281
+ ignores: ["slot", "component"],
282
+ // Force auto-import components to be PascalCase
283
+ registeredComponentsOnly: false
300
284
  }
301
285
  ],
302
- "vue/enforce-style-attribute": [
286
+ "vue/component-options-name-casing": ["error", "PascalCase"],
287
+ "vue/custom-event-name-casing": ["error", "camelCase"],
288
+ "vue/define-emits-declaration": ["error", "type-literal"],
289
+ "vue/define-macros-order": [
303
290
  "error",
304
291
  {
305
- allow: ["scoped", "plain"]
292
+ defineExposeLast: true,
293
+ order: [
294
+ "defineProps",
295
+ "defineEmits",
296
+ "defineOptions",
297
+ "defineSlots",
298
+ "defineModel"
299
+ ]
306
300
  }
307
301
  ],
308
- "vue/block-tag-newline": [
302
+ "vue/define-props-declaration": ["error", "type-based"],
303
+ "vue/enforce-style-attribute": [
309
304
  "error",
310
305
  {
311
- singleline: "always",
312
- multiline: "always"
306
+ allow: ["scoped", "plain"]
313
307
  }
314
308
  ],
315
- "vue/no-required-prop-with-default": [
309
+ "vue/html-button-has-type": [
316
310
  "error",
317
311
  {
318
- autofix: true
312
+ button: true,
313
+ reset: true,
314
+ submit: true
319
315
  }
320
316
  ],
321
317
  "vue/html-comment-content-newline": [
322
318
  "error",
323
319
  {
324
- singleline: "ignore",
325
- multiline: "always"
320
+ multiline: "always",
321
+ singleline: "ignore"
326
322
  },
327
323
  {
328
324
  exceptions: ["*"]
329
325
  }
330
326
  ],
331
- "vue/no-static-inline-styles": [
327
+ "vue/html-comment-content-spacing": [
332
328
  "error",
329
+ "always",
333
330
  {
334
- allowBinding: true
331
+ exceptions: ["-"]
335
332
  }
336
333
  ],
334
+ "vue/html-comment-indent": ["error", 2],
335
+ "vue/next-tick-style": ["error", "promise"],
336
+ "vue/no-deprecated-delete-set": "error",
337
337
  "vue/no-deprecated-model-definition": [
338
338
  "error",
339
339
  {
340
340
  allowVue3Compat: true
341
341
  }
342
342
  ],
343
- "vue/component-name-in-template-casing": [
343
+ "vue/no-duplicate-attr-inheritance": [
344
344
  "error",
345
- "PascalCase",
346
345
  {
347
- // Force auto-import components to be PascalCase
348
- registeredComponentsOnly: false,
349
- ignores: ["slot", "component"]
346
+ checkMultiRootNodes: true
350
347
  }
351
348
  ],
352
- "vue/define-macros-order": [
349
+ "vue/no-empty-component-block": "error",
350
+ "vue/no-irregular-whitespace": "error",
351
+ "vue/no-multiple-objects-in-class": "error",
352
+ "vue/no-ref-object-reactivity-loss": "error",
353
+ "vue/no-required-prop-with-default": [
353
354
  "error",
354
355
  {
355
- order: [
356
- "defineProps",
357
- "defineEmits",
358
- "defineOptions",
359
- "defineSlots",
360
- "defineModel"
361
- ],
362
- defineExposeLast: true
356
+ autofix: true
363
357
  }
364
358
  ],
365
- "vue/html-comment-content-spacing": [
359
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
360
+ "vue/no-static-inline-styles": [
366
361
  "error",
367
- "always",
368
362
  {
369
- exceptions: ["-"]
363
+ allowBinding: true
370
364
  }
371
365
  ],
366
+ "vue/no-unused-emit-declarations": "error",
367
+ "vue/no-use-v-else-with-v-for": "error",
368
+ "vue/no-useless-v-bind": "error",
369
+ "vue/no-v-text": "error",
370
+ "vue/padding-line-between-blocks": "error",
371
+ "vue/prefer-define-options": "error",
372
+ "vue/prefer-prop-type-boolean-first": "error",
373
+ "vue/prefer-separate-static-class": "error",
374
+ "vue/prefer-true-attribute-shorthand": ["error", "always"],
375
+ "vue/prefer-use-template-ref": "error",
372
376
  "vue/require-macro-variable-name": [
373
377
  "error",
374
378
  {
375
- defineProps: "props",
376
379
  defineEmits: "emits",
380
+ defineProps: "props",
377
381
  defineSlots: "slots",
378
- useSlots: "slots",
379
- useAttrs: "attrs"
382
+ useAttrs: "attrs",
383
+ useSlots: "slots"
380
384
  }
381
- ]
385
+ ],
386
+ "vue/require-typed-object-prop": "error",
387
+ "vue/slot-name-casing": ["error", "kebab-case"],
388
+ "vue/v-for-delimiter-style": ["error", "in"],
389
+ "vue/valid-define-options": "error"
382
390
  };
383
391
  var configVue = (options = {}) => {
384
392
  const { files = [GLOB_VUE] } = options;
@@ -388,7 +396,7 @@ var configVue = (options = {}) => {
388
396
  if (!sfcBlocks) return processorVueSFC;
389
397
  return mergeProcessors2([
390
398
  processorVueSFC,
391
- default23({
399
+ default24({
392
400
  ...sfcBlocks,
393
401
  blocks: {
394
402
  styles: true,
@@ -401,45 +409,32 @@ var configVue = (options = {}) => {
401
409
  {
402
410
  name: "ntnyq/vue/setup",
403
411
  plugins: {
404
- vue: default3,
405
- "@typescript-eslint": plugin
412
+ "@typescript-eslint": plugin,
413
+ vue: default3
406
414
  }
407
415
  },
408
416
  {
409
417
  name: "ntnyq/vue/rules",
410
418
  files,
419
+ processor: getVueProcessor(),
411
420
  languageOptions: {
412
421
  parser: parserVue,
413
422
  parserOptions: {
414
- sourceType: "module",
415
423
  ecmaVersion: "latest",
416
424
  extraFileExtensions: [".vue"],
417
- parser: parserTypeScript,
425
+ parser,
426
+ sourceType: "module",
418
427
  ecmaFeatures: {
419
428
  jsx: true
420
429
  }
421
430
  }
422
431
  },
423
- processor: getVueProcessor(),
424
432
  rules: {
425
433
  ...sharedRules,
426
- "vue/html-self-closing": [
427
- "error",
428
- {
429
- html: {
430
- void: "always",
431
- normal: "always",
432
- component: "always"
433
- },
434
- svg: "always",
435
- math: "always"
436
- }
437
- ],
438
- "vue/this-in-template": ["error", "never"],
439
- "vue/prop-name-casing": ["error", "camelCase"],
440
434
  "vue/attributes-order": [
441
435
  "error",
442
436
  {
437
+ alphabetical: false,
443
438
  order: [
444
439
  "EVENTS",
445
440
  // `@click="functionCall"`, `v-on="event"`
@@ -470,8 +465,26 @@ var configVue = (options = {}) => {
470
465
  // `prop="foo", `static attributes
471
466
  "ATTR_SHORTHAND_BOOL"
472
467
  // `disabled`, prop shorthand
473
- ],
474
- alphabetical: false
468
+ ]
469
+ }
470
+ ],
471
+ "vue/html-self-closing": [
472
+ "error",
473
+ {
474
+ math: "always",
475
+ svg: "always",
476
+ html: {
477
+ component: "always",
478
+ normal: "always",
479
+ void: "always"
480
+ }
481
+ }
482
+ ],
483
+ "vue/max-attributes-per-line": [
484
+ "error",
485
+ {
486
+ multiline: 1,
487
+ singleline: 1
475
488
  }
476
489
  ],
477
490
  "vue/order-in-components": [
@@ -514,13 +527,8 @@ var configVue = (options = {}) => {
514
527
  ]
515
528
  }
516
529
  ],
517
- "vue/max-attributes-per-line": [
518
- "error",
519
- {
520
- singleline: 1,
521
- multiline: 1
522
- }
523
- ],
530
+ "vue/prop-name-casing": ["error", "camelCase"],
531
+ "vue/this-in-template": ["error", "never"],
524
532
  ...disabledRules,
525
533
  ...extensionRules,
526
534
  ...unCategorizedRules,
@@ -532,26 +540,29 @@ var configVue = (options = {}) => {
532
540
  };
533
541
 
534
542
  // src/configs/yml.ts
535
- var configYml = (options = {}) => [
536
- {
537
- name: "ntnyq/yml",
538
- files: [GLOB_YAML],
539
- languageOptions: {
540
- parser: parserYaml
541
- },
542
- plugins: {
543
- yml: default4
544
- },
545
- rules: {
546
- ...default4.configs.standard.rules,
547
- ...default4.configs.prettier.rules,
548
- "yml/no-empty-mapping-value": "off",
549
- "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
550
- // Overrides rules
551
- ...options.overrides
543
+ var configYml = (options = {}) => {
544
+ const { files = [GLOB_YAML] } = options;
545
+ return [
546
+ {
547
+ name: "ntnyq/yml",
548
+ files,
549
+ plugins: {
550
+ yml: default4
551
+ },
552
+ languageOptions: {
553
+ parser: parserYaml
554
+ },
555
+ rules: {
556
+ ...default4.configs.standard.rules,
557
+ ...default4.configs.prettier.rules,
558
+ "yml/no-empty-mapping-value": "off",
559
+ "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
560
+ // Overrides rules
561
+ ...options.overrides
562
+ }
552
563
  }
553
- }
554
- ];
564
+ ];
565
+ };
555
566
 
556
567
  // src/configs/node.ts
557
568
  var configNode = (options = {}) => [
@@ -579,10 +590,12 @@ var configNode = (options = {}) => [
579
590
  var configSort = (options = {}) => {
580
591
  const configs2 = [];
581
592
  const {
582
- tsconfig: enableSortTsconfig = true,
583
- packageJson: enableSortPackageJson = true,
593
+ additionalJsonFiles = [],
594
+ additionalYamlFiles = [],
584
595
  i18nLocale: enableSortI18nLocale = true,
585
- pnpmWorkspace: enableSortPnpmWorkspace = true
596
+ packageJson: enableSortPackageJson = true,
597
+ pnpmWorkspace: enableSortPnpmWorkspace = true,
598
+ tsconfig: enableSortTsconfig = true
586
599
  } = options;
587
600
  if (enableSortTsconfig) {
588
601
  configs2.push({
@@ -592,17 +605,20 @@ var configSort = (options = {}) => {
592
605
  "jsonc/sort-keys": [
593
606
  "error",
594
607
  {
608
+ pathPattern: "^$",
595
609
  order: [
596
610
  "extends",
597
611
  "compilerOptions",
598
612
  "references",
599
613
  "files",
600
614
  "include",
601
- "exclude"
602
- ],
603
- pathPattern: "^$"
615
+ "exclude",
616
+ // vue.volar
617
+ "vueCompilerOptions"
618
+ ]
604
619
  },
605
620
  {
621
+ pathPattern: "^compilerOptions$",
606
622
  order: [
607
623
  /* Projects */
608
624
  "incremental",
@@ -700,8 +716,7 @@ var configSort = (options = {}) => {
700
716
  /* Completeness */
701
717
  "skipDefaultLibCheck",
702
718
  "skipLibCheck"
703
- ],
704
- pathPattern: "^compilerOptions$"
719
+ ]
705
720
  }
706
721
  ]
707
722
  }
@@ -712,6 +727,25 @@ var configSort = (options = {}) => {
712
727
  name: "ntnyq/sort/package-json",
713
728
  files: ["**/package.json"],
714
729
  rules: {
730
+ "jsonc/sort-array-values": [
731
+ "error",
732
+ {
733
+ order: { type: "asc" },
734
+ pathPattern: "^files$"
735
+ },
736
+ {
737
+ order: { type: "asc" },
738
+ pathPattern: "^keywords$"
739
+ },
740
+ {
741
+ order: { type: "asc" },
742
+ pathPattern: "^activationEvents$"
743
+ },
744
+ {
745
+ order: { type: "asc" },
746
+ pathPattern: "^contributes.*$"
747
+ }
748
+ ],
715
749
  "jsonc/sort-keys": [
716
750
  "error",
717
751
  {
@@ -807,8 +841,8 @@ var configSort = (options = {}) => {
807
841
  ]
808
842
  },
809
843
  {
810
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
811
- order: { type: "asc" }
844
+ order: { type: "asc" },
845
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
812
846
  },
813
847
  {
814
848
  order: { type: "asc" },
@@ -816,7 +850,18 @@ var configSort = (options = {}) => {
816
850
  },
817
851
  {
818
852
  pathPattern: "^exports.*$",
819
- order: ["types", "import", "require", "default"]
853
+ order: [
854
+ "./package.json",
855
+ "types",
856
+ "import",
857
+ "require",
858
+ "default",
859
+ {
860
+ order: {
861
+ type: "asc"
862
+ }
863
+ }
864
+ ]
820
865
  },
821
866
  // VSCode extension
822
867
  {
@@ -828,15 +873,27 @@ var configSort = (options = {}) => {
828
873
  * @see {@link https://pnpm.io/package_json#publishconfig}
829
874
  */
830
875
  {
831
- order: { type: "asc" },
832
- pathPattern: "^publishConfig.*$"
833
- },
876
+ pathPattern: "^publishConfig.*$",
877
+ order: [
878
+ "./package.json",
879
+ "types",
880
+ "import",
881
+ "require",
882
+ "default",
883
+ {
884
+ order: {
885
+ type: "asc"
886
+ }
887
+ }
888
+ ]
889
+ },
834
890
  // npm scripts
835
891
  {
836
- pathPattern: "^scripts$",
837
- order: { type: "asc" }
892
+ order: { type: "asc" },
893
+ pathPattern: "^scripts$"
838
894
  },
839
895
  {
896
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$",
840
897
  order: [
841
898
  // client hooks only
842
899
  "pre-commit",
@@ -849,27 +906,7 @@ var configSort = (options = {}) => {
849
906
  "post-merge",
850
907
  "pre-push",
851
908
  "pre-auto-gc"
852
- ],
853
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
854
- }
855
- ],
856
- "jsonc/sort-array-values": [
857
- "error",
858
- {
859
- pathPattern: "^files$",
860
- order: { type: "asc" }
861
- },
862
- {
863
- pathPattern: "^keywords$",
864
- order: { type: "asc" }
865
- },
866
- {
867
- pathPattern: "^activationEvents$",
868
- order: { type: "asc" }
869
- },
870
- {
871
- pathPattern: "^contributes.*$",
872
- order: { type: "asc" }
909
+ ]
873
910
  }
874
911
  ]
875
912
  }
@@ -879,26 +916,26 @@ var configSort = (options = {}) => {
879
916
  configs2.push(
880
917
  {
881
918
  name: "ntnyq/sort/i18n-locale/json",
882
- files: ["**/{locales,i18n}/*.json"],
919
+ files: ["**/{i18n,langs,locales}/*.json"],
883
920
  rules: {
884
921
  "jsonc/sort-keys": [
885
922
  "error",
886
923
  {
887
- pathPattern: ".*",
888
- order: { type: "asc" }
924
+ order: { type: "asc" },
925
+ pathPattern: ".*"
889
926
  }
890
927
  ]
891
928
  }
892
929
  },
893
930
  {
894
931
  name: "ntnyq/sort/i18n-locale/yaml",
895
- files: ["**/{locales,i18n}/*.y?(a)ml"],
932
+ files: ["**/{i18n,langs,locales}/*.y?(a)ml"],
896
933
  rules: {
897
934
  "yml/sort-keys": [
898
935
  "error",
899
936
  {
900
- pathPattern: ".*",
901
- order: { type: "asc" }
937
+ order: { type: "asc" },
938
+ pathPattern: ".*"
902
939
  }
903
940
  ]
904
941
  }
@@ -913,8 +950,38 @@ var configSort = (options = {}) => {
913
950
  "yml/sort-keys": [
914
951
  "error",
915
952
  {
916
- pathPattern: ".*",
917
- order: { type: "asc" }
953
+ order: { type: "asc" },
954
+ pathPattern: ".*"
955
+ }
956
+ ]
957
+ }
958
+ });
959
+ }
960
+ if (additionalJsonFiles.length) {
961
+ configs2.push({
962
+ name: "ntnyq/sort/additional-json",
963
+ files: additionalJsonFiles,
964
+ rules: {
965
+ "jsonc/sort-keys": [
966
+ "error",
967
+ {
968
+ order: { type: "asc" },
969
+ pathPattern: ".*"
970
+ }
971
+ ]
972
+ }
973
+ });
974
+ }
975
+ if (additionalYamlFiles.length) {
976
+ configs2.push({
977
+ name: "ntnyq/sort/additional-yaml",
978
+ files: additionalYamlFiles,
979
+ rules: {
980
+ "yml/sort-keys": [
981
+ "error",
982
+ {
983
+ order: { type: "asc" },
984
+ pathPattern: ".*"
918
985
  }
919
986
  ]
920
987
  }
@@ -923,42 +990,21 @@ var configSort = (options = {}) => {
923
990
  return configs2;
924
991
  };
925
992
 
926
- // src/configs/toml.ts
927
- var configToml = (options = {}) => [
928
- {
929
- name: "ntnyq/toml",
930
- files: [GLOB_TOML],
931
- languageOptions: {
932
- parser: parserToml
933
- },
934
- plugins: {
935
- toml: default6
936
- },
937
- rules: {
938
- "toml/keys-order": "error",
939
- "toml/key-spacing": "error",
940
- "toml/quoted-keys": "error",
941
- "toml/comma-style": "error",
942
- "toml/tables-order": "error",
943
- "toml/no-space-dots": "error",
944
- "toml/spaced-comment": "error",
945
- "toml/precision-of-integer": "error",
946
- "toml/table-bracket-spacing": "error",
947
- "toml/array-bracket-newline": "error",
948
- "toml/inline-table-curly-spacing": "error",
949
- "toml/padding-line-between-pairs": "error",
950
- "toml/padding-line-between-tables": "error",
951
- "toml/no-unreadable-number-separator": "error",
952
- "toml/precision-of-fractional-seconds": "error",
953
- "toml/vue-custom-block/no-parsing-error": "error",
954
- "toml/indent": ["error", 2],
955
- "toml/array-bracket-spacing": ["error", "never"],
956
- "toml/array-element-newline": ["error", "never"],
957
- // Overrides rules
958
- ...options.overrides
959
- }
960
- }
961
- ];
993
+ // src/configs/svgo.ts
994
+ import { createConfig as createSVGOConfig } from "eslint-plugin-svgo";
995
+ var configSVGO = (options = {}) => {
996
+ const { files = [GLOB_SVG], rules: overridesRules = {} } = options;
997
+ return [
998
+ createSVGOConfig({
999
+ name: "ntnyq/svgo",
1000
+ files,
1001
+ rules: {
1002
+ "svgo/svgo": "error",
1003
+ ...overridesRules
1004
+ }
1005
+ })
1006
+ ];
1007
+ };
962
1008
 
963
1009
  // src/utils/env.ts
964
1010
  import { resolve } from "node:path";
@@ -1074,15 +1120,15 @@ var configTest = (options = {}) => {
1074
1120
  {
1075
1121
  name: "ntnyq/test/setup",
1076
1122
  plugins: {
1077
- "no-only-tests": default18
1123
+ "no-only-tests": default19
1078
1124
  }
1079
1125
  },
1080
1126
  {
1081
1127
  name: "ntnyq/test/base",
1082
1128
  files,
1083
1129
  rules: {
1084
- "no-unused-expressions": "off",
1085
1130
  "max-lines-per-function": "off",
1131
+ "no-unused-expressions": "off",
1086
1132
  "no-only-tests/no-only-tests": "error",
1087
1133
  // Overrides rules
1088
1134
  ...options.overrides
@@ -1106,19 +1152,43 @@ var configTest = (options = {}) => {
1106
1152
  return configs2;
1107
1153
  };
1108
1154
 
1109
- // src/configs/svgo.ts
1110
- import { createConfig as createSVGOConfig } from "eslint-plugin-svgo";
1111
- var configSVGO = (options = {}) => {
1112
- const { files = [GLOB_SVG], rules: overridesRules = {} } = options;
1155
+ // src/configs/toml.ts
1156
+ var configToml = (options = {}) => {
1157
+ const { files = [GLOB_TOML] } = options;
1113
1158
  return [
1114
- createSVGOConfig({
1115
- name: "ntnyq/svgo",
1159
+ {
1160
+ name: "ntnyq/toml",
1116
1161
  files,
1162
+ plugins: {
1163
+ toml: default6
1164
+ },
1165
+ languageOptions: {
1166
+ parser: parserToml
1167
+ },
1117
1168
  rules: {
1118
- "svgo/svgo": "error",
1119
- ...overridesRules
1169
+ "toml/array-bracket-newline": "error",
1170
+ "toml/array-bracket-spacing": ["error", "never"],
1171
+ "toml/array-element-newline": ["error", "never"],
1172
+ "toml/comma-style": "error",
1173
+ "toml/indent": ["error", 2],
1174
+ "toml/inline-table-curly-spacing": "error",
1175
+ "toml/key-spacing": "error",
1176
+ "toml/keys-order": "error",
1177
+ "toml/no-space-dots": "error",
1178
+ "toml/no-unreadable-number-separator": "error",
1179
+ "toml/padding-line-between-pairs": "error",
1180
+ "toml/padding-line-between-tables": "error",
1181
+ "toml/precision-of-fractional-seconds": "error",
1182
+ "toml/precision-of-integer": "error",
1183
+ "toml/quoted-keys": "error",
1184
+ "toml/spaced-comment": "error",
1185
+ "toml/table-bracket-spacing": "error",
1186
+ "toml/tables-order": "error",
1187
+ "toml/vue-custom-block/no-parsing-error": "error",
1188
+ // Overrides rules
1189
+ ...options.overrides
1120
1190
  }
1121
- })
1191
+ }
1122
1192
  ];
1123
1193
  };
1124
1194
 
@@ -1127,14 +1197,14 @@ var configAntfu = (options = {}) => [
1127
1197
  {
1128
1198
  name: "ntnyq/antfu",
1129
1199
  plugins: {
1130
- antfu: default9
1200
+ antfu: default8
1131
1201
  },
1132
1202
  rules: {
1133
1203
  // required `object-curly-newline` to be disabled
1134
1204
  // 'antfu/consistent-list-newline': 'error',
1135
1205
  "antfu/import-dedupe": "error",
1136
- "antfu/no-import-dist": "error",
1137
1206
  "antfu/indent-unindent": "error",
1207
+ "antfu/no-import-dist": "error",
1138
1208
  "antfu/no-import-node-modules-by-path": "error",
1139
1209
  // Overrides rules
1140
1210
  ...options.overrides
@@ -1161,7 +1231,7 @@ var configJsdoc = (options = {}) => [
1161
1231
  {
1162
1232
  name: "ntnyq/jsdoc",
1163
1233
  plugins: {
1164
- jsdoc: default10
1234
+ jsdoc: default9
1165
1235
  },
1166
1236
  rules: {
1167
1237
  // Disabled rules
@@ -1169,34 +1239,19 @@ var configJsdoc = (options = {}) => [
1169
1239
  // Use `jsdoc/sort-tags`
1170
1240
  "jsdoc/text-escaping": "off",
1171
1241
  // No need
1172
- // Fixable rules
1173
- "jsdoc/empty-tags": "error",
1174
- "jsdoc/no-defaults": "error",
1175
- "jsdoc/check-types": "error",
1176
- "jsdoc/no-blank-blocks": "error",
1242
+ "jsdoc/check-access": "warn",
1243
+ "jsdoc/implements-on-classes": "warn",
1244
+ "jsdoc/require-param-name": "warn",
1245
+ "jsdoc/require-property": "warn",
1246
+ "jsdoc/require-property-description": "warn",
1247
+ "jsdoc/require-property-name": "warn",
1248
+ "jsdoc/require-returns-check": "warn",
1249
+ "jsdoc/require-returns-description": "warn",
1250
+ "jsdoc/require-yields-check": "warn",
1177
1251
  "jsdoc/check-alignment": "error",
1178
- "jsdoc/multiline-blocks": "error",
1179
- "jsdoc/check-param-names": "error",
1180
- "jsdoc/no-multi-asterisks": "error",
1181
1252
  "jsdoc/check-line-alignment": "error",
1253
+ "jsdoc/check-param-names": "error",
1182
1254
  "jsdoc/check-property-names": "error",
1183
- "jsdoc/require-asterisk-prefix": "error",
1184
- "jsdoc/no-blank-block-descriptions": "error",
1185
- "jsdoc/require-hyphen-before-param-description": "error",
1186
- "jsdoc/no-bad-blocks": [
1187
- "error",
1188
- {
1189
- ignore: [
1190
- // built-in default
1191
- "ts-check",
1192
- "ts-expect-error",
1193
- "ts-ignore",
1194
- "ts-nocheck",
1195
- // useful
1196
- "vite-ignore"
1197
- ]
1198
- }
1199
- ],
1200
1255
  "jsdoc/check-tag-names": [
1201
1256
  "error",
1202
1257
  {
@@ -1217,90 +1272,77 @@ var configJsdoc = (options = {}) => [
1217
1272
  ]
1218
1273
  }
1219
1274
  ],
1220
- "jsdoc/check-access": "warn",
1221
- "jsdoc/implements-on-classes": "warn",
1222
- "jsdoc/require-param-name": "warn",
1223
- "jsdoc/require-property": "warn",
1224
- "jsdoc/require-property-name": "warn",
1225
- "jsdoc/require-property-description": "warn",
1226
- "jsdoc/require-returns-check": "warn",
1227
- "jsdoc/require-returns-description": "warn",
1228
- "jsdoc/require-yields-check": "warn",
1229
- // TypeScript rules overrides
1230
- ...options.typescript ? typescriptRules : javscriptRules,
1231
- // Overrides rules
1232
- ...options.overrides
1233
- }
1234
- }
1235
- ];
1236
-
1237
- // src/configs/jsonc.ts
1238
- var configJsonc = (options = {}) => [
1239
- {
1240
- name: "ntnyq/jsonc",
1241
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1242
- plugins: {
1243
- jsonc: default11
1244
- },
1245
- languageOptions: {
1246
- parser: parserJsonc
1247
- },
1248
- rules: {
1249
- ...default11.configs["recommended-with-jsonc"].rules,
1250
- "jsonc/no-octal-escape": "error",
1251
- "jsonc/indent": ["error", 2],
1252
- "jsonc/comma-style": ["error", "last"],
1253
- "jsonc/comma-dangle": ["error", "never"],
1254
- "jsonc/object-curly-spacing": ["error", "always"],
1255
- "jsonc/array-bracket-spacing": ["error", "never"],
1256
- "jsonc/key-spacing": [
1257
- "error",
1258
- {
1259
- beforeColon: false,
1260
- afterColon: true
1261
- }
1262
- ],
1263
- "jsonc/object-curly-newline": [
1264
- "error",
1265
- {
1266
- multiline: true,
1267
- consistent: true
1268
- }
1269
- ],
1270
- "jsonc/object-property-newline": [
1275
+ "jsdoc/check-types": "error",
1276
+ // Fixable rules
1277
+ "jsdoc/empty-tags": "error",
1278
+ "jsdoc/multiline-blocks": "error",
1279
+ "jsdoc/no-bad-blocks": [
1271
1280
  "error",
1272
1281
  {
1273
- allowMultiplePropertiesPerLine: true
1282
+ ignore: [
1283
+ // built-in default
1284
+ "ts-check",
1285
+ "ts-expect-error",
1286
+ "ts-ignore",
1287
+ "ts-nocheck",
1288
+ // useful
1289
+ "vite-ignore"
1290
+ ]
1274
1291
  }
1275
1292
  ],
1293
+ "jsdoc/no-blank-block-descriptions": "error",
1294
+ "jsdoc/no-blank-blocks": "error",
1295
+ "jsdoc/no-defaults": "error",
1296
+ "jsdoc/no-multi-asterisks": "error",
1297
+ "jsdoc/require-asterisk-prefix": "error",
1298
+ "jsdoc/require-hyphen-before-param-description": "error",
1299
+ // TypeScript rules overrides
1300
+ ...options.typescript ? typescriptRules : javscriptRules,
1276
1301
  // Overrides rules
1277
1302
  ...options.overrides
1278
1303
  }
1279
1304
  }
1280
1305
  ];
1281
1306
 
1282
- // src/configs/pinia.ts
1283
- var configPinia = (options = {}) => {
1284
- const { files = [GLOB_PINIA_STORE] } = options;
1307
+ // src/configs/jsonc.ts
1308
+ var configJsonc = (options = {}) => {
1309
+ const { files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC] } = options;
1285
1310
  return [
1286
1311
  {
1287
- name: "ntnyq/pinia",
1312
+ name: "ntnyq/jsonc",
1288
1313
  files,
1289
1314
  plugins: {
1290
- pinia: default7
1315
+ jsonc: default10
1316
+ },
1317
+ languageOptions: {
1318
+ parser: parserJsonc
1291
1319
  },
1292
1320
  rules: {
1293
- "pinia/prefer-single-store-per-file": "error",
1294
- "pinia/no-duplicate-store-ids": "error",
1295
- "pinia/no-return-global-properties": "error",
1296
- "pinia/no-store-to-refs-in-store": "error",
1297
- "pinia/never-export-initialized-store": "error",
1298
- "pinia/require-setup-store-properties-export": "error",
1299
- "pinia/prefer-use-store-naming-convention": [
1321
+ ...default10.configs["recommended-with-jsonc"].rules,
1322
+ "jsonc/array-bracket-spacing": ["error", "never"],
1323
+ "jsonc/comma-dangle": ["error", "never"],
1324
+ "jsonc/comma-style": ["error", "last"],
1325
+ "jsonc/indent": ["error", 2],
1326
+ "jsonc/key-spacing": [
1300
1327
  "error",
1301
1328
  {
1302
- checkStoreNameMismatch: true,
1303
- storeSuffix: "Store"
1329
+ afterColon: true,
1330
+ beforeColon: false
1331
+ }
1332
+ ],
1333
+ "jsonc/no-octal-escape": "error",
1334
+ "jsonc/object-curly-newline": [
1335
+ "error",
1336
+ {
1337
+ consistent: true,
1338
+ multiline: true
1339
+ }
1340
+ ],
1341
+ "jsonc/object-curly-spacing": ["error", "always"],
1342
+ "jsonc/object-property-newline": [
1343
+ "error",
1344
+ {
1345
+ allowMultiplePropertiesPerLine: true
1304
1346
  }
1305
1347
  ],
1306
1348
  // Overrides rules
@@ -1325,6 +1367,37 @@ var configNtnyq = (options = {}) => [
1325
1367
  }
1326
1368
  ];
1327
1369
 
1370
+ // src/configs/pinia.ts
1371
+ var configPinia = (options = {}) => {
1372
+ const { files = [GLOB_PINIA_STORE] } = options;
1373
+ return [
1374
+ {
1375
+ name: "ntnyq/pinia",
1376
+ files,
1377
+ plugins: {
1378
+ pinia: default11
1379
+ },
1380
+ rules: {
1381
+ "pinia/never-export-initialized-store": "error",
1382
+ "pinia/no-duplicate-store-ids": "error",
1383
+ "pinia/no-return-global-properties": "error",
1384
+ "pinia/no-store-to-refs-in-store": "error",
1385
+ "pinia/prefer-single-store-per-file": "error",
1386
+ "pinia/prefer-use-store-naming-convention": [
1387
+ "error",
1388
+ {
1389
+ checkStoreNameMismatch: true,
1390
+ storeSuffix: "Store"
1391
+ }
1392
+ ],
1393
+ "pinia/require-setup-store-properties-export": "error",
1394
+ // Overrides rules
1395
+ ...options.overrides
1396
+ }
1397
+ }
1398
+ ];
1399
+ };
1400
+
1328
1401
  // src/configs/depend.ts
1329
1402
  var configDepend = (options = {}) => {
1330
1403
  const {
@@ -1366,50 +1439,8 @@ var configDepend = (options = {}) => {
1366
1439
  return configs2;
1367
1440
  };
1368
1441
 
1369
- // src/configs/regexp.ts
1370
- var configRegexp = (options = {}) => {
1371
- const recommendedConfig = pluginRegexp.configs["flat/recommended"];
1372
- const recommendedRules2 = {
1373
- ...recommendedConfig.rules
1374
- };
1375
- if (options.severity === "warn") {
1376
- for (const key in recommendedRules2) {
1377
- if (recommendedRules2[key] === "error") {
1378
- recommendedRules2[key] = "warn";
1379
- }
1380
- }
1381
- }
1382
- return [
1383
- {
1384
- ...recommendedConfig,
1385
- name: "ntnyq/regexp",
1386
- rules: {
1387
- ...recommendedRules2,
1388
- // Overrides rules
1389
- ...options.overrides
1390
- }
1391
- }
1392
- ];
1393
- };
1394
-
1395
- // src/configs/unocss.ts
1396
- var configUnoCSS = (options = {}) => [
1397
- {
1398
- name: "ntnyq/unocss",
1399
- plugins: {
1400
- unocss: default13
1401
- },
1402
- rules: {
1403
- "unocss/order": "error",
1404
- "unocss/order-attributify": options.attributify ? "error" : "off",
1405
- // Overrides rules
1406
- ...options.overrides
1407
- }
1408
- }
1409
- ];
1410
-
1411
- // src/constants.ts
1412
- var DEFAULT_PRETTIER_OPTIONS = {
1442
+ // src/constants/prettier.ts
1443
+ var PRETTIER_DEFAULT_OPTIONS = {
1413
1444
  arrowParens: "avoid",
1414
1445
  bracketSameLine: false,
1415
1446
  bracketSpacing: true,
@@ -1436,6 +1467,125 @@ var DEFAULT_PRETTIER_OPTIONS = {
1436
1467
  vueIndentScriptAndStyle: false
1437
1468
  };
1438
1469
 
1470
+ // src/constants/perfectionist.ts
1471
+ var PERFECTIONIST_COMMON_RULE_OPTIONS = {
1472
+ fallbackSort: { order: "asc", type: "alphabetical" },
1473
+ ignoreCase: true,
1474
+ order: "asc",
1475
+ type: "alphabetical"
1476
+ };
1477
+ var PERFECTIONIST_EXTRA_RULE_OPTIONS = {
1478
+ newlinesBetween: "ignore",
1479
+ partitionByComment: ["@pg", "@perfectionist-group"]
1480
+ };
1481
+ var PERFECTIONIST_SORT_OBJECTS_GROUPS = [
1482
+ "property",
1483
+ "multiline-property",
1484
+ "method",
1485
+ "multiline-method",
1486
+ "unknown"
1487
+ ];
1488
+ var PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS = [
1489
+ "required-property",
1490
+ "optional-property",
1491
+ "required-method",
1492
+ "optional-method",
1493
+ "required-multiline-property",
1494
+ "optional-multiline-property",
1495
+ "required-multiline-method",
1496
+ "optional-multiline-method",
1497
+ "unknown",
1498
+ "index-signature",
1499
+ "multiline-index-signature"
1500
+ ];
1501
+ var PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS = [
1502
+ /**
1503
+ * eg. 'foobar', 24, false
1504
+ */
1505
+ "literal",
1506
+ /**
1507
+ * eg. number, string
1508
+ */
1509
+ "keyword",
1510
+ /**
1511
+ * eg. FooBar
1512
+ */
1513
+ "named",
1514
+ /**
1515
+ * eg. Foo & Bar
1516
+ */
1517
+ "intersection",
1518
+ /**
1519
+ * eg. Foobar extends string ? Foo : Bar
1520
+ */
1521
+ "conditional",
1522
+ /**
1523
+ * eg. (...args: any[]) => void
1524
+ */
1525
+ "function",
1526
+ /**
1527
+ * eg. import('eslint').Linter
1528
+ */
1529
+ "import",
1530
+ /**
1531
+ * eg. { foo: string; bar: number; }
1532
+ */
1533
+ "object",
1534
+ /**
1535
+ * eg. keyof T
1536
+ */
1537
+ "operator",
1538
+ /**
1539
+ * eg. [string, number]
1540
+ */
1541
+ "tuple",
1542
+ /**
1543
+ * eg. Foo | Bar
1544
+ */
1545
+ "union",
1546
+ /**
1547
+ * eg. null | undefined
1548
+ */
1549
+ "nullish"
1550
+ ];
1551
+ var PERFECTIONIST_SORT_IMPORTS_GROUPS = [
1552
+ // Side effect style imports (e.g. 'normalize.css')
1553
+ "side-effect-style",
1554
+ // Styles (e.g. *.{css,scss,less})
1555
+ "style",
1556
+ // Node.js built-in modules. (e.g. fs, path)
1557
+ "builtin",
1558
+ // External modules installed in the project (e.g. vue, lodash)
1559
+ "external",
1560
+ // Internal modules (e.g. @/utils, @/components)
1561
+ "internal",
1562
+ // Modules from parent directory (e.g. ../utils)
1563
+ "parent",
1564
+ // Modules from the same directory (e.g. ./utils)
1565
+ "sibling",
1566
+ // Main file from the current directory (e.g. ./index)
1567
+ "index",
1568
+ // TypeScript object-imports (e.g. import log = console.log)
1569
+ "object",
1570
+ // Side effect imports (e.g. import 'babel-polyfill')
1571
+ "side-effect",
1572
+ /**
1573
+ * Type import at the end
1574
+ */
1575
+ "builtin-type",
1576
+ "external-type",
1577
+ "internal-type",
1578
+ "parent-type",
1579
+ "sibling-type",
1580
+ "index-type",
1581
+ "type",
1582
+ /**
1583
+ * Imports that don’t fit into any other group
1584
+ */
1585
+ "unknown"
1586
+ ];
1587
+ var PERFECTIONIST_SORT_CLASSES_GROUPS = ["unknown"];
1588
+
1439
1589
  // src/configs/format.ts
1440
1590
  var configFormat = (options = {}) => {
1441
1591
  const {
@@ -1445,7 +1595,7 @@ var configFormat = (options = {}) => {
1445
1595
  prettierOptions = {}
1446
1596
  } = options;
1447
1597
  const sharedPrettierOptions = {
1448
- ...DEFAULT_PRETTIER_OPTIONS,
1598
+ ...PRETTIER_DEFAULT_OPTIONS,
1449
1599
  ...prettierOptions
1450
1600
  };
1451
1601
  const configs2 = [
@@ -1525,6 +1675,48 @@ var configFormat = (options = {}) => {
1525
1675
  return configs2;
1526
1676
  };
1527
1677
 
1678
+ // src/configs/regexp.ts
1679
+ var configRegexp = (options = {}) => {
1680
+ const recommendedConfig = pluginRegexp.configs["flat/recommended"];
1681
+ const recommendedRules2 = {
1682
+ ...recommendedConfig.rules
1683
+ };
1684
+ if (options.severity === "warn") {
1685
+ for (const key in recommendedRules2) {
1686
+ if (recommendedRules2[key] === "error") {
1687
+ recommendedRules2[key] = "warn";
1688
+ }
1689
+ }
1690
+ }
1691
+ return [
1692
+ {
1693
+ ...recommendedConfig,
1694
+ name: "ntnyq/regexp",
1695
+ rules: {
1696
+ ...recommendedRules2,
1697
+ // Overrides rules
1698
+ ...options.overrides
1699
+ }
1700
+ }
1701
+ ];
1702
+ };
1703
+
1704
+ // src/configs/unocss.ts
1705
+ var configUnoCSS = (options = {}) => [
1706
+ {
1707
+ name: "ntnyq/unocss",
1708
+ plugins: {
1709
+ unocss: default13
1710
+ },
1711
+ rules: {
1712
+ "unocss/order-attributify": options.attributify ? "error" : "off",
1713
+ "unocss/order": "error",
1714
+ // Overrides rules
1715
+ ...options.overrides
1716
+ }
1717
+ }
1718
+ ];
1719
+
1528
1720
  // src/configs/command.ts
1529
1721
  import { builtinCommands } from "eslint-plugin-command/commands";
1530
1722
  import createCommandConfig from "eslint-plugin-command/config";
@@ -1610,9 +1802,9 @@ var configIgnores = (customIgnores = []) => [
1610
1802
  // src/configs/importX.ts
1611
1803
  var configImportX = (options = {}) => {
1612
1804
  const {
1613
- typescript: enableTypeScript,
1614
1805
  // use typescript resolve if possible
1615
- preferTypeScriptResolver = true
1806
+ preferTypeScriptResolver = true,
1807
+ typescript: enableTypeScript
1616
1808
  } = options;
1617
1809
  return [
1618
1810
  {
@@ -1638,22 +1830,22 @@ var configImportX = (options = {}) => {
1638
1830
  ]
1639
1831
  },
1640
1832
  rules: {
1641
- "import-x/no-unresolved": "off",
1642
1833
  "import-x/no-absolute-path": "off",
1643
1834
  "import-x/no-named-as-default-member": "off",
1644
1835
  "import-x/no-named-default": "off",
1836
+ "import-x/no-unresolved": "off",
1645
1837
  // disabled in favor or `perfectionist/sort-imports`
1646
1838
  "import-x/order": "off",
1647
- "import-x/first": "error",
1648
- "import-x/export": "error",
1649
- "import-x/no-self-import": "error",
1650
- "import-x/no-duplicates": "error",
1651
- "import-x/no-mutable-exports": "error",
1652
- "import-x/newline-after-import": "error",
1653
1839
  "import-x/consistent-type-specifier-style": [
1654
1840
  "error",
1655
1841
  "prefer-top-level"
1656
1842
  ],
1843
+ "import-x/export": "error",
1844
+ "import-x/first": "error",
1845
+ "import-x/newline-after-import": "error",
1846
+ "import-x/no-duplicates": "error",
1847
+ "import-x/no-mutable-exports": "error",
1848
+ "import-x/no-self-import": "error",
1657
1849
  // Overrides rules
1658
1850
  ...options.overrides
1659
1851
  }
@@ -1665,12 +1857,12 @@ var configImportX = (options = {}) => {
1665
1857
  var disabledRules2 = {
1666
1858
  "unicorn/better-regex": "off",
1667
1859
  "unicorn/explicit-length-check": "off",
1668
- "unicorn/prefer-top-level-await": "off",
1669
1860
  "unicorn/no-array-callback-reference": "off",
1670
1861
  /**
1671
1862
  * @see https://caniuse.com/?search=globalThis
1672
1863
  */
1673
- "unicorn/prefer-global-this": "off"
1864
+ "unicorn/prefer-global-this": "off",
1865
+ "unicorn/prefer-top-level-await": "off"
1674
1866
  };
1675
1867
  var configUnicorn = (options = {}) => [
1676
1868
  {
@@ -1679,70 +1871,78 @@ var configUnicorn = (options = {}) => [
1679
1871
  unicorn: default15
1680
1872
  },
1681
1873
  rules: {
1874
+ "unicorn/catch-error-name": [
1875
+ "error",
1876
+ {
1877
+ name: "err",
1878
+ ignore: ["^_."]
1879
+ }
1880
+ ],
1881
+ "unicorn/consistent-existence-index-check": "error",
1882
+ "unicorn/custom-error-definition": "error",
1883
+ "unicorn/error-message": "error",
1682
1884
  "unicorn/escape-case": "error",
1885
+ "unicorn/new-for-builtins": "error",
1886
+ "unicorn/no-console-spaces": "error",
1683
1887
  "unicorn/no-for-loop": "error",
1888
+ "unicorn/no-hex-escape": "error",
1684
1889
  "unicorn/no-lonely-if": "error",
1685
- "unicorn/error-message": "error",
1686
1890
  "unicorn/no-new-buffer": "error",
1687
- "unicorn/no-hex-escape": "error",
1688
- "unicorn/throw-new-error": "error",
1689
- "unicorn/prefer-includes": "error",
1690
- "unicorn/new-for-builtins": "error",
1691
- "unicorn/prefer-type-error": "error",
1692
- "unicorn/prefer-math-trunc": "error",
1693
- "unicorn/no-console-spaces": "error",
1891
+ "unicorn/no-static-only-class": "error",
1892
+ "unicorn/no-typeof-undefined": "error",
1893
+ "unicorn/no-unnecessary-await": "error",
1694
1894
  "unicorn/no-zero-fractions": "error",
1695
- "unicorn/prefer-regexp-test": "error",
1696
1895
  "unicorn/number-literal-case": "error",
1697
- "unicorn/no-typeof-undefined": "error",
1896
+ "unicorn/prefer-date-now": "error",
1897
+ "unicorn/prefer-includes": "error",
1898
+ "unicorn/prefer-keyboard-event-key": "error",
1698
1899
  "unicorn/prefer-math-min-max": "error",
1699
- "unicorn/prefer-node-protocol": "error",
1700
- "unicorn/no-unnecessary-await": "error",
1701
- "unicorn/no-static-only-class": "error",
1702
- "unicorn/prefer-reflect-apply": "error",
1703
- "unicorn/prefer-negative-index": "error",
1704
- "unicorn/prefer-structured-clone": "error",
1705
- "unicorn/custom-error-definition": "error",
1900
+ "unicorn/prefer-math-trunc": "error",
1706
1901
  "unicorn/prefer-modern-math-apis": "error",
1902
+ "unicorn/prefer-negative-index": "error",
1903
+ "unicorn/prefer-node-protocol": "error",
1707
1904
  "unicorn/prefer-number-properties": "error",
1708
- "unicorn/prefer-prototype-methods": "error",
1709
- "unicorn/prefer-keyboard-event-key": "error",
1710
1905
  "unicorn/prefer-optional-catch-binding": "error",
1711
- "unicorn/consistent-existence-index-check": "error",
1906
+ "unicorn/prefer-prototype-methods": "error",
1907
+ "unicorn/prefer-reflect-apply": "error",
1908
+ "unicorn/prefer-regexp-test": "error",
1909
+ "unicorn/prefer-structured-clone": "error",
1910
+ "unicorn/prefer-type-error": "error",
1712
1911
  "unicorn/switch-case-braces": ["error", "avoid"],
1713
- "unicorn/catch-error-name": [
1714
- "error",
1715
- {
1716
- name: "err",
1717
- ignore: ["^_."]
1718
- }
1719
- ],
1720
- "unicorn/prefer-date-now": "error",
1721
- // String
1912
+ "unicorn/throw-new-error": "error",
1913
+ /**
1914
+ * @pg String
1915
+ */
1722
1916
  "unicorn/prefer-code-point": "error",
1723
1917
  "unicorn/prefer-string-slice": "error",
1724
- "unicorn/prefer-string-trim-start-end": "error",
1725
1918
  "unicorn/prefer-string-starts-ends-with": "error",
1726
- // DOM
1727
- "unicorn/prefer-query-selector": "error",
1728
- "unicorn/prefer-modern-dom-apis": "error",
1729
- "unicorn/prefer-dom-node-remove": "error",
1919
+ "unicorn/prefer-string-trim-start-end": "error",
1920
+ /**
1921
+ * @pg DOM
1922
+ */
1923
+ "unicorn/no-invalid-remove-event-listener": "error",
1924
+ "unicorn/prefer-add-event-listener": "error",
1730
1925
  "unicorn/prefer-dom-node-append": "error",
1731
1926
  "unicorn/prefer-dom-node-dataset": "error",
1732
- "unicorn/prefer-add-event-listener": "error",
1927
+ "unicorn/prefer-dom-node-remove": "error",
1733
1928
  "unicorn/prefer-dom-node-text-content": "error",
1734
- "unicorn/no-invalid-remove-event-listener": "error",
1735
- // Array
1736
- "unicorn/no-new-array": "error",
1929
+ "unicorn/prefer-modern-dom-apis": "error",
1930
+ "unicorn/prefer-query-selector": "error",
1931
+ /**
1932
+ * @pg Array
1933
+ */
1934
+ "unicorn/no-array-method-this-argument": "error",
1737
1935
  "unicorn/no-array-push-push": "error",
1738
- "unicorn/prefer-array-find": "error",
1739
- "unicorn/prefer-array-some": "error",
1740
1936
  "unicorn/no-instanceof-array": "error",
1937
+ "unicorn/no-new-array": "error",
1938
+ "unicorn/prefer-array-find": "error",
1741
1939
  "unicorn/prefer-array-flat-map": "error",
1742
1940
  "unicorn/prefer-array-index-of": "error",
1941
+ "unicorn/prefer-array-some": "error",
1743
1942
  "unicorn/require-array-join-separator": "error",
1744
- "unicorn/no-array-method-this-argument": "error",
1745
- // Set
1943
+ /**
1944
+ * @pg Set
1945
+ */
1746
1946
  "unicorn/prefer-set-has": "error",
1747
1947
  "unicorn/prefer-set-size": "error",
1748
1948
  ...disabledRules2,
@@ -1752,130 +1952,48 @@ var configUnicorn = (options = {}) => [
1752
1952
  }
1753
1953
  ];
1754
1954
 
1755
- // src/configs/specials.ts
1756
- import globals from "globals";
1757
- var configSpecials = (options = {}) => {
1955
+ // src/configs/deMorgan.ts
1956
+ var configDeMorgan = (options = {}) => [
1957
+ {
1958
+ ...default18.configs.recommended,
1959
+ name: "ntnyq/de-morgan",
1960
+ rules: {
1961
+ ...default18.configs.recommended.rules,
1962
+ // Overrides rules
1963
+ ...options.overrides
1964
+ }
1965
+ }
1966
+ ];
1967
+
1968
+ // src/configs/markdown.ts
1969
+ var configMarkdown = (options = {}) => {
1758
1970
  const {
1759
- // Enable shadcn-vue support
1760
- shadcnVue: enableShadcnVue = hasShadcnVue()
1971
+ /**
1972
+ * code block files
1973
+ */
1974
+ files = [GLOB_MARKDOWN_CODE],
1975
+ /**
1976
+ * other extensions
1977
+ */
1978
+ extensions = []
1761
1979
  } = options;
1762
1980
  const configs2 = [
1763
- {
1764
- name: "ntnyq/specials/scripts",
1765
- files: [`**/scripts/${GLOB_SRC}`],
1766
- rules: {
1767
- "no-console": "off",
1768
- "@typescript-eslint/explicit-function-return-type": "off",
1769
- // Overrides rules
1770
- ...options.overridesScriptsRules
1771
- }
1772
- },
1773
- {
1774
- name: "ntnyq/specials/cli",
1775
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1776
- rules: {
1777
- "no-console": "off",
1778
- "@typescript-eslint/explicit-function-return-type": "off",
1779
- // Overrides rules
1780
- ...options.overridesCliRules
1781
- }
1782
- },
1783
- {
1784
- name: "ntnyq/specials/userscript",
1785
- files: [`**/*.user.${GLOB_SRC_EXT}`],
1786
- languageOptions: {
1787
- globals: {
1788
- ...globals.greasemonkey
1789
- }
1790
- },
1791
- rules: {
1792
- camelcase: [
1793
- "error",
1794
- {
1795
- allow: ["^GM_.+"]
1796
- }
1797
- ],
1798
- // Overrides rules
1799
- ...options.overridesUserScriptsRules
1800
- }
1801
- },
1802
- {
1803
- name: "ntnyq/specials/config-file",
1804
- files: [`**/*.config*.${GLOB_SRC_EXT}`],
1805
- plugins: {
1806
- "import-x": default16,
1807
- perfectionist: default20
1808
- },
1809
- rules: {
1810
- "no-console": "off",
1811
- "import-x/no-default-export": "off",
1812
- "@typescript-eslint/explicit-function-return-type": "off",
1813
- "perfectionist/sort-objects": [
1814
- "error",
1815
- {
1816
- type: "alphabetical",
1817
- order: "asc",
1818
- partitionByComment: true,
1819
- groups: ["unknown", "method", "multiline"]
1820
- }
1821
- ],
1822
- ...options.overridesConfigFileRules
1823
- }
1824
- }
1825
- ];
1826
- if (enableShadcnVue) {
1827
- const shadcnOptions = resolveSubOptions(options, "shadcnVue");
1828
- configs2.push({
1829
- name: "ntnyq/specials/shadcn-vue",
1830
- files: shadcnOptions.files || [
1831
- "**/components/ui/**/*.ts",
1832
- "**/components/ui/**/*.vue"
1833
- ],
1834
- rules: {
1835
- "vue/define-emits-declaration": "off",
1836
- "import-x/consistent-type-specifier-style": "off",
1837
- "@typescript-eslint/no-unused-vars": "off",
1838
- "@typescript-eslint/consistent-type-imports": "off",
1839
- // Overrides rules
1840
- ...shadcnOptions.overridesRules
1841
- }
1842
- });
1843
- }
1844
- if (options.specialCaseConfigs) {
1845
- configs2.push(...options.specialCaseConfigs);
1846
- }
1847
- return configs2;
1848
- };
1849
-
1850
- // src/configs/markdown.ts
1851
- var configMarkdown = (options = {}) => {
1852
- const {
1853
- /**
1854
- * code block files
1855
- */
1856
- files = [GLOB_MARKDOWN_CODE],
1857
- /**
1858
- * other extensions
1859
- */
1860
- extensions = []
1861
- } = options;
1862
- const configs2 = [
1863
- /**
1864
- * extracting code blocks to be linted individually
1865
- */
1866
- ...default8.configs.processor.map((config) => ({
1867
- ...config,
1868
- name: `ntnyq/${config.name}`
1869
- })),
1870
- /**
1871
- * enhance `markdown/recommended/processor`
1872
- */
1981
+ /**
1982
+ * extracting code blocks to be linted individually
1983
+ */
1984
+ ...default7.configs.processor.map((config) => ({
1985
+ ...config,
1986
+ name: `ntnyq/${config.name}`
1987
+ })),
1988
+ /**
1989
+ * enhance `markdown/recommended/processor`
1990
+ */
1873
1991
  {
1874
1992
  name: "ntnyq/markdown/processor",
1875
1993
  files,
1876
1994
  ignores: [GLOB_MARKDOWN_NESTED],
1877
1995
  processor: mergeProcessors([
1878
- default8.processors.markdown,
1996
+ default7.processors.markdown,
1879
1997
  // Just pass through processor
1880
1998
  processorPassThrough
1881
1999
  ])
@@ -1896,35 +2014,35 @@ var configMarkdown = (options = {}) => {
1896
2014
  ],
1897
2015
  languageOptions: {
1898
2016
  parserOptions: {
1899
- ecmaFeatures: {
1900
- impliedStrict: true
1901
- },
1902
2017
  // type-aware lint related parserOptions
1903
2018
  project: false,
1904
- projectService: false
2019
+ projectService: false,
2020
+ ecmaFeatures: {
2021
+ impliedStrict: true
2022
+ }
1905
2023
  }
1906
2024
  },
1907
2025
  rules: {
1908
- "no-undef": "off",
2026
+ "@typescript-eslint/comma-dangle": "off",
2027
+ "@typescript-eslint/consistent-type-imports": "off",
2028
+ "@typescript-eslint/no-extraneous-class": "off",
2029
+ "@typescript-eslint/no-namespace": "off",
2030
+ "@typescript-eslint/no-redeclare": "off",
2031
+ "@typescript-eslint/no-require-imports": "off",
2032
+ "@typescript-eslint/no-unused-expressions": "off",
2033
+ "@typescript-eslint/no-unused-vars": "off",
2034
+ "@typescript-eslint/no-use-before-define": "off",
2035
+ "import-x/no-unresolved": "off",
1909
2036
  "no-alert": "off",
1910
2037
  "no-console": "off",
1911
- "no-unused-vars": "off",
1912
- "no-unused-expressions": "off",
1913
2038
  "no-restricted-imports": "off",
2039
+ "no-undef": "off",
2040
+ "no-unused-expressions": "off",
2041
+ "no-unused-vars": "off",
1914
2042
  "node/prefer-global/buffer": "off",
1915
2043
  "node/prefer-global/process": "off",
1916
- "import-x/no-unresolved": "off",
1917
2044
  "unused-imports/no-unused-imports": "off",
1918
2045
  "unused-imports/no-unused-vars": "off",
1919
- "@typescript-eslint/comma-dangle": "off",
1920
- "@typescript-eslint/no-redeclare": "off",
1921
- "@typescript-eslint/no-namespace": "off",
1922
- "@typescript-eslint/no-unused-vars": "off",
1923
- "@typescript-eslint/no-require-imports": "off",
1924
- "@typescript-eslint/no-extraneous-class": "off",
1925
- "@typescript-eslint/no-use-before-define": "off",
1926
- "@typescript-eslint/no-unused-expressions": "off",
1927
- "@typescript-eslint/consistent-type-imports": "off",
1928
2046
  // disable all type-aware rules of @typescript-eslint
1929
2047
  ...configs.disableTypeChecked.rules,
1930
2048
  // Overrides rules
@@ -2008,6 +2126,100 @@ var configPrettier = (options = {}) => {
2008
2126
  ];
2009
2127
  };
2010
2128
 
2129
+ // src/configs/specials.ts
2130
+ import globals from "globals";
2131
+ var configSpecials = (options = {}) => {
2132
+ const {
2133
+ // Enable shadcn-vue support
2134
+ shadcnVue: enableShadcnVue = hasShadcnVue()
2135
+ } = options;
2136
+ const configs2 = [
2137
+ {
2138
+ name: "ntnyq/specials/scripts",
2139
+ files: [`**/scripts/${GLOB_SRC}`],
2140
+ rules: {
2141
+ "@typescript-eslint/explicit-function-return-type": "off",
2142
+ "no-console": "off",
2143
+ // Overrides rules
2144
+ ...options.overridesScriptsRules
2145
+ }
2146
+ },
2147
+ {
2148
+ name: "ntnyq/specials/cli",
2149
+ files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
2150
+ rules: {
2151
+ "@typescript-eslint/explicit-function-return-type": "off",
2152
+ "no-console": "off",
2153
+ // Overrides rules
2154
+ ...options.overridesCliRules
2155
+ }
2156
+ },
2157
+ {
2158
+ name: "ntnyq/specials/userscript",
2159
+ files: [`**/*.user.${GLOB_SRC_EXT}`],
2160
+ languageOptions: {
2161
+ globals: {
2162
+ ...globals.greasemonkey
2163
+ }
2164
+ },
2165
+ rules: {
2166
+ camelcase: [
2167
+ "error",
2168
+ {
2169
+ allow: ["^GM_.+"]
2170
+ }
2171
+ ],
2172
+ // Overrides rules
2173
+ ...options.overridesUserScriptsRules
2174
+ }
2175
+ },
2176
+ {
2177
+ name: "ntnyq/specials/config-file",
2178
+ files: [`**/*.config*.${GLOB_SRC_EXT}`],
2179
+ plugins: {
2180
+ "import-x": default16,
2181
+ perfectionist: default21
2182
+ },
2183
+ rules: {
2184
+ "@typescript-eslint/explicit-function-return-type": "off",
2185
+ "import-x/no-default-export": "off",
2186
+ "no-console": "off",
2187
+ "perfectionist/sort-objects": [
2188
+ "error",
2189
+ {
2190
+ ...PERFECTIONIST_COMMON_RULE_OPTIONS,
2191
+ ...PERFECTIONIST_EXTRA_RULE_OPTIONS,
2192
+ groups: PERFECTIONIST_SORT_OBJECTS_GROUPS
2193
+ }
2194
+ ],
2195
+ ...options.overridesConfigFileRules
2196
+ }
2197
+ }
2198
+ ];
2199
+ if (enableShadcnVue) {
2200
+ const shadcnOptions = resolveSubOptions(options, "shadcnVue");
2201
+ configs2.push({
2202
+ name: "ntnyq/specials/shadcn-vue",
2203
+ files: shadcnOptions.files || [
2204
+ "**/components/ui/**/*.ts",
2205
+ "**/components/ui/**/*.vue"
2206
+ ],
2207
+ rules: {
2208
+ "@typescript-eslint/consistent-type-imports": "off",
2209
+ "@typescript-eslint/no-unused-vars": "off",
2210
+ "import-x/consistent-type-specifier-style": "off",
2211
+ "vue/define-emits-declaration": "off",
2212
+ // Overrides rules
2213
+ ...shadcnOptions.overridesRules
2214
+ }
2215
+ });
2216
+ }
2217
+ if (options.specialCaseConfigs) {
2218
+ configs2.push(...options.specialCaseConfigs);
2219
+ }
2220
+ return configs2;
2221
+ };
2222
+
2011
2223
  // src/configs/gitignore.ts
2012
2224
  import createGitIgnoreConfig from "eslint-config-flat-gitignore";
2013
2225
  var configGitIgnore = (options = {}) => {
@@ -2025,25 +2237,25 @@ import jsConfig from "@eslint/js";
2025
2237
  import globals2 from "globals";
2026
2238
  var strictRules = {
2027
2239
  complexity: ["error", { max: 30 }],
2028
- "max-params": ["error", { max: 5 }],
2029
2240
  "max-depth": ["error", { max: 5 }],
2030
- "max-nested-callbacks": ["error", { max: 10 }],
2031
2241
  "max-lines": [
2032
2242
  "error",
2033
2243
  {
2034
2244
  max: 1e3,
2035
- skipComments: true,
2036
- skipBlankLines: true
2245
+ skipBlankLines: true,
2246
+ skipComments: true
2037
2247
  }
2038
2248
  ],
2039
2249
  "max-lines-per-function": [
2040
2250
  "error",
2041
2251
  {
2042
2252
  max: 200,
2043
- skipComments: true,
2044
- skipBlankLines: true
2253
+ skipBlankLines: true,
2254
+ skipComments: true
2045
2255
  }
2046
- ]
2256
+ ],
2257
+ "max-nested-callbacks": ["error", { max: 10 }],
2258
+ "max-params": ["error", { max: 5 }]
2047
2259
  };
2048
2260
  var configJavaScript = (options = {}) => [
2049
2261
  {
@@ -2053,44 +2265,50 @@ var configJavaScript = (options = {}) => [
2053
2265
  {
2054
2266
  name: "ntnyq/js/core",
2055
2267
  languageOptions: {
2268
+ sourceType: "module",
2056
2269
  globals: {
2057
2270
  ...globals2.browser,
2058
2271
  ...globals2.es2021,
2059
2272
  ...globals2.node
2060
- },
2061
- sourceType: "module"
2273
+ }
2062
2274
  },
2063
2275
  rules: {
2064
- "require-await": "off",
2276
+ "consistent-return": "off",
2065
2277
  "no-return-assign": "off",
2066
2278
  "no-useless-escape": "off",
2067
- "consistent-return": "off",
2279
+ "require-await": "off",
2068
2280
  // disabled in favor of `perfectionist/sort-named-imports`
2069
2281
  "sort-imports": "off",
2070
2282
  // standard v17.0.0
2071
2283
  "accessor-pairs": [
2072
2284
  "error",
2073
- { setWithoutGet: true, enforceForClassMembers: true }
2285
+ { enforceForClassMembers: true, setWithoutGet: true }
2074
2286
  ],
2287
+ "array-callback-return": "error",
2288
+ "block-scoped-var": "error",
2075
2289
  camelcase: [
2076
2290
  "error",
2077
2291
  {
2078
2292
  allow: ["^UNSAFE_"],
2079
- properties: "never",
2080
- ignoreGlobals: true
2293
+ ignoreGlobals: true,
2294
+ properties: "never"
2081
2295
  }
2082
2296
  ],
2083
2297
  "constructor-super": "error",
2084
2298
  curly: ["error", "multi-line"],
2085
2299
  "default-case-last": "error",
2086
2300
  "dot-notation": ["error", { allowKeywords: true }],
2301
+ // best-practice
2302
+ eqeqeq: ["error", "smart"],
2087
2303
  "new-cap": [
2088
2304
  "error",
2089
- { newIsCap: true, capIsNew: false, properties: true }
2305
+ { capIsNew: false, newIsCap: true, properties: true }
2090
2306
  ],
2307
+ "no-alert": "error",
2091
2308
  "no-array-constructor": "error",
2092
2309
  "no-async-promise-executor": "error",
2093
2310
  "no-caller": "error",
2311
+ "no-case-declarations": "error",
2094
2312
  "no-class-assign": "error",
2095
2313
  "no-compare-neg-zero": "error",
2096
2314
  "no-cond-assign": "error",
@@ -2103,10 +2321,10 @@ var configJavaScript = (options = {}) => [
2103
2321
  "no-dupe-class-members": "error",
2104
2322
  "no-dupe-keys": "error",
2105
2323
  "no-duplicate-case": "error",
2106
- "no-useless-backreference": "error",
2107
2324
  "no-empty": ["error", { allowEmptyCatch: true }],
2108
2325
  "no-empty-character-class": "error",
2109
2326
  "no-empty-pattern": "error",
2327
+ "no-empty-static-block": "error",
2110
2328
  "no-eval": "error",
2111
2329
  "no-ex-assign": "error",
2112
2330
  "no-extend-native": "error",
@@ -2124,15 +2342,16 @@ var configJavaScript = (options = {}) => [
2124
2342
  "no-lone-blocks": "error",
2125
2343
  "no-loss-of-precision": "error",
2126
2344
  "no-misleading-character-class": "error",
2127
- "no-prototype-builtins": "error",
2128
- "no-useless-catch": "error",
2345
+ "no-multi-str": "error",
2129
2346
  "no-new": "error",
2130
2347
  "no-new-func": "error",
2348
+ "no-new-native-nonconstructor": "error",
2131
2349
  "no-new-wrappers": "error",
2132
2350
  "no-obj-calls": "error",
2133
2351
  "no-octal": "error",
2134
2352
  "no-octal-escape": "error",
2135
2353
  "no-proto": "error",
2354
+ "no-prototype-builtins": "error",
2136
2355
  "no-redeclare": ["error", { builtinGlobals: false }],
2137
2356
  "no-regex-spaces": "error",
2138
2357
  "no-self-assign": ["error", { props: true }],
@@ -2156,8 +2375,8 @@ var configJavaScript = (options = {}) => [
2156
2375
  "error",
2157
2376
  {
2158
2377
  allowShortCircuit: true,
2159
- allowTernary: true,
2160
- allowTaggedTemplates: true
2378
+ allowTaggedTemplates: true,
2379
+ allowTernary: true
2161
2380
  }
2162
2381
  ],
2163
2382
  "no-unused-vars": [
@@ -2169,38 +2388,35 @@ var configJavaScript = (options = {}) => [
2169
2388
  vars: "all"
2170
2389
  }
2171
2390
  ],
2391
+ "no-use-before-define": [
2392
+ "error",
2393
+ {
2394
+ allowNamedExports: false,
2395
+ classes: false,
2396
+ functions: false,
2397
+ variables: true
2398
+ }
2399
+ ],
2400
+ "no-useless-backreference": "error",
2172
2401
  "no-useless-call": "error",
2402
+ "no-useless-catch": "error",
2173
2403
  "no-useless-computed-key": "error",
2174
2404
  "no-useless-constructor": "error",
2175
2405
  "no-useless-rename": "error",
2176
2406
  "no-useless-return": "error",
2177
- "prefer-promise-reject-errors": "error",
2178
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
2179
- "symbol-description": "error",
2180
- "unicode-bom": ["error", "never"],
2181
- "use-isnan": [
2182
- "error",
2183
- {
2184
- enforceForSwitchCase: true,
2185
- enforceForIndexOf: true
2186
- }
2187
- ],
2188
- "valid-typeof": ["error", { requireStringLiterals: true }],
2189
- yoda: ["error", "never"],
2190
2407
  // es6+
2191
2408
  "no-var": "error",
2192
- "prefer-rest-params": "error",
2193
- "prefer-spread": "error",
2194
- "prefer-template": "error",
2195
- "no-empty-static-block": "error",
2196
- "no-new-native-nonconstructor": "error",
2197
- "prefer-const": [
2409
+ "no-void": "error",
2410
+ "no-with": "error",
2411
+ "object-shorthand": [
2198
2412
  "error",
2413
+ "always",
2199
2414
  {
2200
- destructuring: "all",
2201
- ignoreReadBeforeAssign: true
2415
+ avoidQuotes: true,
2416
+ ignoreConstructors: false
2202
2417
  }
2203
2418
  ],
2419
+ "one-var": ["error", "never"],
2204
2420
  "prefer-arrow-callback": [
2205
2421
  "error",
2206
2422
  {
@@ -2208,34 +2424,30 @@ var configJavaScript = (options = {}) => [
2208
2424
  allowUnboundThis: true
2209
2425
  }
2210
2426
  ],
2211
- "object-shorthand": [
2427
+ "prefer-const": [
2212
2428
  "error",
2213
- "always",
2214
2429
  {
2215
- ignoreConstructors: false,
2216
- avoidQuotes: true
2430
+ destructuring: "all",
2431
+ ignoreReadBeforeAssign: true
2217
2432
  }
2218
2433
  ],
2219
- // best-practice
2220
- eqeqeq: ["error", "smart"],
2221
- "array-callback-return": "error",
2222
- "block-scoped-var": "error",
2223
- "no-alert": "error",
2224
- "no-case-declarations": "error",
2225
- "no-multi-str": "error",
2226
- "no-with": "error",
2227
- "no-void": "error",
2228
- "vars-on-top": "error",
2229
- "one-var": ["error", "never"],
2230
- "no-use-before-define": [
2434
+ "prefer-promise-reject-errors": "error",
2435
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
2436
+ "prefer-rest-params": "error",
2437
+ "prefer-spread": "error",
2438
+ "prefer-template": "error",
2439
+ "symbol-description": "error",
2440
+ "unicode-bom": ["error", "never"],
2441
+ "use-isnan": [
2231
2442
  "error",
2232
2443
  {
2233
- functions: false,
2234
- classes: false,
2235
- variables: true,
2236
- allowNamedExports: false
2444
+ enforceForIndexOf: true,
2445
+ enforceForSwitchCase: true
2237
2446
  }
2238
2447
  ],
2448
+ "valid-typeof": ["error", { requireStringLiterals: true }],
2449
+ "vars-on-top": "error",
2450
+ yoda: ["error", "never"],
2239
2451
  // Strict rules
2240
2452
  ...options.strict ? strictRules : {},
2241
2453
  // Overrides rules
@@ -2246,7 +2458,7 @@ var configJavaScript = (options = {}) => [
2246
2458
  var configJSX = () => [
2247
2459
  {
2248
2460
  name: "ntnyq/jsx",
2249
- files: ["**/*.jsx"],
2461
+ files: [GLOB_JSX_ONLY],
2250
2462
  languageOptions: {
2251
2463
  parserOptions: {
2252
2464
  ecmaFeatures: {
@@ -2260,36 +2472,36 @@ var configJSX = () => [
2260
2472
  // src/configs/typescript.ts
2261
2473
  import process4 from "node:process";
2262
2474
  var typeAwareRules = {
2475
+ // too strict
2476
+ "@typescript-eslint/strict-boolean-expressions": "off",
2263
2477
  "dot-notation": "off",
2264
- "require-await": "off",
2265
2478
  "no-implied-eval": "off",
2266
2479
  "no-throw-literal": "off",
2267
- // too strict
2268
- "@typescript-eslint/strict-boolean-expressions": "off",
2269
- "@typescript-eslint/require-await": "error",
2270
- "@typescript-eslint/unbound-method": "error",
2271
- "@typescript-eslint/no-unsafe-call": "error",
2480
+ "require-await": "off",
2272
2481
  "@typescript-eslint/await-thenable": "error",
2482
+ "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
2483
+ "@typescript-eslint/no-duplicate-type-constituents": "error",
2484
+ "@typescript-eslint/no-floating-promises": "error",
2273
2485
  "@typescript-eslint/no-for-in-array": "error",
2274
2486
  "@typescript-eslint/no-implied-eval": "error",
2275
- "@typescript-eslint/only-throw-error": "error",
2276
- "@typescript-eslint/no-unsafe-return": "error",
2487
+ "@typescript-eslint/no-misused-promises": "error",
2277
2488
  "@typescript-eslint/no-misused-spread": "error",
2489
+ "@typescript-eslint/no-redundant-type-constituents": "error",
2490
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
2278
2491
  "@typescript-eslint/no-unsafe-argument": "error",
2279
- "@typescript-eslint/no-misused-promises": "error",
2280
2492
  "@typescript-eslint/no-unsafe-assignment": "error",
2281
- "@typescript-eslint/no-floating-promises": "error",
2493
+ "@typescript-eslint/no-unsafe-call": "error",
2494
+ "@typescript-eslint/no-unsafe-member-access": "error",
2495
+ "@typescript-eslint/no-unsafe-return": "error",
2496
+ "@typescript-eslint/only-throw-error": "error",
2282
2497
  "@typescript-eslint/promise-function-async": "error",
2498
+ "@typescript-eslint/require-await": "error",
2283
2499
  "@typescript-eslint/restrict-plus-operands": "error",
2284
- "@typescript-eslint/triple-slash-reference": "error",
2285
- "@typescript-eslint/no-unsafe-member-access": "error",
2286
- "@typescript-eslint/switch-exhaustiveness-check": "error",
2287
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
2288
2500
  "@typescript-eslint/restrict-template-expressions": "error",
2289
- "@typescript-eslint/no-redundant-type-constituents": "error",
2290
- "@typescript-eslint/no-duplicate-type-constituents": "error",
2291
2501
  "@typescript-eslint/return-await": ["error", "in-try-catch"],
2292
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }]
2502
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
2503
+ "@typescript-eslint/triple-slash-reference": "error",
2504
+ "@typescript-eslint/unbound-method": "error"
2293
2505
  };
2294
2506
  var recommendedRules = configs.recommended.reduce(
2295
2507
  (rules, config) => {
@@ -2317,11 +2529,11 @@ var configTypeScript = (options = {}) => {
2317
2529
  extraFileExtensions: extensions.map((ext) => `.${ext}`),
2318
2530
  sourceType: "module",
2319
2531
  ...enableTypeAware ? {
2532
+ tsconfigRootDir: process4.cwd(),
2320
2533
  projectService: {
2321
2534
  allowDefaultProject: ["./*.js"],
2322
2535
  defaultProject: options.tsconfigPath
2323
- },
2324
- tsconfigRootDir: process4.cwd()
2536
+ }
2325
2537
  } : {},
2326
2538
  ...parserOptions
2327
2539
  };
@@ -2330,7 +2542,7 @@ var configTypeScript = (options = {}) => {
2330
2542
  files: files2,
2331
2543
  ignores: [...ignores],
2332
2544
  languageOptions: {
2333
- parser: parserTypeScript,
2545
+ parser,
2334
2546
  parserOptions: typescriptParserOptions
2335
2547
  }
2336
2548
  };
@@ -2341,7 +2553,7 @@ var configTypeScript = (options = {}) => {
2341
2553
  name: "ntnyq/ts/setup",
2342
2554
  plugins: {
2343
2555
  "@typescript-eslint": plugin,
2344
- antfu: default9
2556
+ antfu: default8
2345
2557
  }
2346
2558
  },
2347
2559
  ...enableTypeAwareLint ? [
@@ -2353,63 +2565,23 @@ var configTypeScript = (options = {}) => {
2353
2565
  files,
2354
2566
  rules: {
2355
2567
  ...recommendedRules,
2356
- "@typescript-eslint/no-namespace": "off",
2357
- "@typescript-eslint/no-explicit-any": "off",
2568
+ "@typescript-eslint/consistent-indexed-object-style": "off",
2569
+ "@typescript-eslint/explicit-function-return-type": "off",
2570
+ "@typescript-eslint/explicit-member-accessibility": "off",
2571
+ "@typescript-eslint/explicit-module-boundary-types": "off",
2358
2572
  "@typescript-eslint/naming-convention": "off",
2359
2573
  "@typescript-eslint/no-empty-function": "off",
2574
+ "@typescript-eslint/no-explicit-any": "off",
2575
+ "@typescript-eslint/no-namespace": "off",
2360
2576
  "@typescript-eslint/no-non-null-assertion": "off",
2361
2577
  "@typescript-eslint/triple-slash-reference": "off",
2362
- "@typescript-eslint/explicit-member-accessibility": "off",
2363
- "@typescript-eslint/explicit-function-return-type": "off",
2364
- "@typescript-eslint/explicit-module-boundary-types": "off",
2365
- "@typescript-eslint/consistent-indexed-object-style": "off",
2366
- "@typescript-eslint/prefer-as-const": "warn",
2578
+ "default-param-last": "off",
2367
2579
  // Disabled in favor of enhanced ts rules
2368
2580
  "no-redeclare": "off",
2369
2581
  "no-unused-vars": "off",
2370
- "default-param-last": "off",
2371
2582
  "no-use-before-define": "off",
2372
2583
  "no-useless-constructor": "off",
2373
- "@typescript-eslint/default-param-last": "error",
2374
- "@typescript-eslint/no-useless-constructor": "error",
2375
- "@typescript-eslint/no-redeclare": [
2376
- "error",
2377
- {
2378
- builtinGlobals: false,
2379
- ignoreDeclarationMerge: true
2380
- }
2381
- ],
2382
- "@typescript-eslint/no-use-before-define": [
2383
- "error",
2384
- {
2385
- functions: false,
2386
- classes: false,
2387
- variables: true,
2388
- allowNamedExports: false,
2389
- enums: true,
2390
- typedefs: false,
2391
- ignoreTypeReferences: false
2392
- }
2393
- ],
2394
- "@typescript-eslint/no-unused-vars": [
2395
- "error",
2396
- {
2397
- // Args after the last used will be reported
2398
- args: "after-used",
2399
- argsIgnorePattern: "^_",
2400
- caughtErrors: "all",
2401
- caughtErrorsIgnorePattern: "^_",
2402
- destructuredArrayIgnorePattern: "^_",
2403
- varsIgnorePattern: "^_",
2404
- ignoreRestSiblings: true
2405
- }
2406
- ],
2407
- // Extra rules
2408
- "@typescript-eslint/ban-tslint-comment": "error",
2409
- "@typescript-eslint/consistent-generic-constructors": [
2410
- "error",
2411
- "constructor"
2412
- ],
2584
+ "@typescript-eslint/prefer-as-const": "warn",
2413
2585
  "@typescript-eslint/ban-ts-comment": [
2414
2586
  "error",
2415
2587
  {
@@ -2420,22 +2592,28 @@ var configTypeScript = (options = {}) => {
2420
2592
  "ts-nocheck": "allow-with-description"
2421
2593
  }
2422
2594
  ],
2423
- "@typescript-eslint/no-unused-expressions": [
2595
+ // Extra rules
2596
+ "@typescript-eslint/ban-tslint-comment": "error",
2597
+ "@typescript-eslint/consistent-generic-constructors": [
2598
+ "error",
2599
+ "constructor"
2600
+ ],
2601
+ "@typescript-eslint/consistent-type-assertions": [
2424
2602
  "error",
2425
2603
  {
2426
- allowShortCircuit: true,
2427
- allowTernary: true,
2428
- allowTaggedTemplates: true
2604
+ assertionStyle: "as",
2605
+ objectLiteralTypeAssertions: "allow-as-parameter"
2429
2606
  }
2430
2607
  ],
2431
2608
  "@typescript-eslint/consistent-type-imports": [
2432
2609
  "error",
2433
2610
  {
2434
- prefer: "type-imports",
2611
+ disallowTypeAnnotations: false,
2435
2612
  fixStyle: "separate-type-imports",
2436
- disallowTypeAnnotations: false
2613
+ prefer: "type-imports"
2437
2614
  }
2438
2615
  ],
2616
+ "@typescript-eslint/default-param-last": "error",
2439
2617
  "@typescript-eslint/no-empty-object-type": [
2440
2618
  "error",
2441
2619
  {
@@ -2443,13 +2621,47 @@ var configTypeScript = (options = {}) => {
2443
2621
  allowObjectTypes: "always"
2444
2622
  }
2445
2623
  ],
2446
- "@typescript-eslint/consistent-type-assertions": [
2624
+ "@typescript-eslint/no-redeclare": [
2447
2625
  "error",
2448
2626
  {
2449
- assertionStyle: "as",
2450
- objectLiteralTypeAssertions: "allow-as-parameter"
2627
+ builtinGlobals: false,
2628
+ ignoreDeclarationMerge: true
2629
+ }
2630
+ ],
2631
+ "@typescript-eslint/no-unused-expressions": [
2632
+ "error",
2633
+ {
2634
+ allowShortCircuit: true,
2635
+ allowTaggedTemplates: true,
2636
+ allowTernary: true
2637
+ }
2638
+ ],
2639
+ "@typescript-eslint/no-unused-vars": [
2640
+ "error",
2641
+ {
2642
+ // Args after the last used will be reported
2643
+ args: "after-used",
2644
+ argsIgnorePattern: "^_",
2645
+ caughtErrors: "all",
2646
+ caughtErrorsIgnorePattern: "^_",
2647
+ destructuredArrayIgnorePattern: "^_",
2648
+ ignoreRestSiblings: true,
2649
+ varsIgnorePattern: "^_"
2650
+ }
2651
+ ],
2652
+ "@typescript-eslint/no-use-before-define": [
2653
+ "error",
2654
+ {
2655
+ allowNamedExports: false,
2656
+ classes: false,
2657
+ enums: true,
2658
+ functions: false,
2659
+ ignoreTypeReferences: false,
2660
+ typedefs: false,
2661
+ variables: true
2451
2662
  }
2452
2663
  ],
2664
+ "@typescript-eslint/no-useless-constructor": "error",
2453
2665
  // Overrides rules
2454
2666
  ...options.overrides
2455
2667
  }
@@ -2470,11 +2682,15 @@ var configTypeScript = (options = {}) => {
2470
2682
  name: "ntnyq/ts/types",
2471
2683
  files: [...GLOB_TYPES],
2472
2684
  rules: {
2473
- "no-use-before-define": "off",
2474
- "no-restricted-syntax": "off",
2475
- "import-x/no-duplicates": "off",
2685
+ "@typescript-eslint/no-use-before-define": "off",
2476
2686
  "import-x/newline-after-import": "off",
2477
- "@typescript-eslint/no-use-before-define": "off"
2687
+ "import-x/no-duplicates": "off",
2688
+ "no-restricted-syntax": "off",
2689
+ "no-use-before-define": "off",
2690
+ // `var` is special for type extend
2691
+ // e.g: extend globalThis
2692
+ "no-var": "off",
2693
+ "vars-on-top": "off"
2478
2694
  }
2479
2695
  }
2480
2696
  ];
@@ -2527,191 +2743,209 @@ var configGitHubAction = (options = {}) => {
2527
2743
  };
2528
2744
 
2529
2745
  // src/configs/perfectionist.ts
2530
- var INTERFACE_OR_OBJECT_TYPES_GROUPS = [
2531
- "required-property",
2532
- "optional-property",
2533
- "required-method",
2534
- "optional-method",
2535
- "required-multiline-property",
2536
- "optional-multiline-property",
2537
- "required-multiline-method",
2538
- "optional-multiline-method",
2539
- "unknown",
2540
- "index-signature",
2541
- "multiline-index-signature"
2542
- ];
2543
- var INTERSECTION_OR_UNION_TYPES_GROUPS = [
2544
- /**
2545
- * eg. 'foobar', 24, false
2546
- */
2547
- "literal",
2548
- /**
2549
- * eg. number, string
2550
- */
2551
- "keyword",
2552
- /**
2553
- * eg. FooBar
2554
- */
2555
- "named",
2556
- /**
2557
- * eg. Foo & Bar
2558
- */
2559
- "intersection",
2560
- /**
2561
- * eg. Foobar extends string ? Foo : Bar
2562
- */
2563
- "conditional",
2564
- /**
2565
- * eg. (...args: any[]) => void
2566
- */
2567
- "function",
2568
- /**
2569
- * eg. import('eslint').Linter
2570
- */
2571
- "import",
2572
- /**
2573
- * eg. { foo: string; bar: number; }
2574
- */
2575
- "object",
2576
- /**
2577
- * eg. keyof T
2578
- */
2579
- "operator",
2580
- /**
2581
- * eg. [string, number]
2582
- */
2583
- "tuple",
2584
- /**
2585
- * eg. Foo | Bar
2586
- */
2587
- "union",
2588
- /**
2589
- * eg. null | undefined
2590
- */
2591
- "nullish"
2592
- ];
2593
2746
  var configPerfectionist = (options = {}) => {
2594
2747
  const {
2595
- sortEnums: enableSortEnums = true,
2596
- sortTypes: enableSortTypes = true,
2748
+ partitionByComment = PERFECTIONIST_EXTRA_RULE_OPTIONS.partitionByComment,
2597
2749
  sortConstants: enableSortConstants = true,
2598
- partitionByComment = ["@pg", "@perfectionist-group"]
2750
+ sortEnums: enableSortEnums = true,
2751
+ sortTypes: enableSortTypes = true
2599
2752
  } = options;
2600
- function getCommonRuleOptions(options2 = {}) {
2601
- const ruleOptions = {
2602
- type: "alphabetical",
2603
- order: "asc",
2604
- ignoreCase: true,
2605
- ...options2.disableNewlinesBetween ? {} : { newlinesBetween: "ignore" },
2606
- ...options2.disableNewlinesBetween ? {} : { partitionByComment }
2607
- };
2608
- return ruleOptions;
2609
- }
2753
+ const commonRuleOptions = {
2754
+ ...PERFECTIONIST_COMMON_RULE_OPTIONS
2755
+ };
2756
+ const commonRuleOptionsWithNewlinesBetween = {
2757
+ ...commonRuleOptions,
2758
+ newlinesBetween: "ignore"
2759
+ };
2760
+ const commonRuleOptionsWithPartitionByComment = {
2761
+ ...commonRuleOptions,
2762
+ partitionByComment
2763
+ };
2764
+ const commonRuleOptionsWithBoth = {
2765
+ ...commonRuleOptionsWithNewlinesBetween,
2766
+ ...commonRuleOptionsWithPartitionByComment
2767
+ };
2768
+ const commonRules = {
2769
+ "perfectionist/sort-exports": [
2770
+ "error",
2771
+ {
2772
+ ...commonRuleOptionsWithPartitionByComment,
2773
+ groupKind: "values-first",
2774
+ type: "line-length"
2775
+ }
2776
+ ],
2777
+ "perfectionist/sort-imports": [
2778
+ "error",
2779
+ {
2780
+ ...commonRuleOptionsWithBoth,
2781
+ groups: PERFECTIONIST_SORT_IMPORTS_GROUPS,
2782
+ internalPattern: ["^~/.+", "^@/.+", "^#.+"]
2783
+ }
2784
+ ],
2785
+ "perfectionist/sort-named-exports": [
2786
+ "error",
2787
+ {
2788
+ ...commonRuleOptionsWithPartitionByComment,
2789
+ groupKind: "values-first",
2790
+ ignoreAlias: false
2791
+ }
2792
+ ],
2793
+ "perfectionist/sort-named-imports": [
2794
+ "error",
2795
+ {
2796
+ ...commonRuleOptionsWithPartitionByComment,
2797
+ groupKind: "values-first",
2798
+ ignoreAlias: false
2799
+ }
2800
+ ]
2801
+ };
2802
+ const sharedRules2 = {
2803
+ "perfectionist/sort-enums": [
2804
+ "error",
2805
+ {
2806
+ ...commonRuleOptionsWithBoth
2807
+ }
2808
+ ]
2809
+ };
2810
+ const sortEnumsRules = {
2811
+ "perfectionist/sort-modules": [
2812
+ "error",
2813
+ {
2814
+ ...commonRuleOptionsWithBoth
2815
+ }
2816
+ ]
2817
+ };
2818
+ const sortTypesRules = {
2819
+ "perfectionist/sort-heritage-clauses": [
2820
+ "error",
2821
+ {
2822
+ ...commonRuleOptions
2823
+ }
2824
+ ],
2825
+ "perfectionist/sort-interfaces": [
2826
+ "error",
2827
+ {
2828
+ ...commonRuleOptionsWithBoth,
2829
+ groups: PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS
2830
+ }
2831
+ ],
2832
+ "perfectionist/sort-intersection-types": [
2833
+ "error",
2834
+ {
2835
+ ...commonRuleOptionsWithBoth,
2836
+ groups: PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS
2837
+ }
2838
+ ],
2839
+ "perfectionist/sort-object-types": [
2840
+ "error",
2841
+ {
2842
+ ...commonRuleOptionsWithBoth,
2843
+ groups: PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS
2844
+ }
2845
+ ],
2846
+ "perfectionist/sort-union-types": [
2847
+ "error",
2848
+ {
2849
+ ...commonRuleOptionsWithBoth,
2850
+ groups: PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS
2851
+ }
2852
+ ]
2853
+ };
2854
+ const sortConstantsRules = {
2855
+ "perfectionist/sort-maps": [
2856
+ "error",
2857
+ {
2858
+ ...commonRuleOptionsWithBoth
2859
+ }
2860
+ ],
2861
+ "perfectionist/sort-objects": [
2862
+ "error",
2863
+ {
2864
+ ...commonRuleOptionsWithBoth,
2865
+ groups: PERFECTIONIST_SORT_OBJECTS_GROUPS
2866
+ }
2867
+ ],
2868
+ "perfectionist/sort-sets": [
2869
+ "error",
2870
+ {
2871
+ ...commonRuleOptionsWithBoth
2872
+ }
2873
+ ]
2874
+ };
2875
+ const extraRules = {
2876
+ "perfectionist/sort-array-includes": [
2877
+ "error",
2878
+ {
2879
+ ...commonRuleOptionsWithBoth,
2880
+ groups: ["literal", "spread"]
2881
+ }
2882
+ ],
2883
+ "perfectionist/sort-classes": [
2884
+ "error",
2885
+ {
2886
+ ...commonRuleOptionsWithBoth,
2887
+ groups: PERFECTIONIST_SORT_CLASSES_GROUPS
2888
+ }
2889
+ ],
2890
+ "perfectionist/sort-decorators": [
2891
+ "error",
2892
+ {
2893
+ ...commonRuleOptionsWithPartitionByComment
2894
+ }
2895
+ ],
2896
+ "perfectionist/sort-jsx-props": [
2897
+ "error",
2898
+ {
2899
+ ...commonRuleOptions,
2900
+ groups: ["shorthand", "multiline", "unknown"]
2901
+ }
2902
+ ],
2903
+ "perfectionist/sort-switch-case": [
2904
+ "error",
2905
+ {
2906
+ ...commonRuleOptions
2907
+ }
2908
+ ],
2909
+ "perfectionist/sort-variable-declarations": [
2910
+ "error",
2911
+ {
2912
+ ...commonRuleOptionsWithPartitionByComment
2913
+ }
2914
+ ]
2915
+ };
2610
2916
  const configs2 = [
2611
2917
  {
2612
- name: "ntnyq/perfectionist/common",
2918
+ name: options.all ? "ntnyq/perfectionist/all" : "ntnyq/perfectionist/common",
2613
2919
  plugins: {
2614
- perfectionist: default20
2920
+ perfectionist: default21
2615
2921
  },
2616
2922
  rules: {
2617
- "perfectionist/sort-imports": [
2618
- "error",
2619
- {
2620
- ...getCommonRuleOptions(),
2621
- groups: [
2622
- // Side effect style imports (e.g. 'normalize.css')
2623
- "side-effect-style",
2624
- // Styles (e.g. *.{css,scss,less})
2625
- "style",
2626
- // Node.js built-in modules. (e.g. fs, path)
2627
- "builtin",
2628
- // External modules installed in the project (e.g. vue, lodash)
2629
- "external",
2630
- // Internal modules (e.g. @/utils, @/components)
2631
- "internal",
2632
- // Modules from parent directory (e.g. ../utils)
2633
- "parent",
2634
- // Modules from the same directory (e.g. ./utils)
2635
- "sibling",
2636
- // Main file from the current directory (e.g. ./index)
2637
- "index",
2638
- // TypeScript object-imports (e.g. import log = console.log)
2639
- "object",
2640
- // Side effect imports (e.g. import 'babel-polyfill')
2641
- "side-effect",
2642
- /**
2643
- * Type import at the end
2644
- */
2645
- "builtin-type",
2646
- "external-type",
2647
- "internal-type",
2648
- "parent-type",
2649
- "sibling-type",
2650
- "index-type",
2651
- "type",
2652
- /**
2653
- * Imports that don’t fit into any other group
2654
- */
2655
- "unknown"
2656
- ],
2657
- internalPattern: ["^~/.+", "^@/.+", "^#.+"]
2658
- }
2659
- ],
2660
- "perfectionist/sort-exports": [
2661
- "error",
2662
- {
2663
- ...getCommonRuleOptions({
2664
- disableNewlinesBetween: true
2665
- }),
2666
- type: "line-length",
2667
- groupKind: "values-first"
2668
- }
2669
- ],
2670
- "perfectionist/sort-named-exports": [
2671
- "error",
2672
- {
2673
- ...getCommonRuleOptions({
2674
- disableNewlinesBetween: true
2675
- }),
2676
- ignoreAlias: false,
2677
- groupKind: "values-first"
2678
- }
2679
- ],
2680
- "perfectionist/sort-named-imports": [
2681
- "error",
2682
- {
2683
- ...getCommonRuleOptions({
2684
- disableNewlinesBetween: true
2685
- }),
2686
- ignoreAlias: false,
2687
- groupKind: "values-first"
2688
- }
2689
- ],
2923
+ ...commonRules,
2924
+ ...options.all ? {
2925
+ ...sharedRules2,
2926
+ ...sortEnumsRules,
2927
+ ...sortTypesRules,
2928
+ ...sortConstantsRules,
2929
+ ...extraRules
2930
+ } : {},
2690
2931
  // Overrides rules
2691
2932
  ...options.overrides
2692
2933
  }
2693
2934
  }
2694
2935
  ];
2936
+ if (options.all) {
2937
+ return configs2;
2938
+ }
2695
2939
  if (enableSortEnums) {
2696
2940
  configs2.push({
2697
2941
  name: "ntnyq/perfectionist/enums",
2698
2942
  files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
2699
2943
  plugins: {
2700
- perfectionist: default20
2944
+ perfectionist: default21
2701
2945
  },
2702
2946
  rules: {
2703
- "perfectionist/sort-enums": [
2704
- "error",
2705
- {
2706
- ...getCommonRuleOptions()
2707
- }
2708
- ],
2709
- "perfectionist/sort-modules": [
2710
- "error",
2711
- {
2712
- ...getCommonRuleOptions()
2713
- }
2714
- ],
2947
+ ...sharedRules2,
2948
+ ...sortEnumsRules,
2715
2949
  // Overrides rules
2716
2950
  ...options.overridesEnumsRules
2717
2951
  }
@@ -2722,52 +2956,11 @@ var configPerfectionist = (options = {}) => {
2722
2956
  name: "ntnyq/perfectionist/types",
2723
2957
  files: [...GLOB_TYPES],
2724
2958
  plugins: {
2725
- perfectionist: default20
2959
+ perfectionist: default21
2726
2960
  },
2727
2961
  rules: {
2728
- "perfectionist/sort-heritage-clauses": [
2729
- "error",
2730
- {
2731
- ...getCommonRuleOptions({
2732
- disableNewlinesBetween: true,
2733
- disablePartitionByComment: true
2734
- })
2735
- }
2736
- ],
2737
- "perfectionist/sort-interfaces": [
2738
- "error",
2739
- {
2740
- ...getCommonRuleOptions(),
2741
- groups: INTERFACE_OR_OBJECT_TYPES_GROUPS
2742
- }
2743
- ],
2744
- "perfectionist/sort-intersection-types": [
2745
- "error",
2746
- {
2747
- ...getCommonRuleOptions(),
2748
- groups: INTERSECTION_OR_UNION_TYPES_GROUPS
2749
- }
2750
- ],
2751
- "perfectionist/sort-modules": [
2752
- "error",
2753
- {
2754
- ...getCommonRuleOptions()
2755
- }
2756
- ],
2757
- "perfectionist/sort-object-types": [
2758
- "error",
2759
- {
2760
- ...getCommonRuleOptions(),
2761
- groups: INTERFACE_OR_OBJECT_TYPES_GROUPS
2762
- }
2763
- ],
2764
- "perfectionist/sort-union-types": [
2765
- "error",
2766
- {
2767
- ...getCommonRuleOptions(),
2768
- groups: INTERSECTION_OR_UNION_TYPES_GROUPS
2769
- }
2770
- ],
2962
+ ...sharedRules2,
2963
+ ...sortTypesRules,
2771
2964
  // Overrides rules
2772
2965
  ...options.overridesTypesRules
2773
2966
  }
@@ -2778,40 +2971,11 @@ var configPerfectionist = (options = {}) => {
2778
2971
  name: "ntnyq/perfectionist/constants",
2779
2972
  files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
2780
2973
  plugins: {
2781
- perfectionist: default20
2974
+ perfectionist: default21
2782
2975
  },
2783
2976
  rules: {
2784
- "perfectionist/sort-maps": [
2785
- "error",
2786
- {
2787
- ...getCommonRuleOptions()
2788
- }
2789
- ],
2790
- "perfectionist/sort-objects": [
2791
- "error",
2792
- {
2793
- ...getCommonRuleOptions(),
2794
- groups: [
2795
- "property",
2796
- "multiline-property",
2797
- "method",
2798
- "multiline-method",
2799
- "unknown"
2800
- ]
2801
- }
2802
- ],
2803
- "perfectionist/sort-sets": [
2804
- "error",
2805
- {
2806
- ...getCommonRuleOptions()
2807
- }
2808
- ],
2809
- "perfectionist/sort-modules": [
2810
- "error",
2811
- {
2812
- ...getCommonRuleOptions()
2813
- }
2814
- ],
2977
+ ...sharedRules2,
2978
+ ...sortConstantsRules,
2815
2979
  // Overrides rules
2816
2980
  ...options.overridesConstantsRules
2817
2981
  }
@@ -2825,7 +2989,7 @@ var configUnusedImports = (options = {}) => [
2825
2989
  {
2826
2990
  name: "ntnyq/unused-imports",
2827
2991
  plugins: {
2828
- "unused-imports": default21
2992
+ "unused-imports": default22
2829
2993
  },
2830
2994
  rules: {
2831
2995
  "@typescript-eslint/no-unused-vars": "off",
@@ -2833,14 +2997,14 @@ var configUnusedImports = (options = {}) => [
2833
2997
  "unused-imports/no-unused-vars": [
2834
2998
  "error",
2835
2999
  {
2836
- vars: "all",
2837
- varsIgnorePattern: "^_",
2838
3000
  args: "after-used",
2839
3001
  argsIgnorePattern: "^_",
2840
- ignoreRestSiblings: true,
2841
- destructuredArrayIgnorePattern: "^_",
2842
3002
  caughtErrors: "all",
2843
- caughtErrorsIgnorePattern: "^_"
3003
+ caughtErrorsIgnorePattern: "^_",
3004
+ destructuredArrayIgnorePattern: "^_",
3005
+ ignoreRestSiblings: true,
3006
+ vars: "all",
3007
+ varsIgnorePattern: "^_"
2844
3008
  }
2845
3009
  ],
2846
3010
  // Overrides rules
@@ -2854,10 +3018,10 @@ var configESLintComments = (options = {}) => [
2854
3018
  {
2855
3019
  name: "ntnyq/eslint-comments",
2856
3020
  plugins: {
2857
- "@eslint-community/eslint-comments": default22
3021
+ "@eslint-community/eslint-comments": default23
2858
3022
  },
2859
3023
  rules: {
2860
- ...default22.configs.recommended.rules,
3024
+ ...default23.configs.recommended.rules,
2861
3025
  "@eslint-community/eslint-comments/disable-enable-pair": [
2862
3026
  "error",
2863
3027
  { allowWholeFile: true }
@@ -2895,6 +3059,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2895
3059
  depend: enableDepend = true,
2896
3060
  regexp: enableRegexp = true,
2897
3061
  unicorn: enableUnicorn = true,
3062
+ deMorgan: enableDeMorgan = true,
2898
3063
  prettier: enablePrettier = true,
2899
3064
  markdown: enableMarkdown = true,
2900
3065
  gitignore: enableGitIgnore = true,
@@ -2959,6 +3124,13 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2959
3124
  })
2960
3125
  );
2961
3126
  }
3127
+ if (enableDeMorgan) {
3128
+ configs2.push(
3129
+ configDeMorgan({
3130
+ overrides: getOverrides(options, "deMorgan")
3131
+ })
3132
+ );
3133
+ }
2962
3134
  if (enableRegexp) {
2963
3135
  configs2.push(
2964
3136
  configRegexp({
@@ -2988,6 +3160,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2988
3160
  if (enableYML) {
2989
3161
  configs2.push(
2990
3162
  configYml({
3163
+ ...resolveSubOptions(options, "yml"),
2991
3164
  overrides: getOverrides(options, "yml")
2992
3165
  })
2993
3166
  );
@@ -2995,6 +3168,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2995
3168
  if (enableTOML) {
2996
3169
  configs2.push(
2997
3170
  configToml({
3171
+ ...resolveSubOptions(options, "toml"),
2998
3172
  overrides: getOverrides(options, "toml")
2999
3173
  })
3000
3174
  );
@@ -3002,6 +3176,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3002
3176
  if (enableJSONC) {
3003
3177
  configs2.push(
3004
3178
  configJsonc({
3179
+ ...resolveSubOptions(options, "jsonc"),
3005
3180
  overrides: getOverrides(options, "jsonc")
3006
3181
  })
3007
3182
  );
@@ -3086,7 +3261,6 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3086
3261
  return composer;
3087
3262
  }
3088
3263
  export {
3089
- DEFAULT_PRETTIER_OPTIONS,
3090
3264
  GLOB_ALL_SRC,
3091
3265
  GLOB_ASTRO,
3092
3266
  GLOB_ASTRO_TS,
@@ -3101,6 +3275,7 @@ export {
3101
3275
  GLOB_JSON5,
3102
3276
  GLOB_JSONC,
3103
3277
  GLOB_JSX,
3278
+ GLOB_JSX_ONLY,
3104
3279
  GLOB_LESS,
3105
3280
  GLOB_LOCKFILE,
3106
3281
  GLOB_MARKDOWN,
@@ -3119,13 +3294,25 @@ export {
3119
3294
  GLOB_TEST,
3120
3295
  GLOB_TOML,
3121
3296
  GLOB_TS,
3297
+ GLOB_TSCONFIG_JSON,
3122
3298
  GLOB_TSX,
3299
+ GLOB_TSX_ONLY,
3123
3300
  GLOB_TYPES,
3301
+ GLOB_TYPE_TEST,
3124
3302
  GLOB_VUE,
3125
3303
  GLOB_YAML,
3304
+ PERFECTIONIST_COMMON_RULE_OPTIONS,
3305
+ PERFECTIONIST_EXTRA_RULE_OPTIONS,
3306
+ PERFECTIONIST_SORT_CLASSES_GROUPS,
3307
+ PERFECTIONIST_SORT_IMPORTS_GROUPS,
3308
+ PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS,
3309
+ PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS,
3310
+ PERFECTIONIST_SORT_OBJECTS_GROUPS,
3311
+ PRETTIER_DEFAULT_OPTIONS,
3126
3312
  combineConfigs,
3127
3313
  configAntfu,
3128
3314
  configCommand,
3315
+ configDeMorgan,
3129
3316
  configDepend,
3130
3317
  configESLintComments,
3131
3318
  configESLintPlugin,
@@ -3156,7 +3343,7 @@ export {
3156
3343
  configUnusedImports,
3157
3344
  configVue,
3158
3345
  configYml,
3159
- configs as configsTypescript,
3346
+ configs as configsTypeScript,
3160
3347
  createNodeResolver,
3161
3348
  createTypeScriptImportResolver,
3162
3349
  defineESLintConfig,
@@ -3175,22 +3362,23 @@ export {
3175
3362
  parserJsonc,
3176
3363
  parserPlain,
3177
3364
  parserToml,
3178
- parserTypeScript,
3365
+ parser as parserTypeScript,
3179
3366
  parserVue,
3180
3367
  parserYaml,
3181
- default9 as pluginAntfu,
3182
- default22 as pluginComments,
3368
+ default8 as pluginAntfu,
3369
+ default23 as pluginComments,
3370
+ default18 as pluginDeMorgan,
3183
3371
  pluginDepend,
3184
3372
  default12 as pluginFormat,
3185
- default19 as pluginGitHubAction,
3373
+ default20 as pluginGitHubAction,
3186
3374
  default16 as pluginImportX,
3187
- default10 as pluginJsdoc,
3188
- default11 as pluginJsonc,
3189
- default8 as pluginMarkdown,
3190
- default18 as pluginNoOnlyTests,
3375
+ default9 as pluginJsdoc,
3376
+ default10 as pluginJsonc,
3377
+ default7 as pluginMarkdown,
3378
+ default19 as pluginNoOnlyTests,
3191
3379
  default2 as pluginNode,
3192
- default20 as pluginPerfectionist,
3193
- default7 as pluginPinia,
3380
+ default21 as pluginPerfectionist,
3381
+ default11 as pluginPinia,
3194
3382
  default17 as pluginPrettier,
3195
3383
  pluginRegexp,
3196
3384
  default5 as pluginSvgo,
@@ -3198,12 +3386,12 @@ export {
3198
3386
  plugin as pluginTypeScript,
3199
3387
  default15 as pluginUnicorn,
3200
3388
  default13 as pluginUnoCSS,
3201
- default21 as pluginUnusedImports,
3389
+ default22 as pluginUnusedImports,
3202
3390
  default14 as pluginVitest,
3203
3391
  default3 as pluginVue,
3204
3392
  default4 as pluginYml,
3205
3393
  processorPassThrough,
3206
- default23 as processorVueBlocks,
3394
+ default24 as processorVueBlocks,
3207
3395
  resolveSubOptions,
3208
3396
  toArray
3209
3397
  };