@ntnyq/eslint-config 3.12.3 → 4.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,56 +35,62 @@ 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";
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";
50
+ import { default as default12 } from "eslint-plugin-ntnyq";
51
+ import { default as default13 } from "eslint-plugin-format";
48
52
  import { plugin } from "typescript-eslint";
49
- import { default as default12 } from "eslint-plugin-format";
50
- import { default as default13 } from "@unocss/eslint-plugin";
51
- import { default as default14 } from "@vitest/eslint-plugin";
52
- import { default as default15 } from "eslint-plugin-unicorn";
53
- import { default as default16 } from "eslint-plugin-import-x";
54
- import { default as default17 } from "eslint-plugin-prettier";
55
- import { default as default18 } from "eslint-plugin-github-action";
56
- import { default as default19 } from "eslint-plugin-perfectionist";
57
- import { default as default20 } from "eslint-plugin-unused-imports";
58
- import { default as default21 } from "@eslint-community/eslint-plugin-eslint-comments";
59
-
60
- // src/eslint/configs.ts
61
- import { configs } from "typescript-eslint";
53
+ import { default as default14 } from "@unocss/eslint-plugin";
54
+ import { default as default15 } from "@vitest/eslint-plugin";
55
+ import { default as default16 } from "eslint-plugin-unicorn";
56
+ import { default as default17 } from "eslint-plugin-import-x";
57
+ import { default as default18 } from "eslint-plugin-prettier";
58
+ import { default as default19 } from "eslint-plugin-de-morgan";
59
+ import { default as default20 } from "eslint-plugin-no-only-tests";
60
+ import { default as default21 } from "eslint-plugin-github-action";
61
+ import { default as default22 } from "eslint-plugin-perfectionist";
62
+ import { default as default23 } from "eslint-plugin-unused-imports";
63
+ import { default as default24 } from "@eslint-community/eslint-plugin-eslint-comments";
62
64
 
63
65
  // src/eslint/resolvers.ts
64
66
  import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
65
- var createNodeResolver = default16.createNodeResolver;
67
+ var createNodeResolver = default17.createNodeResolver;
66
68
 
67
69
  // src/eslint/processors.ts
68
- import { mergeProcessors } from "eslint-merge-processors";
69
- import { processorPassThrough } from "eslint-merge-processors";
70
- import { default as default22 } from "eslint-processor-vue-blocks";
70
+ import { default as default25 } from "eslint-processor-vue-blocks";
71
+ import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
71
72
 
72
73
  // src/globs.ts
73
74
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
74
75
  var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
75
76
  var GLOB_JS = "**/*.?([cm])js";
76
77
  var GLOB_JSX = `${GLOB_JS}x`;
78
+ var GLOB_JSX_ONLY = "**/*.jsx";
77
79
  var GLOB_TS = "**/*.?([cm])ts";
78
80
  var GLOB_TSX = `${GLOB_TS}x`;
81
+ var GLOB_TSX_ONLY = "**/*.tsx";
79
82
  var GLOB_DTS = "**/*.d.?([cm])ts";
80
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
+ ];
81
88
  var GLOB_TEST = [
82
89
  `**/*.test.${GLOB_SRC_EXT}`,
83
90
  `**/*.spec.${GLOB_SRC_EXT}`,
84
91
  `**/*.bench.${GLOB_SRC_EXT}`,
85
- `**/*.benchmark.${GLOB_SRC_EXT}`
92
+ `**/*.benchmark.${GLOB_SRC_EXT}`,
93
+ ...GLOB_TYPE_TEST
86
94
  ];
87
95
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
88
96
  var GLOB_CSS = "**/*.css";
@@ -93,6 +101,7 @@ var GLOB_JSON = "**/*.json";
93
101
  var GLOB_JSON5 = "**/*.json5";
94
102
  var GLOB_JSONC = "**/*.jsonc";
95
103
  var GLOB_PACKAGE_JSON = "**/package.json";
104
+ var GLOB_TSCONFIG_JSON = ["**/tsconfig.json", "**/tsconfig.*.json"];
96
105
  var GLOB_SVG = "**/*.svg";
97
106
  var GLOB_VUE = "**/*.vue";
98
107
  var GLOB_YAML = "**/*.y?(a)ml";
@@ -123,7 +132,7 @@ var GLOB_LOCKFILE = [
123
132
  "**/package-lock.json",
124
133
  "**/yarn.lock",
125
134
  "**/pnpm-lock.yaml",
126
- "**/bun.lockb",
135
+ "**/bun.lock?(b)",
127
136
  "**/deno.lock"
128
137
  ];
129
138
  var GLOB_EXCLUDE = [
@@ -176,66 +185,52 @@ var GLOB_EXCLUDE = [
176
185
  ];
177
186
 
178
187
  // src/configs/vue.ts
179
- var vue2Rules = {
188
+ var sharedRules = {
180
189
  ...default3.configs.base.rules,
181
190
  ...default3.configs.essential.rules,
182
191
  ...default3.configs["strongly-recommended"].rules,
183
192
  ...default3.configs.recommended.rules
184
193
  };
185
- var vue3Rules = {
186
- ...default3.configs.base.rules,
187
- ...default3.configs["vue3-essential"].rules,
188
- ...default3.configs["vue3-strongly-recommended"].rules,
189
- ...default3.configs["vue3-recommended"].rules
190
- };
191
194
  var disabledRules = {
192
- "vue/no-v-html": "off",
193
- "vue/require-prop-types": "off",
194
- "vue/require-default-prop": "off",
195
195
  "vue/multi-word-component-names": "off",
196
+ "vue/no-setup-props-reactivity-loss": "off",
197
+ "vue/no-v-html": "off",
196
198
  "vue/no-v-text-v-html-on-component": "off",
197
- "vue/no-setup-props-reactivity-loss": "off"
199
+ "vue/require-default-prop": "off",
200
+ "vue/require-prop-types": "off"
198
201
  };
199
202
  var extensionRules = {
200
- "vue/prefer-template": "error",
201
- "vue/no-sparse-arrays": "error",
202
- "vue/no-empty-pattern": "error",
203
- "vue/space-infix-ops": "error",
204
- "vue/no-loss-of-precision": "error",
205
- "vue/no-constant-condition": "error",
206
- "vue/template-curly-spacing": "error",
207
- "vue/eqeqeq": ["error", "smart"],
208
- "vue/comma-style": ["error", "last"],
209
- "vue/block-spacing": ["error", "always"],
210
- "vue/dot-location": ["error", "property"],
211
- "vue/space-in-parens": ["error", "never"],
212
- "vue/operator-linebreak": ["error", "before"],
213
- "vue/no-extra-parens": ["error", "functions"],
214
203
  "vue/array-bracket-spacing": ["error", "never"],
215
- "vue/object-curly-spacing": ["error", "always"],
216
- "vue/comma-dangle": ["error", "always-multiline"],
217
- "vue/quote-props": ["error", "consistent-as-needed"],
218
- "vue/arrow-spacing": ["error", { before: true, after: true }],
204
+ "vue/arrow-spacing": ["error", { after: true, before: true }],
205
+ "vue/block-spacing": ["error", "always"],
219
206
  "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
220
- "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"],
221
211
  "vue/dot-notation": ["error", { allowKeywords: true }],
222
- "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
223
- "vue/keyword-spacing": ["error", { before: true, after: true }],
224
- "vue/no-restricted-syntax": ["error", "DebuggerStatement", "LabeledStatement", "WithStatement"],
225
- "vue/space-unary-ops": [
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
+ "vue/no-restricted-syntax": [
226
220
  "error",
227
- {
228
- words: true,
229
- nonwords: false
230
- }
221
+ "DebuggerStatement",
222
+ "LabeledStatement",
223
+ "WithStatement"
231
224
  ],
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,144 +241,162 @@ 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: ["defineProps", "defineEmits", "defineOptions", "defineSlots", "defineModel"],
356
- defineExposeLast: true
356
+ autofix: true
357
357
  }
358
358
  ],
359
- "vue/html-comment-content-spacing": [
359
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
360
+ "vue/no-static-inline-styles": [
360
361
  "error",
361
- "always",
362
362
  {
363
- exceptions: ["-"]
363
+ allowBinding: true
364
364
  }
365
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",
366
376
  "vue/require-macro-variable-name": [
367
377
  "error",
368
378
  {
369
- defineProps: "props",
370
379
  defineEmits: "emits",
380
+ defineProps: "props",
371
381
  defineSlots: "slots",
372
- useSlots: "slots",
373
- useAttrs: "attrs"
382
+ useAttrs: "attrs",
383
+ useSlots: "slots"
374
384
  }
375
- ]
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"
376
390
  };
377
- var vue = (options = {}) => {
378
- const isVue3 = options.vueVersion !== 2;
391
+ var configVue = (options = {}) => {
392
+ const { files = [GLOB_VUE] } = options;
379
393
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
380
- const { files: FILES_VUE = [GLOB_VUE] } = options;
381
394
  function getVueProcessor() {
382
395
  const processorVueSFC = default3.processors[".vue"];
383
396
  if (!sfcBlocks) return processorVueSFC;
384
397
  return mergeProcessors2([
385
398
  processorVueSFC,
386
- default22({
399
+ default25({
387
400
  ...sfcBlocks,
388
401
  blocks: {
389
402
  styles: true,
@@ -396,48 +409,32 @@ var vue = (options = {}) => {
396
409
  {
397
410
  name: "ntnyq/vue/setup",
398
411
  plugins: {
399
- vue: default3,
400
- "@typescript-eslint": plugin
412
+ "@typescript-eslint": plugin,
413
+ vue: default3
401
414
  }
402
415
  },
403
416
  {
404
417
  name: "ntnyq/vue/rules",
405
- files: [
406
- // File apply vue rules
407
- ...FILES_VUE
408
- ],
418
+ files,
419
+ processor: getVueProcessor(),
409
420
  languageOptions: {
410
421
  parser: parserVue,
411
422
  parserOptions: {
412
- sourceType: "module",
413
423
  ecmaVersion: "latest",
414
424
  extraFileExtensions: [".vue"],
415
- parser: parserTypeScript,
425
+ parser,
426
+ sourceType: "module",
416
427
  ecmaFeatures: {
417
428
  jsx: true
418
429
  }
419
430
  }
420
431
  },
421
- processor: getVueProcessor(),
422
432
  rules: {
423
- ...isVue3 ? vue3Rules : vue2Rules,
424
- "vue/html-self-closing": [
425
- "error",
426
- {
427
- html: {
428
- void: "always",
429
- normal: "always",
430
- component: "always"
431
- },
432
- svg: "always",
433
- math: "always"
434
- }
435
- ],
436
- "vue/this-in-template": ["error", "never"],
437
- "vue/prop-name-casing": ["error", "camelCase"],
433
+ ...sharedRules,
438
434
  "vue/attributes-order": [
439
435
  "error",
440
436
  {
437
+ alphabetical: false,
441
438
  order: [
442
439
  "EVENTS",
443
440
  // `@click="functionCall"`, `v-on="event"`
@@ -468,8 +465,26 @@ var vue = (options = {}) => {
468
465
  // `prop="foo", `static attributes
469
466
  "ATTR_SHORTHAND_BOOL"
470
467
  // `disabled`, prop shorthand
471
- ],
472
- 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
473
488
  }
474
489
  ],
475
490
  "vue/order-in-components": [
@@ -512,13 +527,8 @@ var vue = (options = {}) => {
512
527
  ]
513
528
  }
514
529
  ],
515
- "vue/max-attributes-per-line": [
516
- "error",
517
- {
518
- singleline: 1,
519
- multiline: 1
520
- }
521
- ],
530
+ "vue/prop-name-casing": ["error", "camelCase"],
531
+ "vue/this-in-template": ["error", "never"],
522
532
  ...disabledRules,
523
533
  ...extensionRules,
524
534
  ...unCategorizedRules,
@@ -530,161 +540,46 @@ var vue = (options = {}) => {
530
540
  };
531
541
 
532
542
  // src/configs/yml.ts
533
- var yml = (options = {}) => [
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
+ }
563
+ }
564
+ ];
565
+ };
566
+
567
+ // src/configs/node.ts
568
+ var configNode = (options = {}) => [
534
569
  {
535
- name: "ntnyq/yaml",
536
- files: [GLOB_YAML],
537
- languageOptions: {
538
- parser: parserYaml
539
- },
570
+ name: "ntnyq/node",
540
571
  plugins: {
541
- yml: default4
572
+ node: default2
542
573
  },
543
574
  rules: {
544
- ...default4.configs.standard.rules,
545
- ...default4.configs.prettier.rules,
546
- "yml/no-empty-mapping-value": "off",
547
- "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
548
- // Overrides rules
549
- ...options.overrides
550
- }
551
- }
552
- ];
553
-
554
- // src/utils/env.ts
555
- import { resolve } from "node:path";
556
- import process from "node:process";
557
- import { isPackageExists } from "local-pkg";
558
- var hasPinia = isPackageExists("pinia");
559
- var hasVitest = isPackageExists("vitest");
560
- var hasTypeScript = isPackageExists("typescript");
561
- var hasShadcnVue = isPackageExists("radix-vue") && isPackageExists("clsx");
562
- var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
563
- var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
564
- paths: [resolve(process.cwd(), "playground"), resolve(process.cwd(), "docs")]
565
- });
566
-
567
- // src/utils/toArray.ts
568
- function toArray(val) {
569
- val = val ?? [];
570
- return Array.isArray(val) ? val : [val];
571
- }
572
-
573
- // src/utils/resolveSubOptions.ts
574
- function resolveSubOptions(options, key) {
575
- return typeof options[key] === "boolean" ? {} : options[key] || {};
576
- }
577
-
578
- // src/utils/getOverrides.ts
579
- function getOverrides(options, key) {
580
- const subOptions = resolveSubOptions(options, key);
581
- return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
582
- }
583
-
584
- // src/utils/combineConfigs.ts
585
- async function combineConfigs(...configs2) {
586
- const resolved = await Promise.all(configs2);
587
- return resolved.flat();
588
- }
589
-
590
- // src/utils/ensurePackages.ts
591
- import process3 from "node:process";
592
- import { fileURLToPath } from "node:url";
593
- import { isPackageExists as isPackageExists2 } from "local-pkg";
594
-
595
- // src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
596
- import process2 from "node:process";
597
- function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
598
- return !!(process2.env.GIT_PARAMS || process2.env.VSCODE_GIT_COMMAND || // lint staged files
599
- process2.env.npm_lifecycle_script?.startsWith("nano-staged") || // run `scripts/generateType.ts`
600
- process2.env.npm_lifecycle_script?.startsWith("tsx"));
601
- }
602
-
603
- // src/utils/ensurePackages.ts
604
- var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
605
- var isCwdInScope = isPackageExists2("@ntnyq/eslint-config");
606
- function isPackageInScope(name) {
607
- return isPackageExists2(name, {
608
- paths: [scopeUrl]
609
- });
610
- }
611
- async function ensurePackages(packages) {
612
- if (process3.env.CI || !process3.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
613
- return;
614
- }
615
- const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
616
- if (nonExistingPackages.length === 0) {
617
- return;
618
- }
619
- const { confirm } = await import("@clack/prompts");
620
- const confirmInstall = await confirm({
621
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
622
- });
623
- if (confirmInstall) {
624
- try {
625
- const { installPackage } = await import("@antfu/install-pkg");
626
- await installPackage(nonExistingPackages, { dev: true });
627
- } catch (err) {
628
- console.log(err);
629
- }
630
- }
631
- }
632
-
633
- // src/utils/interopDefault.ts
634
- async function interopDefault(mod) {
635
- const resolved = await mod;
636
- return resolved.default || resolved;
637
- }
638
-
639
- // src/utils/mergePrettierOptions.ts
640
- function mergePrettierOptions(options = {}, overrides = {}) {
641
- const result = {
642
- ...options,
643
- ...overrides,
644
- plugins: [
645
- // built-in plugins
646
- ...options.plugins || [],
647
- // custom plugins
648
- ...overrides.plugins || []
649
- ]
650
- };
651
- return result;
652
- }
653
-
654
- // src/configs/esX.ts
655
- var esX = async (options = {}) => {
656
- await ensurePackages(["eslint-plugin-es-x"]);
657
- const pluginEsX = await interopDefault(import("eslint-plugin-es-x"));
658
- return [
659
- {
660
- name: "ntnyq/es-x",
661
- plugins: {
662
- "es-x": pluginEsX
663
- },
664
- rules: {
665
- // Overrides rules
666
- ...options.overrides
667
- }
668
- }
669
- ];
670
- };
671
-
672
- // src/configs/node.ts
673
- var node = (options = {}) => [
674
- {
675
- name: "ntnyq/node",
676
- plugins: {
677
- node: default2
678
- },
679
- rules: {
680
- "node/handle-callback-err": ["error", "^(err|error)$"],
681
- "node/no-deprecated-api": "error",
682
- "node/no-exports-assign": "error",
683
- "node/no-new-require": "error",
684
- "node/no-path-concat": "error",
685
- "node/prefer-global/buffer": ["error", "never"],
686
- "node/prefer-global/process": ["error", "never"],
687
- "node/process-exit-as-throw": "error",
575
+ "node/handle-callback-err": ["error", "^(err|error)$"],
576
+ "node/no-deprecated-api": "error",
577
+ "node/no-exports-assign": "error",
578
+ "node/no-new-require": "error",
579
+ "node/no-path-concat": "error",
580
+ "node/prefer-global/buffer": ["error", "never"],
581
+ "node/prefer-global/process": ["error", "never"],
582
+ "node/process-exit-as-throw": "error",
688
583
  // Overrides rules
689
584
  ...options.overrides
690
585
  }
@@ -692,13 +587,15 @@ var node = (options = {}) => [
692
587
  ];
693
588
 
694
589
  // src/configs/sort.ts
695
- var sort = (options = {}) => {
590
+ var configSort = (options = {}) => {
696
591
  const configs2 = [];
697
592
  const {
698
- tsconfig: enableSortTsconfig = true,
699
- packageJson: enableSortPackageJson = true,
593
+ additionalJsonFiles = [],
594
+ additionalYamlFiles = [],
700
595
  i18nLocale: enableSortI18nLocale = true,
701
- pnpmWorkspace: enableSortPnpmWorkspace = true
596
+ packageJson: enableSortPackageJson = true,
597
+ pnpmWorkspace: enableSortPnpmWorkspace = true,
598
+ tsconfig: enableSortTsconfig = true
702
599
  } = options;
703
600
  if (enableSortTsconfig) {
704
601
  configs2.push({
@@ -708,10 +605,20 @@ var sort = (options = {}) => {
708
605
  "jsonc/sort-keys": [
709
606
  "error",
710
607
  {
711
- order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
712
- pathPattern: "^$"
608
+ pathPattern: "^$",
609
+ order: [
610
+ "extends",
611
+ "compilerOptions",
612
+ "references",
613
+ "files",
614
+ "include",
615
+ "exclude",
616
+ // vue.volar
617
+ "vueCompilerOptions"
618
+ ]
713
619
  },
714
620
  {
621
+ pathPattern: "^compilerOptions$",
715
622
  order: [
716
623
  /* Projects */
717
624
  "incremental",
@@ -809,8 +716,7 @@ var sort = (options = {}) => {
809
716
  /* Completeness */
810
717
  "skipDefaultLibCheck",
811
718
  "skipLibCheck"
812
- ],
813
- pathPattern: "^compilerOptions$"
719
+ ]
814
720
  }
815
721
  ]
816
722
  }
@@ -821,6 +727,25 @@ var sort = (options = {}) => {
821
727
  name: "ntnyq/sort/package-json",
822
728
  files: ["**/package.json"],
823
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
+ ],
824
749
  "jsonc/sort-keys": [
825
750
  "error",
826
751
  {
@@ -916,8 +841,8 @@ var sort = (options = {}) => {
916
841
  ]
917
842
  },
918
843
  {
919
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
920
- order: { type: "asc" }
844
+ order: { type: "asc" },
845
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
921
846
  },
922
847
  {
923
848
  order: { type: "asc" },
@@ -925,7 +850,18 @@ var sort = (options = {}) => {
925
850
  },
926
851
  {
927
852
  pathPattern: "^exports.*$",
928
- 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
+ ]
929
865
  },
930
866
  // VSCode extension
931
867
  {
@@ -937,15 +873,27 @@ var sort = (options = {}) => {
937
873
  * @see {@link https://pnpm.io/package_json#publishconfig}
938
874
  */
939
875
  {
940
- order: { type: "asc" },
941
- pathPattern: "^publishConfig.*$"
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
+ ]
942
889
  },
943
890
  // npm scripts
944
891
  {
945
- pathPattern: "^scripts$",
946
- order: { type: "asc" }
892
+ order: { type: "asc" },
893
+ pathPattern: "^scripts$"
947
894
  },
948
895
  {
896
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$",
949
897
  order: [
950
898
  // client hooks only
951
899
  "pre-commit",
@@ -958,27 +906,7 @@ var sort = (options = {}) => {
958
906
  "post-merge",
959
907
  "pre-push",
960
908
  "pre-auto-gc"
961
- ],
962
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
963
- }
964
- ],
965
- "jsonc/sort-array-values": [
966
- "error",
967
- {
968
- pathPattern: "^files$",
969
- order: { type: "asc" }
970
- },
971
- {
972
- pathPattern: "^keywords$",
973
- order: { type: "asc" }
974
- },
975
- {
976
- pathPattern: "^activationEvents$",
977
- order: { type: "asc" }
978
- },
979
- {
980
- pathPattern: "^contributes.*$",
981
- order: { type: "asc" }
909
+ ]
982
910
  }
983
911
  ]
984
912
  }
@@ -988,26 +916,26 @@ var sort = (options = {}) => {
988
916
  configs2.push(
989
917
  {
990
918
  name: "ntnyq/sort/i18n-locale/json",
991
- files: ["**/{locales,i18n}/*.json"],
919
+ files: ["**/{i18n,langs,locales}/*.json"],
992
920
  rules: {
993
921
  "jsonc/sort-keys": [
994
922
  "error",
995
923
  {
996
- pathPattern: ".*",
997
- order: { type: "asc" }
924
+ order: { type: "asc" },
925
+ pathPattern: ".*"
998
926
  }
999
927
  ]
1000
928
  }
1001
929
  },
1002
930
  {
1003
931
  name: "ntnyq/sort/i18n-locale/yaml",
1004
- files: ["**/{locales,i18n}/*.y?(a)ml"],
932
+ files: ["**/{i18n,langs,locales}/*.y?(a)ml"],
1005
933
  rules: {
1006
934
  "yml/sort-keys": [
1007
935
  "error",
1008
936
  {
1009
- pathPattern: ".*",
1010
- order: { type: "asc" }
937
+ order: { type: "asc" },
938
+ pathPattern: ".*"
1011
939
  }
1012
940
  ]
1013
941
  }
@@ -1022,176 +950,336 @@ var sort = (options = {}) => {
1022
950
  "yml/sort-keys": [
1023
951
  "error",
1024
952
  {
1025
- pathPattern: ".*",
1026
- order: { type: "asc" }
953
+ order: { type: "asc" },
954
+ pathPattern: ".*"
1027
955
  }
1028
956
  ]
1029
957
  }
1030
958
  });
1031
959
  }
1032
- return configs2;
1033
- };
1034
-
1035
- // src/configs/toml.ts
1036
- var toml = (options = {}) => [
1037
- {
1038
- name: "ntnyq/toml",
1039
- files: [GLOB_TOML],
1040
- languageOptions: {
1041
- parser: parserToml
1042
- },
1043
- plugins: {
1044
- toml: default6
1045
- },
1046
- rules: {
1047
- "toml/keys-order": "error",
1048
- "toml/key-spacing": "error",
1049
- "toml/quoted-keys": "error",
1050
- "toml/comma-style": "error",
1051
- "toml/tables-order": "error",
1052
- "toml/no-space-dots": "error",
1053
- "toml/spaced-comment": "error",
1054
- "toml/precision-of-integer": "error",
1055
- "toml/table-bracket-spacing": "error",
1056
- "toml/array-bracket-newline": "error",
1057
- "toml/inline-table-curly-spacing": "error",
1058
- "toml/padding-line-between-pairs": "error",
1059
- "toml/padding-line-between-tables": "error",
1060
- "toml/no-unreadable-number-separator": "error",
1061
- "toml/precision-of-fractional-seconds": "error",
1062
- "toml/vue-custom-block/no-parsing-error": "error",
1063
- "toml/indent": ["error", 2],
1064
- "toml/array-bracket-spacing": ["error", "never"],
1065
- "toml/array-element-newline": ["error", "never"],
1066
- // Overrides rules
1067
- ...options.overrides
1068
- }
1069
- }
1070
- ];
1071
-
1072
- // src/configs/test.ts
1073
- var test = (options = {}) => [
1074
- {
1075
- name: "ntnyq/test",
1076
- files: [...GLOB_TEST],
1077
- rules: {
1078
- "no-unused-expressions": "off",
1079
- "max-lines-per-function": "off",
1080
- // Overrides rules
1081
- ...options.overrides
1082
- }
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
+ });
1083
974
  }
1084
- ];
1085
- var vitest = (options = {}) => {
1086
- if (!default14.configs?.recommended) return [];
1087
- const vitestConfigs = default14.configs;
1088
- return [
1089
- {
1090
- name: "ntnyq/vitest",
1091
- plugins: {
1092
- vitest: default14
1093
- },
1094
- files: [...GLOB_TEST],
975
+ if (additionalYamlFiles.length) {
976
+ configs2.push({
977
+ name: "ntnyq/sort/additional-yaml",
978
+ files: additionalYamlFiles,
1095
979
  rules: {
1096
- ...vitestConfigs.recommended.rules,
1097
- // Overrides rules
1098
- ...options.overridesVitestRules
980
+ "yml/sort-keys": [
981
+ "error",
982
+ {
983
+ order: { type: "asc" },
984
+ pathPattern: ".*"
985
+ }
986
+ ]
1099
987
  }
1100
- }
1101
- ];
988
+ });
989
+ }
990
+ return configs2;
1102
991
  };
1103
992
 
1104
993
  // src/configs/svgo.ts
1105
- import { createConfig as createSVGOConfig } from "eslint-plugin-svgo";
1106
- var svgo = (options = {}) => {
1107
- const { files = [GLOB_SVG], rules: overridesRules = {} } = options;
994
+ var configSVGO = (options = {}) => {
995
+ const { files = [GLOB_SVG], ignores = [] } = options;
1108
996
  return [
1109
- createSVGOConfig({
997
+ {
1110
998
  name: "ntnyq/svgo",
1111
999
  files,
1000
+ ignores,
1001
+ plugins: {
1002
+ svgo: default5
1003
+ },
1004
+ languageOptions: {
1005
+ parser: parserPlain
1006
+ },
1112
1007
  rules: {
1113
- "svgo/svgo": "error",
1114
- ...overridesRules
1008
+ "svgo/svgo": "error"
1115
1009
  }
1116
- })
1010
+ }
1117
1011
  ];
1118
1012
  };
1119
1013
 
1120
- // src/configs/antfu.ts
1121
- var antfu = (options = {}) => [
1122
- {
1123
- name: "ntnyq/antfu",
1124
- plugins: {
1125
- antfu: default9
1126
- },
1127
- rules: {
1128
- // required `object-curly-newline` to be disabled
1129
- // 'antfu/consistent-list-newline': 'error',
1130
- "antfu/import-dedupe": "error",
1131
- "antfu/no-import-dist": "error",
1132
- "antfu/indent-unindent": "error",
1133
- "antfu/no-import-node-modules-by-path": "error",
1134
- // Overrides rules
1135
- ...options.overrides
1136
- }
1137
- }
1138
- ];
1014
+ // src/utils/env.ts
1015
+ import { resolve } from "node:path";
1016
+ import process from "node:process";
1017
+ import { isPackageExists } from "local-pkg";
1018
+ var hasPinia = () => isPackageExists("pinia");
1019
+ var hasVitest = () => isPackageExists("vitest");
1020
+ var hasTypeScript = () => isPackageExists("typescript");
1021
+ var hasShadcnVue = () => isPackageExists("radix-vue") && isPackageExists("clsx");
1022
+ var hasUnoCSS = () => isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
1023
+ var hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
1024
+ paths: [
1025
+ resolve(process.cwd(), "playground"),
1026
+ resolve(process.cwd(), "docs")
1027
+ ]
1028
+ });
1139
1029
 
1140
- // src/configs/jsdoc.ts
1141
- var javscriptRules = {
1142
- "jsdoc/no-types": "off",
1143
- "jsdoc/no-undefined-types": "error",
1144
- "jsdoc/require-param-type": "error",
1145
- "jsdoc/require-property-type": "error",
1146
- "jsdoc/require-returns-type": "error"
1147
- };
1148
- var typescriptRules = {
1149
- "jsdoc/no-undefined-types": "off",
1150
- "jsdoc/require-param-type": "off",
1151
- "jsdoc/require-property-type": "off",
1152
- "jsdoc/require-returns-type": "off",
1153
- "jsdoc/no-types": "error"
1154
- };
1155
- var jsdoc = (options = {}) => [
1156
- {
1157
- name: "ntnyq/jsdoc",
1158
- plugins: {
1159
- jsdoc: default10
1160
- },
1161
- rules: {
1162
- // Disabled rules
1163
- "jsdoc/tag-lines": "off",
1164
- // Use `jsdoc/sort-tags`
1165
- "jsdoc/text-escaping": "off",
1166
- // No need
1167
- // Fixable rules
1168
- "jsdoc/empty-tags": "error",
1169
- "jsdoc/no-defaults": "error",
1170
- "jsdoc/check-types": "error",
1171
- "jsdoc/no-blank-blocks": "error",
1172
- "jsdoc/check-alignment": "error",
1173
- "jsdoc/multiline-blocks": "error",
1174
- "jsdoc/check-param-names": "error",
1175
- "jsdoc/no-multi-asterisks": "error",
1176
- "jsdoc/check-line-alignment": "error",
1177
- "jsdoc/check-property-names": "error",
1178
- "jsdoc/require-asterisk-prefix": "error",
1179
- "jsdoc/no-blank-block-descriptions": "error",
1180
- "jsdoc/require-hyphen-before-param-description": "error",
1181
- "jsdoc/no-bad-blocks": [
1182
- "error",
1183
- {
1184
- ignore: [
1185
- // built-in default
1186
- "ts-check",
1187
- "ts-expect-error",
1188
- "ts-ignore",
1189
- "ts-nocheck",
1190
- // useful
1191
- "vite-ignore"
1192
- ]
1193
- }
1194
- ],
1030
+ // src/utils/toArray.ts
1031
+ function toArray(val) {
1032
+ val = val ?? [];
1033
+ return Array.isArray(val) ? val : [val];
1034
+ }
1035
+
1036
+ // src/utils/resolveSubOptions.ts
1037
+ function resolveSubOptions(options, key) {
1038
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
1039
+ }
1040
+
1041
+ // src/utils/getOverrides.ts
1042
+ function getOverrides(options, key) {
1043
+ const subOptions = resolveSubOptions(options, key);
1044
+ return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
1045
+ }
1046
+
1047
+ // src/utils/combineConfigs.ts
1048
+ async function combineConfigs(...configs2) {
1049
+ const resolved = await Promise.all(configs2);
1050
+ return resolved.flat();
1051
+ }
1052
+
1053
+ // src/utils/ensurePackages.ts
1054
+ import process3 from "node:process";
1055
+ import { fileURLToPath } from "node:url";
1056
+ import { isPackageExists as isPackageExists2 } from "local-pkg";
1057
+
1058
+ // src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
1059
+ import process2 from "node:process";
1060
+ function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
1061
+ return !!(process2.env.GIT_PARAMS || process2.env.VSCODE_GIT_COMMAND || process2.env.npm_lifecycle_script?.startsWith("nano-staged") || process2.env.npm_lifecycle_script?.startsWith("tsx"));
1062
+ }
1063
+
1064
+ // src/utils/ensurePackages.ts
1065
+ var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
1066
+ var isCwdInScope = isPackageExists2("@ntnyq/eslint-config");
1067
+ function isPackageInScope(name) {
1068
+ return isPackageExists2(name, {
1069
+ paths: [scopeUrl]
1070
+ });
1071
+ }
1072
+ async function ensurePackages(packages) {
1073
+ if (process3.env.CI || !process3.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
1074
+ return;
1075
+ }
1076
+ const nonExistingPackages = packages.filter(
1077
+ (pkg) => !!pkg && !isPackageInScope(pkg)
1078
+ );
1079
+ if (nonExistingPackages.length === 0) {
1080
+ return;
1081
+ }
1082
+ const { confirm } = await import("@clack/prompts");
1083
+ const confirmInstall = await confirm({
1084
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
1085
+ });
1086
+ if (confirmInstall) {
1087
+ try {
1088
+ const { installPackage } = await import("@antfu/install-pkg");
1089
+ await installPackage(nonExistingPackages, { dev: true });
1090
+ } catch (err) {
1091
+ console.log(err);
1092
+ }
1093
+ }
1094
+ }
1095
+
1096
+ // src/utils/interopDefault.ts
1097
+ async function interopDefault(mod) {
1098
+ const resolved = await mod;
1099
+ return resolved.default || resolved;
1100
+ }
1101
+
1102
+ // src/utils/mergePrettierOptions.ts
1103
+ function mergePrettierOptions(options = {}, overrides = {}) {
1104
+ const result = {
1105
+ ...options,
1106
+ ...overrides,
1107
+ plugins: [
1108
+ // built-in plugins
1109
+ ...options.plugins || [],
1110
+ // custom plugins
1111
+ ...overrides.plugins || []
1112
+ ]
1113
+ };
1114
+ return result;
1115
+ }
1116
+
1117
+ // src/configs/test.ts
1118
+ var configTest = (options = {}) => {
1119
+ const {
1120
+ // default test files
1121
+ files = [...GLOB_TEST],
1122
+ vitest: enableVitest = hasVitest()
1123
+ } = options;
1124
+ const configs2 = [
1125
+ {
1126
+ name: "ntnyq/test/setup",
1127
+ plugins: {
1128
+ "no-only-tests": default20
1129
+ }
1130
+ },
1131
+ {
1132
+ name: "ntnyq/test/base",
1133
+ files,
1134
+ rules: {
1135
+ "max-lines-per-function": "off",
1136
+ "no-unused-expressions": "off",
1137
+ "no-only-tests/no-only-tests": "error",
1138
+ // Overrides rules
1139
+ ...options.overrides
1140
+ }
1141
+ }
1142
+ ];
1143
+ if (enableVitest) {
1144
+ configs2.push({
1145
+ name: "ntnyq/test/vitest",
1146
+ files,
1147
+ plugins: {
1148
+ vitest: default15
1149
+ },
1150
+ settings: {
1151
+ /**
1152
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/tree/main?tab=readme-ov-file#enabling-with-type-testing
1153
+ */
1154
+ // https://github.com/vitest-dev/eslint-plugin-vitest/issues/664
1155
+ // vitest: {
1156
+ // typecheck: true,
1157
+ // },
1158
+ },
1159
+ rules: {
1160
+ ...default15.configs.recommended.rules,
1161
+ "vitest/expect-expect": [
1162
+ "error",
1163
+ {
1164
+ assertFunctionNames: [
1165
+ "expect",
1166
+ "assert",
1167
+ /**
1168
+ * type test
1169
+ */
1170
+ "expectTypeOf",
1171
+ "assertType"
1172
+ ]
1173
+ }
1174
+ ],
1175
+ // Overrides rules
1176
+ ...options.overridesVitestRules
1177
+ }
1178
+ });
1179
+ }
1180
+ return configs2;
1181
+ };
1182
+
1183
+ // src/configs/toml.ts
1184
+ var configToml = (options = {}) => {
1185
+ const { files = [GLOB_TOML] } = options;
1186
+ return [
1187
+ {
1188
+ name: "ntnyq/toml",
1189
+ files,
1190
+ plugins: {
1191
+ toml: default6
1192
+ },
1193
+ languageOptions: {
1194
+ parser: parserToml
1195
+ },
1196
+ rules: {
1197
+ "toml/array-bracket-newline": "error",
1198
+ "toml/array-bracket-spacing": ["error", "never"],
1199
+ "toml/array-element-newline": ["error", "never"],
1200
+ "toml/comma-style": "error",
1201
+ "toml/indent": ["error", 2],
1202
+ "toml/inline-table-curly-spacing": "error",
1203
+ "toml/key-spacing": "error",
1204
+ "toml/keys-order": "error",
1205
+ "toml/no-space-dots": "error",
1206
+ "toml/no-unreadable-number-separator": "error",
1207
+ "toml/padding-line-between-pairs": "error",
1208
+ "toml/padding-line-between-tables": "error",
1209
+ "toml/precision-of-fractional-seconds": "error",
1210
+ "toml/precision-of-integer": "error",
1211
+ "toml/quoted-keys": "error",
1212
+ "toml/spaced-comment": "error",
1213
+ "toml/table-bracket-spacing": "error",
1214
+ "toml/tables-order": "error",
1215
+ "toml/vue-custom-block/no-parsing-error": "error",
1216
+ // Overrides rules
1217
+ ...options.overrides
1218
+ }
1219
+ }
1220
+ ];
1221
+ };
1222
+
1223
+ // src/configs/antfu.ts
1224
+ var configAntfu = (options = {}) => [
1225
+ {
1226
+ name: "ntnyq/antfu",
1227
+ plugins: {
1228
+ antfu: default8
1229
+ },
1230
+ rules: {
1231
+ // required `object-curly-newline` to be disabled
1232
+ // 'antfu/consistent-list-newline': 'error',
1233
+ "antfu/import-dedupe": "error",
1234
+ "antfu/indent-unindent": "error",
1235
+ "antfu/no-import-dist": "error",
1236
+ "antfu/no-import-node-modules-by-path": "error",
1237
+ // Overrides rules
1238
+ ...options.overrides
1239
+ }
1240
+ }
1241
+ ];
1242
+
1243
+ // src/configs/jsdoc.ts
1244
+ var javscriptRules = {
1245
+ "jsdoc/no-types": "off",
1246
+ "jsdoc/no-undefined-types": "error",
1247
+ "jsdoc/require-param-type": "error",
1248
+ "jsdoc/require-property-type": "error",
1249
+ "jsdoc/require-returns-type": "error"
1250
+ };
1251
+ var typescriptRules = {
1252
+ "jsdoc/no-undefined-types": "off",
1253
+ "jsdoc/require-param-type": "off",
1254
+ "jsdoc/require-property-type": "off",
1255
+ "jsdoc/require-returns-type": "off",
1256
+ "jsdoc/no-types": "error"
1257
+ };
1258
+ var configJsdoc = (options = {}) => [
1259
+ {
1260
+ name: "ntnyq/jsdoc",
1261
+ plugins: {
1262
+ jsdoc: default9
1263
+ },
1264
+ rules: {
1265
+ // Disabled rules
1266
+ "jsdoc/tag-lines": "off",
1267
+ // Use `jsdoc/sort-tags`
1268
+ "jsdoc/text-escaping": "off",
1269
+ // No need
1270
+ "jsdoc/check-access": "warn",
1271
+ "jsdoc/implements-on-classes": "warn",
1272
+ "jsdoc/require-param-name": "warn",
1273
+ "jsdoc/require-property": "warn",
1274
+ "jsdoc/require-property-description": "warn",
1275
+ "jsdoc/require-property-name": "warn",
1276
+ "jsdoc/require-returns-check": "warn",
1277
+ "jsdoc/require-returns-description": "warn",
1278
+ "jsdoc/require-yields-check": "warn",
1279
+ "jsdoc/check-alignment": "error",
1280
+ "jsdoc/check-line-alignment": "error",
1281
+ "jsdoc/check-param-names": "error",
1282
+ "jsdoc/check-property-names": "error",
1195
1283
  "jsdoc/check-tag-names": [
1196
1284
  "error",
1197
1285
  {
@@ -1199,6 +1287,9 @@ var jsdoc = (options = {}) => [
1199
1287
  // magic-comments
1200
1288
  "vite-ignore",
1201
1289
  "unocss-include",
1290
+ // defined perfectionist group
1291
+ "pg",
1292
+ "perfectionist-group",
1202
1293
  // eslint-plugin-command (block comment only)
1203
1294
  "regex101",
1204
1295
  // non-standard, but common used
@@ -1209,181 +1300,30 @@ var jsdoc = (options = {}) => [
1209
1300
  ]
1210
1301
  }
1211
1302
  ],
1212
- // TODO: this after investigate
1213
- // 'jsdoc/sort-tags': [
1214
- // 'error',
1215
- // {
1216
- // tagSequence: [
1217
- // {
1218
- // // Module/file-level
1219
- // tags: ['module', 'exports', 'file', 'fileoverview', 'overview', 'import'],
1220
- // },
1221
- // {
1222
- // // Identifying (name, type)
1223
- // tags: [
1224
- // 'typedef',
1225
- // 'interface',
1226
- // 'record',
1227
- // 'template',
1228
- // 'name',
1229
- // 'kind',
1230
- // 'type',
1231
- // 'alias',
1232
- // 'external',
1233
- // 'host',
1234
- // 'callback',
1235
- // 'func',
1236
- // 'function',
1237
- // 'method',
1238
- // 'class',
1239
- // 'constructor',
1240
- // ],
1241
- // },
1242
- // {
1243
- // // Relationships
1244
- // tags: [
1245
- // 'modifies',
1246
- // 'mixes',
1247
- // 'mixin',
1248
- // 'mixinClass',
1249
- // 'mixinFunction',
1250
- // 'namespace',
1251
- // 'borrows',
1252
- // 'constructs',
1253
- // 'lends',
1254
- // 'implements',
1255
- // 'requires',
1256
- // ],
1257
- // },
1258
- // {
1259
- // // Long descriptions
1260
- // tags: ['desc', 'description', 'classdesc', 'tutorial', 'copyright', 'license'],
1261
- // },
1262
- // {
1263
- // // Simple annotations
1264
- // tags: [
1265
- // 'const',
1266
- // 'constant',
1267
- // 'final',
1268
- // 'global',
1269
- // 'readonly',
1270
- // 'abstract',
1271
- // 'virtual',
1272
- // 'var',
1273
- // 'member',
1274
- // 'memberof',
1275
- // 'memberof!',
1276
- // 'inner',
1277
- // 'instance',
1278
- // 'inheritdoc',
1279
- // 'inheritDoc',
1280
- // 'override',
1281
- // 'hideconstructor',
1282
- // ],
1283
- // },
1284
- // {
1285
- // // Core function/object inf
1286
- // tags: ['param', 'arg', 'argument', 'prop', 'property', 'return', 'returns'],
1287
- // },
1288
- // {
1289
- // // Important behavior details
1290
- // tags: [
1291
- // 'async',
1292
- // 'generator',
1293
- // 'default',
1294
- // 'defaultvalue',
1295
- // 'enum',
1296
- // 'augments',
1297
- // 'extends',
1298
- // 'throws',
1299
- // 'exception',
1300
- // 'yield',
1301
- // 'yields',
1302
- // 'event',
1303
- // 'fires',
1304
- // 'emits',
1305
- // 'listens',
1306
- // 'this',
1307
- // ],
1308
- // },
1309
- // {
1310
- // // Access
1311
- // tags: ['static', 'private', 'protected', 'public', 'access', 'internal', 'package'],
1312
- // },
1313
- // {
1314
- // // Other/unknown
1315
- // tags: ['-other'],
1316
- // },
1317
- // {
1318
- // // Supplementary descriptions
1319
- // tags: ['see', 'example'],
1320
- // },
1321
- // {
1322
- // // Other Closure (undocumented) metadata
1323
- // tags: [
1324
- // 'closurePrimitive',
1325
- // 'customElement',
1326
- // 'expose',
1327
- // 'hidden',
1328
- // 'idGenerator',
1329
- // 'meaning',
1330
- // 'ngInject',
1331
- // 'owner',
1332
- // 'wizaction',
1333
- // ],
1334
- // },
1335
- // {
1336
- // // Other Closure (documented) metadata
1337
- // tags: [
1338
- // 'define',
1339
- // 'dict',
1340
- // 'export',
1341
- // 'externs',
1342
- // 'implicitCast',
1343
- // 'noalias',
1344
- // 'nocollapse',
1345
- // 'nocompile',
1346
- // 'noinline',
1347
- // 'nosideeffects',
1348
- // 'polymer',
1349
- // 'polymerBehavior',
1350
- // 'preserve',
1351
- // 'struct',
1352
- // 'suppress',
1353
- // 'unrestricted',
1354
- // ],
1355
- // },
1356
- // {
1357
- // // Metadata
1358
- // tags: ['category'],
1359
- // },
1360
- // {
1361
- // // Non-Closure metadata
1362
- // tags: [
1363
- // 'ignore',
1364
- // 'author',
1365
- // 'version',
1366
- // 'variation',
1367
- // 'since',
1368
- // 'deprecated',
1369
- // 'compatibility',
1370
- // 'todo',
1371
- // ],
1372
- // },
1373
- // ],
1374
- // alphabetizeExtras: true,
1375
- // linesBetween: 1,
1376
- // },
1377
- // ],
1378
- "jsdoc/check-access": "warn",
1379
- "jsdoc/implements-on-classes": "warn",
1380
- "jsdoc/require-param-name": "warn",
1381
- "jsdoc/require-property": "warn",
1382
- "jsdoc/require-property-name": "warn",
1383
- "jsdoc/require-property-description": "warn",
1384
- "jsdoc/require-returns-check": "warn",
1385
- "jsdoc/require-returns-description": "warn",
1386
- "jsdoc/require-yields-check": "warn",
1303
+ "jsdoc/check-types": "error",
1304
+ // Fixable rules
1305
+ "jsdoc/empty-tags": "error",
1306
+ "jsdoc/multiline-blocks": "error",
1307
+ "jsdoc/no-bad-blocks": [
1308
+ "error",
1309
+ {
1310
+ ignore: [
1311
+ // built-in default
1312
+ "ts-check",
1313
+ "ts-expect-error",
1314
+ "ts-ignore",
1315
+ "ts-nocheck",
1316
+ // useful
1317
+ "vite-ignore"
1318
+ ]
1319
+ }
1320
+ ],
1321
+ "jsdoc/no-blank-block-descriptions": "error",
1322
+ "jsdoc/no-blank-blocks": "error",
1323
+ "jsdoc/no-defaults": "error",
1324
+ "jsdoc/no-multi-asterisks": "error",
1325
+ "jsdoc/require-asterisk-prefix": "error",
1326
+ "jsdoc/require-hyphen-before-param-description": "error",
1387
1327
  // TypeScript rules overrides
1388
1328
  ...options.typescript ? typescriptRules : javscriptRules,
1389
1329
  // Overrides rules
@@ -1393,44 +1333,63 @@ var jsdoc = (options = {}) => [
1393
1333
  ];
1394
1334
 
1395
1335
  // src/configs/jsonc.ts
1396
- var jsonc = (options = {}) => [
1336
+ var configJsonc = (options = {}) => {
1337
+ const { files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC] } = options;
1338
+ return [
1339
+ {
1340
+ name: "ntnyq/jsonc",
1341
+ files,
1342
+ plugins: {
1343
+ jsonc: default10
1344
+ },
1345
+ languageOptions: {
1346
+ parser: parserJsonc
1347
+ },
1348
+ rules: {
1349
+ ...default10.configs["recommended-with-jsonc"].rules,
1350
+ "jsonc/array-bracket-spacing": ["error", "never"],
1351
+ "jsonc/comma-dangle": ["error", "never"],
1352
+ "jsonc/comma-style": ["error", "last"],
1353
+ "jsonc/indent": ["error", 2],
1354
+ "jsonc/key-spacing": [
1355
+ "error",
1356
+ {
1357
+ afterColon: true,
1358
+ beforeColon: false
1359
+ }
1360
+ ],
1361
+ "jsonc/no-octal-escape": "error",
1362
+ "jsonc/object-curly-newline": [
1363
+ "error",
1364
+ {
1365
+ consistent: true,
1366
+ multiline: true
1367
+ }
1368
+ ],
1369
+ "jsonc/object-curly-spacing": ["error", "always"],
1370
+ "jsonc/object-property-newline": [
1371
+ "error",
1372
+ {
1373
+ allowMultiplePropertiesPerLine: true
1374
+ }
1375
+ ],
1376
+ // Overrides rules
1377
+ ...options.overrides
1378
+ }
1379
+ }
1380
+ ];
1381
+ };
1382
+
1383
+ // src/configs/ntnyq.ts
1384
+ var configNtnyq = (options = {}) => [
1397
1385
  {
1398
- name: "ntnyq/jsonc",
1399
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1386
+ name: "ntnyq/ntnyq",
1400
1387
  plugins: {
1401
- jsonc: default11
1402
- },
1403
- languageOptions: {
1404
- parser: parserJsonc
1388
+ ntnyq: default12
1405
1389
  },
1406
1390
  rules: {
1407
- ...default11.configs["recommended-with-jsonc"].rules,
1408
- "jsonc/no-octal-escape": "error",
1409
- "jsonc/indent": ["error", 2],
1410
- "jsonc/comma-style": ["error", "last"],
1411
- "jsonc/comma-dangle": ["error", "never"],
1412
- "jsonc/object-curly-spacing": ["error", "always"],
1413
- "jsonc/array-bracket-spacing": ["error", "never"],
1414
- "jsonc/key-spacing": [
1415
- "error",
1416
- {
1417
- beforeColon: false,
1418
- afterColon: true
1419
- }
1420
- ],
1421
- "jsonc/object-curly-newline": [
1422
- "error",
1423
- {
1424
- multiline: true,
1425
- consistent: true
1426
- }
1427
- ],
1428
- "jsonc/object-property-newline": [
1429
- "error",
1430
- {
1431
- allowMultiplePropertiesPerLine: true
1432
- }
1433
- ],
1391
+ "ntnyq/no-duplicate-exports": "error",
1392
+ "ntnyq/prefer-newline-after-file-header": "error",
1434
1393
  // Overrides rules
1435
1394
  ...options.overrides
1436
1395
  }
@@ -1438,22 +1397,21 @@ var jsonc = (options = {}) => [
1438
1397
  ];
1439
1398
 
1440
1399
  // src/configs/pinia.ts
1441
- var pinia = (options = {}) => {
1400
+ var configPinia = (options = {}) => {
1442
1401
  const { files = [GLOB_PINIA_STORE] } = options;
1443
1402
  return [
1444
1403
  {
1445
1404
  name: "ntnyq/pinia",
1446
1405
  files,
1447
1406
  plugins: {
1448
- pinia: default7
1407
+ pinia: default11
1449
1408
  },
1450
1409
  rules: {
1451
- "pinia/prefer-single-store-per-file": "error",
1410
+ "pinia/never-export-initialized-store": "error",
1452
1411
  "pinia/no-duplicate-store-ids": "error",
1453
1412
  "pinia/no-return-global-properties": "error",
1454
1413
  "pinia/no-store-to-refs-in-store": "error",
1455
- "pinia/never-export-initialized-store": "error",
1456
- "pinia/require-setup-store-properties-export": "error",
1414
+ "pinia/prefer-single-store-per-file": "error",
1457
1415
  "pinia/prefer-use-store-naming-convention": [
1458
1416
  "error",
1459
1417
  {
@@ -1461,6 +1419,7 @@ var pinia = (options = {}) => {
1461
1419
  storeSuffix: "Store"
1462
1420
  }
1463
1421
  ],
1422
+ "pinia/require-setup-store-properties-export": "error",
1464
1423
  // Overrides rules
1465
1424
  ...options.overrides
1466
1425
  }
@@ -1468,23 +1427,8 @@ var pinia = (options = {}) => {
1468
1427
  ];
1469
1428
  };
1470
1429
 
1471
- // src/configs/ntnyq.ts
1472
- import { createConfig as createNtnyqConfig } from "eslint-plugin-ntnyq";
1473
- var ntnyq = (options = {}) => [
1474
- {
1475
- ...createNtnyqConfig({
1476
- rules: {
1477
- "ntnyq/prefer-newline-after-file-header": "error",
1478
- // Overrides rules
1479
- ...options.overrides
1480
- }
1481
- }),
1482
- name: "ntnyq/ntnyq"
1483
- }
1484
- ];
1485
-
1486
1430
  // src/configs/depend.ts
1487
- var depend = (options = {}) => {
1431
+ var configDepend = (options = {}) => {
1488
1432
  const {
1489
1433
  files = [GLOB_SRC],
1490
1434
  // check package.json file
@@ -1524,99 +1468,155 @@ var depend = (options = {}) => {
1524
1468
  return configs2;
1525
1469
  };
1526
1470
 
1527
- // src/configs/regexp.ts
1528
- var regexp = (options = {}) => {
1529
- const recommendedConfig = pluginRegexp.configs["flat/recommended"];
1530
- const recommendedRules2 = {
1531
- ...recommendedConfig.rules
1532
- };
1533
- if (options.severity || options.level === "warn") {
1534
- for (const key in recommendedRules2) {
1535
- if (recommendedRules2[key] === "error") {
1536
- recommendedRules2[key] = "warn";
1537
- }
1538
- }
1539
- }
1540
- return [
1541
- {
1542
- ...recommendedConfig,
1543
- name: "ntnyq/regexp",
1544
- rules: {
1545
- ...recommendedRules2,
1546
- // Overrides rules
1547
- ...options.overrides
1548
- }
1549
- }
1550
- ];
1551
- };
1552
-
1553
- // src/configs/unocss.ts
1554
- var unocss = (options = {}) => [
1555
- {
1556
- name: "ntnyq/unocss",
1557
- plugins: {
1558
- unocss: default13
1559
- },
1560
- rules: {
1561
- "unocss/order": "error",
1562
- "unocss/order-attributify": options.attributify ? "error" : "off",
1563
- // Overrides rules
1564
- ...options.overrides
1565
- }
1566
- }
1567
- ];
1568
-
1569
- // src/constants.ts
1570
- var DEFAULT_PRETTIER_OPTIONS = {
1571
- // Include parentheses around a sole arrow function parameter
1471
+ // src/constants/prettier.ts
1472
+ var PRETTIER_DEFAULT_OPTIONS = {
1572
1473
  arrowParens: "avoid",
1573
- // Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
1574
1474
  bracketSameLine: false,
1575
- // Print spaces between brackets in object literals.
1576
1475
  bracketSpacing: true,
1577
- // Control whether Prettier formats quoted code embedded in the file
1578
1476
  embeddedLanguageFormatting: "auto",
1579
- // End of line
1580
1477
  endOfLine: "lf",
1581
- // Specify the global whitespace sensitivity for HTML files
1478
+ experimentalOperatorPosition: "start",
1479
+ experimentalTernaries: false,
1582
1480
  htmlWhitespaceSensitivity: "css",
1583
- // Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
1584
1481
  insertPragma: false,
1585
- // Use single quotes instead of double quotes in JSX
1586
1482
  jsxSingleQuote: true,
1587
- // Maximum line length
1588
- printWidth: 100,
1589
- // By default, Prettier will wrap markdown text as-is since some services use a line-break-sensitive renderer, e.g. GitHub comment and Bitbucket.
1483
+ objectWrap: "preserve",
1484
+ printWidth: 80,
1590
1485
  proseWrap: "preserve",
1591
- // Change when properties in objects are quoted
1592
1486
  quoteProps: "as-needed",
1593
1487
  rangeEnd: Number.POSITIVE_INFINITY,
1594
- // Format only a segment of a file.
1595
1488
  rangeStart: 0,
1596
- // Specify which parser to use.
1597
- // parser: undefined,
1598
- // Specify the file name to use to infer which parser to use.
1599
- // filepath: undefined,
1600
- // Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
1601
1489
  requirePragma: false,
1602
- // Use semicolons or not
1603
1490
  semi: false,
1604
- // Enforce single attribute per line in HTML, Vue and JSX
1605
1491
  singleAttributePerLine: true,
1606
- // Use single quotes instead of double quotes
1607
1492
  singleQuote: true,
1608
- // Specify the number of spaces per indentation-level
1609
1493
  tabWidth: 2,
1610
- // Print trailing commas wherever possible when multi-line
1611
1494
  trailingComma: "all",
1612
- // Indent lines with tabs instead of spaces
1613
1495
  useTabs: false,
1614
- // Whether or not to indent the code inside <script> and <style> tags in Vue files
1615
1496
  vueIndentScriptAndStyle: false
1616
1497
  };
1617
1498
 
1499
+ // src/constants/perfectionist.ts
1500
+ var PERFECTIONIST_COMMON_RULE_OPTIONS = {
1501
+ // fallbackSort: { order: 'asc', type: 'alphabetical' },
1502
+ ignoreCase: true,
1503
+ order: "asc",
1504
+ type: "alphabetical"
1505
+ };
1506
+ var PERFECTIONIST_EXTRA_RULE_OPTIONS = {
1507
+ newlinesBetween: "ignore",
1508
+ partitionByComment: ["@pg", "@perfectionist-group"]
1509
+ };
1510
+ var PERFECTIONIST_SORT_OBJECTS_GROUPS = [
1511
+ "property",
1512
+ "multiline-property",
1513
+ "method",
1514
+ "multiline-method",
1515
+ "unknown"
1516
+ ];
1517
+ var PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS = [
1518
+ "required-property",
1519
+ "optional-property",
1520
+ "required-method",
1521
+ "optional-method",
1522
+ "required-multiline-property",
1523
+ "optional-multiline-property",
1524
+ "required-multiline-method",
1525
+ "optional-multiline-method",
1526
+ "unknown",
1527
+ "index-signature",
1528
+ "multiline-index-signature"
1529
+ ];
1530
+ var PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS = [
1531
+ /**
1532
+ * eg. 'foobar', 24, false
1533
+ */
1534
+ "literal",
1535
+ /**
1536
+ * eg. number, string
1537
+ */
1538
+ "keyword",
1539
+ /**
1540
+ * eg. FooBar
1541
+ */
1542
+ "named",
1543
+ /**
1544
+ * eg. Foo & Bar
1545
+ */
1546
+ "intersection",
1547
+ /**
1548
+ * eg. Foobar extends string ? Foo : Bar
1549
+ */
1550
+ "conditional",
1551
+ /**
1552
+ * eg. (...args: any[]) => void
1553
+ */
1554
+ "function",
1555
+ /**
1556
+ * eg. import('eslint').Linter
1557
+ */
1558
+ "import",
1559
+ /**
1560
+ * eg. { foo: string; bar: number; }
1561
+ */
1562
+ "object",
1563
+ /**
1564
+ * eg. keyof T
1565
+ */
1566
+ "operator",
1567
+ /**
1568
+ * eg. [string, number]
1569
+ */
1570
+ "tuple",
1571
+ /**
1572
+ * eg. Foo | Bar
1573
+ */
1574
+ "union",
1575
+ /**
1576
+ * eg. null | undefined
1577
+ */
1578
+ "nullish"
1579
+ ];
1580
+ var PERFECTIONIST_SORT_IMPORTS_GROUPS = [
1581
+ // Side effect style imports (e.g. 'normalize.css')
1582
+ "side-effect-style",
1583
+ // Styles (e.g. *.{css,scss,less})
1584
+ "style",
1585
+ // Node.js built-in modules. (e.g. fs, path)
1586
+ "builtin",
1587
+ // External modules installed in the project (e.g. vue, lodash)
1588
+ "external",
1589
+ // Internal modules (e.g. @/utils, @/components)
1590
+ "internal",
1591
+ // Modules from parent directory (e.g. ../utils)
1592
+ "parent",
1593
+ // Modules from the same directory (e.g. ./utils)
1594
+ "sibling",
1595
+ // Main file from the current directory (e.g. ./index)
1596
+ "index",
1597
+ // TypeScript object-imports (e.g. import log = console.log)
1598
+ "object",
1599
+ // Side effect imports (e.g. import 'babel-polyfill')
1600
+ "side-effect",
1601
+ /**
1602
+ * Type import at the end
1603
+ */
1604
+ "builtin-type",
1605
+ "external-type",
1606
+ "internal-type",
1607
+ "parent-type",
1608
+ "sibling-type",
1609
+ "index-type",
1610
+ "type",
1611
+ /**
1612
+ * Imports that don’t fit into any other group
1613
+ */
1614
+ "unknown"
1615
+ ];
1616
+ var PERFECTIONIST_SORT_CLASSES_GROUPS = ["unknown"];
1617
+
1618
1618
  // src/configs/format.ts
1619
- var format = (options = {}) => {
1619
+ var configFormat = (options = {}) => {
1620
1620
  const {
1621
1621
  css: enableCSS = true,
1622
1622
  html: enableHTML = true,
@@ -1624,14 +1624,14 @@ var format = (options = {}) => {
1624
1624
  prettierOptions = {}
1625
1625
  } = options;
1626
1626
  const sharedPrettierOptions = {
1627
- ...DEFAULT_PRETTIER_OPTIONS,
1627
+ ...PRETTIER_DEFAULT_OPTIONS,
1628
1628
  ...prettierOptions
1629
1629
  };
1630
1630
  const configs2 = [
1631
1631
  {
1632
1632
  name: "ntnyq/format/setup",
1633
1633
  plugins: {
1634
- format: default12
1634
+ format: default13
1635
1635
  }
1636
1636
  }
1637
1637
  ];
@@ -1699,11 +1699,53 @@ var format = (options = {}) => {
1699
1699
  })
1700
1700
  ]
1701
1701
  }
1702
- });
1702
+ });
1703
+ }
1704
+ return configs2;
1705
+ };
1706
+
1707
+ // src/configs/regexp.ts
1708
+ var configRegexp = (options = {}) => {
1709
+ const recommendedConfig = pluginRegexp.configs["flat/recommended"];
1710
+ const recommendedRules2 = {
1711
+ ...recommendedConfig.rules
1712
+ };
1713
+ if (options.severity === "warn") {
1714
+ for (const key in recommendedRules2) {
1715
+ if (recommendedRules2[key] === "error") {
1716
+ recommendedRules2[key] = "warn";
1717
+ }
1718
+ }
1703
1719
  }
1704
- return configs2;
1720
+ return [
1721
+ {
1722
+ ...recommendedConfig,
1723
+ name: "ntnyq/regexp",
1724
+ rules: {
1725
+ ...recommendedRules2,
1726
+ // Overrides rules
1727
+ ...options.overrides
1728
+ }
1729
+ }
1730
+ ];
1705
1731
  };
1706
1732
 
1733
+ // src/configs/unocss.ts
1734
+ var configUnoCSS = (options = {}) => [
1735
+ {
1736
+ name: "ntnyq/unocss",
1737
+ plugins: {
1738
+ unocss: default14
1739
+ },
1740
+ rules: {
1741
+ "unocss/order-attributify": options.attributify ? "error" : "off",
1742
+ "unocss/order": "error",
1743
+ // Overrides rules
1744
+ ...options.overrides
1745
+ }
1746
+ }
1747
+ ];
1748
+
1707
1749
  // src/configs/command.ts
1708
1750
  import { builtinCommands } from "eslint-plugin-command/commands";
1709
1751
  import createCommandConfig from "eslint-plugin-command/config";
@@ -1715,8 +1757,8 @@ var regexper = defineCommand({
1715
1757
  // @regexper https://regexper.com/#%2F(%5Cb%7C%5Cs%7C%5E)(%40regexper)(%5Cs%5CS%2B)%3F(%5Cb%7C%5Cs%7C%24)%2F
1716
1758
  match: /(\b|\s|^)(@regexper)(\s\S+)?(\b|\s|$)/,
1717
1759
  action(ctx) {
1718
- const literal = ctx.findNodeBelow((node2) => {
1719
- return node2.type === "Literal" && "regex" in node2;
1760
+ const literal = ctx.findNodeBelow((node) => {
1761
+ return node.type === "Literal" && "regex" in node;
1720
1762
  });
1721
1763
  if (!literal) {
1722
1764
  return ctx.reportError("Unable to find a regexp literal to generate");
@@ -1744,7 +1786,10 @@ var regexper = defineCommand({
1744
1786
  removeComment: false,
1745
1787
  message: "Update the regexper link",
1746
1788
  fix(fixer) {
1747
- return fixer.replaceTextRange([indexStart, indexEnd], `@regexper ${url}`);
1789
+ return fixer.replaceTextRange(
1790
+ [indexStart, indexEnd],
1791
+ `@regexper ${url}`
1792
+ );
1748
1793
  }
1749
1794
  });
1750
1795
  }
@@ -1754,7 +1799,7 @@ var regexper = defineCommand({
1754
1799
  var commands = [regexper];
1755
1800
 
1756
1801
  // src/configs/command.ts
1757
- var command = (options = {}) => [
1802
+ var configCommand = (options = {}) => [
1758
1803
  {
1759
1804
  ...createCommandConfig({
1760
1805
  ...options,
@@ -1772,7 +1817,7 @@ var command = (options = {}) => [
1772
1817
  ];
1773
1818
 
1774
1819
  // src/configs/ignores.ts
1775
- var ignores = (customIgnores = []) => [
1820
+ var configIgnores = (customIgnores = []) => [
1776
1821
  {
1777
1822
  name: "ntnyq/ignores",
1778
1823
  ignores: [
@@ -1784,40 +1829,52 @@ var ignores = (customIgnores = []) => [
1784
1829
  ];
1785
1830
 
1786
1831
  // src/configs/importX.ts
1787
- var importX = (options = {}) => {
1832
+ var configImportX = (options = {}) => {
1788
1833
  const {
1789
- typescript: enableTypeScript,
1790
1834
  // use typescript resolve if possible
1791
- preferTypeScriptResolver = true
1835
+ preferTypeScriptResolver = true,
1836
+ typescript: enableTypeScript
1792
1837
  } = options;
1793
1838
  return [
1794
1839
  {
1795
1840
  name: "ntnyq/import-x",
1796
1841
  plugins: {
1797
- "import-x": default16
1842
+ "import-x": default17
1798
1843
  },
1799
1844
  settings: {
1800
1845
  "import-x/resolver-next": [
1801
1846
  enableTypeScript && preferTypeScriptResolver ? createTypeScriptImportResolver({
1802
- extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx", ".json", ".node"]
1847
+ extensions: [
1848
+ ".ts",
1849
+ ".tsx",
1850
+ ".d.ts",
1851
+ ".js",
1852
+ ".jsx",
1853
+ ".json",
1854
+ ".node"
1855
+ ]
1803
1856
  }) : createNodeResolver({
1804
1857
  extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
1805
1858
  })
1806
1859
  ]
1807
1860
  },
1808
1861
  rules: {
1809
- "import-x/no-unresolved": "off",
1810
1862
  "import-x/no-absolute-path": "off",
1811
1863
  "import-x/no-named-as-default-member": "off",
1812
1864
  "import-x/no-named-default": "off",
1865
+ "import-x/no-unresolved": "off",
1813
1866
  // disabled in favor or `perfectionist/sort-imports`
1814
1867
  "import-x/order": "off",
1815
- "import-x/first": "error",
1868
+ "import-x/consistent-type-specifier-style": [
1869
+ "error",
1870
+ "prefer-top-level"
1871
+ ],
1816
1872
  "import-x/export": "error",
1817
- "import-x/no-self-import": "error",
1873
+ "import-x/first": "error",
1874
+ "import-x/newline-after-import": "error",
1818
1875
  "import-x/no-duplicates": "error",
1819
1876
  "import-x/no-mutable-exports": "error",
1820
- "import-x/newline-after-import": "error",
1877
+ "import-x/no-self-import": "error",
1821
1878
  // Overrides rules
1822
1879
  ...options.overrides
1823
1880
  }
@@ -1829,51 +1886,50 @@ var importX = (options = {}) => {
1829
1886
  var disabledRules2 = {
1830
1887
  "unicorn/better-regex": "off",
1831
1888
  "unicorn/explicit-length-check": "off",
1832
- "unicorn/prefer-top-level-await": "off",
1833
1889
  "unicorn/no-array-callback-reference": "off",
1834
1890
  /**
1835
1891
  * @see https://caniuse.com/?search=globalThis
1836
1892
  */
1837
- "unicorn/prefer-global-this": "off"
1893
+ "unicorn/prefer-global-this": "off",
1894
+ "unicorn/prefer-top-level-await": "off"
1838
1895
  };
1839
- var unicorn = (options = {}) => [
1896
+ var configUnicorn = (options = {}) => [
1840
1897
  {
1841
1898
  name: "ntnyq/unicorn",
1842
1899
  plugins: {
1843
- unicorn: default15
1900
+ unicorn: default16
1844
1901
  },
1845
1902
  rules: {
1903
+ "unicorn/consistent-assert": "error",
1904
+ "unicorn/consistent-existence-index-check": "error",
1905
+ "unicorn/error-message": "error",
1846
1906
  "unicorn/escape-case": "error",
1907
+ "unicorn/new-for-builtins": "error",
1908
+ "unicorn/no-accessor-recursion": "error",
1909
+ "unicorn/no-console-spaces": "error",
1847
1910
  "unicorn/no-for-loop": "error",
1911
+ "unicorn/no-hex-escape": "error",
1912
+ "unicorn/no-instanceof-builtins": "error",
1848
1913
  "unicorn/no-lonely-if": "error",
1849
- "unicorn/error-message": "error",
1850
1914
  "unicorn/no-new-buffer": "error",
1851
- "unicorn/no-hex-escape": "error",
1852
- "unicorn/throw-new-error": "error",
1853
- "unicorn/prefer-includes": "error",
1854
- "unicorn/new-for-builtins": "error",
1855
- "unicorn/prefer-type-error": "error",
1856
- "unicorn/prefer-math-trunc": "error",
1857
- "unicorn/no-console-spaces": "error",
1858
- "unicorn/no-zero-fractions": "error",
1859
- "unicorn/prefer-regexp-test": "error",
1860
- "unicorn/number-literal-case": "error",
1915
+ "unicorn/no-static-only-class": "error",
1861
1916
  "unicorn/no-typeof-undefined": "error",
1917
+ "unicorn/no-unnecessary-await": "error",
1918
+ "unicorn/prefer-includes": "error",
1919
+ "unicorn/prefer-keyboard-event-key": "error",
1862
1920
  "unicorn/prefer-math-min-max": "error",
1921
+ "unicorn/prefer-math-trunc": "error",
1922
+ "unicorn/prefer-modern-math-apis": "error",
1923
+ "unicorn/prefer-negative-index": "error",
1863
1924
  "unicorn/prefer-node-protocol": "error",
1864
- "unicorn/no-unnecessary-await": "error",
1865
- "unicorn/no-static-only-class": "error",
1925
+ "unicorn/prefer-optional-catch-binding": "error",
1926
+ "unicorn/prefer-prototype-methods": "error",
1866
1927
  "unicorn/prefer-reflect-apply": "error",
1867
- "unicorn/prefer-negative-index": "error",
1868
1928
  "unicorn/prefer-structured-clone": "error",
1869
- "unicorn/custom-error-definition": "error",
1870
- "unicorn/prefer-modern-math-apis": "error",
1871
- "unicorn/prefer-number-properties": "error",
1872
- "unicorn/prefer-prototype-methods": "error",
1873
- "unicorn/prefer-keyboard-event-key": "error",
1874
- "unicorn/prefer-optional-catch-binding": "error",
1875
- "unicorn/consistent-existence-index-check": "error",
1876
1929
  "unicorn/switch-case-braces": ["error", "avoid"],
1930
+ /**
1931
+ * @pg Error
1932
+ */
1877
1933
  "unicorn/catch-error-name": [
1878
1934
  "error",
1879
1935
  {
@@ -1881,32 +1937,56 @@ var unicorn = (options = {}) => [
1881
1937
  ignore: ["^_."]
1882
1938
  }
1883
1939
  ],
1940
+ "unicorn/custom-error-definition": "error",
1941
+ "unicorn/prefer-type-error": "error",
1942
+ "unicorn/throw-new-error": "error",
1943
+ /**
1944
+ * @pg Number
1945
+ */
1946
+ "unicorn/no-zero-fractions": "error",
1947
+ "unicorn/number-literal-case": "error",
1948
+ "unicorn/prefer-number-properties": "error",
1949
+ /**
1950
+ * @pg RegExp
1951
+ */
1952
+ "unicorn/prefer-regexp-test": "error",
1953
+ /**
1954
+ * @pg Date
1955
+ */
1956
+ "unicorn/consistent-date-clone": "error",
1884
1957
  "unicorn/prefer-date-now": "error",
1885
- // String
1958
+ /**
1959
+ * @pg String
1960
+ */
1886
1961
  "unicorn/prefer-code-point": "error",
1887
1962
  "unicorn/prefer-string-slice": "error",
1888
- "unicorn/prefer-string-trim-start-end": "error",
1889
1963
  "unicorn/prefer-string-starts-ends-with": "error",
1890
- // DOM
1891
- "unicorn/prefer-query-selector": "error",
1892
- "unicorn/prefer-modern-dom-apis": "error",
1893
- "unicorn/prefer-dom-node-remove": "error",
1964
+ "unicorn/prefer-string-trim-start-end": "error",
1965
+ /**
1966
+ * @pg DOM
1967
+ */
1968
+ "unicorn/no-invalid-remove-event-listener": "error",
1969
+ "unicorn/prefer-add-event-listener": "error",
1894
1970
  "unicorn/prefer-dom-node-append": "error",
1895
1971
  "unicorn/prefer-dom-node-dataset": "error",
1896
- "unicorn/prefer-add-event-listener": "error",
1972
+ "unicorn/prefer-dom-node-remove": "error",
1897
1973
  "unicorn/prefer-dom-node-text-content": "error",
1898
- "unicorn/no-invalid-remove-event-listener": "error",
1899
- // Array
1900
- "unicorn/no-new-array": "error",
1974
+ "unicorn/prefer-modern-dom-apis": "error",
1975
+ "unicorn/prefer-query-selector": "error",
1976
+ /**
1977
+ * @pg Array
1978
+ */
1979
+ "unicorn/no-array-method-this-argument": "error",
1901
1980
  "unicorn/no-array-push-push": "error",
1981
+ "unicorn/no-new-array": "error",
1902
1982
  "unicorn/prefer-array-find": "error",
1903
- "unicorn/prefer-array-some": "error",
1904
- "unicorn/no-instanceof-array": "error",
1905
1983
  "unicorn/prefer-array-flat-map": "error",
1906
1984
  "unicorn/prefer-array-index-of": "error",
1985
+ "unicorn/prefer-array-some": "error",
1907
1986
  "unicorn/require-array-join-separator": "error",
1908
- "unicorn/no-array-method-this-argument": "error",
1909
- // Set
1987
+ /**
1988
+ * @pg Set
1989
+ */
1910
1990
  "unicorn/prefer-set-has": "error",
1911
1991
  "unicorn/prefer-set-size": "error",
1912
1992
  ...disabledRules2,
@@ -1916,106 +1996,13 @@ var unicorn = (options = {}) => [
1916
1996
  }
1917
1997
  ];
1918
1998
 
1919
- // src/configs/specials.ts
1920
- import globals from "globals";
1921
- var specials = (options = {}) => {
1922
- const {
1923
- // Enable shadcn-vue support
1924
- shadcnVue: enableShadcnVue = hasShadcnVue
1925
- } = options;
1926
- const configs2 = [
1927
- {
1928
- name: "ntnyq/specials/scripts",
1929
- files: [`**/scripts/${GLOB_SRC}`],
1930
- rules: {
1931
- "no-console": "off",
1932
- "@typescript-eslint/explicit-function-return-type": "off",
1933
- // Overrides rules
1934
- ...options.overridesScriptsRules
1935
- }
1936
- },
1937
- {
1938
- name: "ntnyq/specials/cli",
1939
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1940
- rules: {
1941
- "no-console": "off",
1942
- "@typescript-eslint/explicit-function-return-type": "off",
1943
- // Overrides rules
1944
- ...options.overridesCliRules
1945
- }
1946
- },
1947
- {
1948
- name: "ntnyq/specials/userscript",
1949
- files: [`**/*.user.${GLOB_SRC_EXT}`],
1950
- languageOptions: {
1951
- globals: {
1952
- ...globals.greasemonkey
1953
- }
1954
- },
1955
- rules: {
1956
- camelcase: [
1957
- "error",
1958
- {
1959
- allow: ["^GM_.+"]
1960
- }
1961
- ],
1962
- // Overrides rules
1963
- ...options.overridesUserScriptsRules
1964
- }
1965
- },
1966
- {
1967
- name: "ntnyq/specials/config-file",
1968
- files: [`**/*.config*.${GLOB_SRC_EXT}`],
1969
- plugins: {
1970
- "import-x": default16,
1971
- perfectionist: default19
1972
- },
1973
- rules: {
1974
- "no-console": "off",
1975
- "import-x/no-default-export": "off",
1976
- "@typescript-eslint/explicit-function-return-type": "off",
1977
- "perfectionist/sort-objects": [
1978
- "error",
1979
- {
1980
- type: "alphabetical",
1981
- order: "asc",
1982
- partitionByComment: true,
1983
- groups: ["unknown", "method", "multiline"]
1984
- }
1985
- ],
1986
- ...options.overridesConfigFileRules
1987
- }
1988
- }
1989
- ];
1990
- if (enableShadcnVue) {
1991
- const shadcnOptions = resolveSubOptions(options, "shadcnVue");
1992
- configs2.push({
1993
- name: "ntnyq/specials/shadcn-vue",
1994
- files: shadcnOptions.files || ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
1995
- rules: {
1996
- "@typescript-eslint/no-unused-vars": "off",
1997
- "@typescript-eslint/consistent-type-imports": "off",
1998
- // Overrides rules
1999
- ...shadcnOptions.overridesRules
2000
- }
2001
- });
2002
- }
2003
- if (options.specialCaseConfigs) {
2004
- configs2.push(...options.specialCaseConfigs);
2005
- }
2006
- return configs2;
2007
- };
2008
-
2009
- // src/configs/comments.ts
2010
- var comments = (options = {}) => [
1999
+ // src/configs/deMorgan.ts
2000
+ var configDeMorgan = (options = {}) => [
2011
2001
  {
2012
- name: "ntnyq/eslint-comments",
2013
- plugins: {
2014
- "@eslint-community/eslint-comments": default21
2015
- },
2002
+ ...default19.configs.recommended,
2003
+ name: "ntnyq/de-morgan",
2016
2004
  rules: {
2017
- ...default21.configs.recommended.rules,
2018
- "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
2005
+ ...default19.configs.recommended.rules,
2019
2006
  // Overrides rules
2020
2007
  ...options.overrides
2021
2008
  }
@@ -2023,27 +2010,22 @@ var comments = (options = {}) => [
2023
2010
  ];
2024
2011
 
2025
2012
  // src/configs/markdown.ts
2026
- var markdown = (options = {}) => {
2027
- if (!Array.isArray(default8.configs?.processor)) return [];
2013
+ var configMarkdown = (options = {}) => {
2028
2014
  const {
2029
2015
  /**
2030
2016
  * code block files
2031
2017
  */
2032
- files = [`${GLOB_MARKDOWN}/${GLOB_SRC}`],
2018
+ files = [GLOB_MARKDOWN_CODE],
2033
2019
  /**
2034
2020
  * other extensions
2035
2021
  */
2036
- extensions = [],
2037
- /**
2038
- * disbale type aware linting
2039
- */
2040
- disableTypeAwareLinting = false
2022
+ extensions = []
2041
2023
  } = options;
2042
2024
  const configs2 = [
2043
2025
  /**
2044
2026
  * extracting code blocks to be linted individually
2045
2027
  */
2046
- ...default8.configs.processor.map((config) => ({
2028
+ ...default7.configs.processor.map((config) => ({
2047
2029
  ...config,
2048
2030
  name: `ntnyq/${config.name}`
2049
2031
  })),
@@ -2055,7 +2037,7 @@ var markdown = (options = {}) => {
2055
2037
  files,
2056
2038
  ignores: [GLOB_MARKDOWN_NESTED],
2057
2039
  processor: mergeProcessors([
2058
- default8.processors.markdown,
2040
+ default7.processors.markdown,
2059
2041
  // Just pass through processor
2060
2042
  processorPassThrough
2061
2043
  ])
@@ -2068,57 +2050,55 @@ var markdown = (options = {}) => {
2068
2050
  }
2069
2051
  },
2070
2052
  {
2071
- name: "ntnyq/markdown/disabled/code-blocks",
2053
+ name: "ntnyq/markdown/disabled",
2072
2054
  files: [
2073
2055
  ...files,
2074
- // Extension block support
2056
+ // more nested extensions to disable
2075
2057
  ...extensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
2076
2058
  ],
2077
2059
  languageOptions: {
2078
2060
  parserOptions: {
2061
+ // type-aware lint related parserOptions
2062
+ project: false,
2063
+ projectService: false,
2079
2064
  ecmaFeatures: {
2080
2065
  impliedStrict: true
2081
2066
  }
2082
2067
  }
2083
2068
  },
2084
2069
  rules: {
2085
- "no-undef": "off",
2070
+ "@typescript-eslint/comma-dangle": "off",
2071
+ "@typescript-eslint/consistent-type-imports": "off",
2072
+ "@typescript-eslint/no-extraneous-class": "off",
2073
+ "@typescript-eslint/no-namespace": "off",
2074
+ "@typescript-eslint/no-redeclare": "off",
2075
+ "@typescript-eslint/no-require-imports": "off",
2076
+ "@typescript-eslint/no-unused-expressions": "off",
2077
+ "@typescript-eslint/no-unused-vars": "off",
2078
+ "@typescript-eslint/no-use-before-define": "off",
2079
+ "import-x/no-unresolved": "off",
2086
2080
  "no-alert": "off",
2087
2081
  "no-console": "off",
2088
- "no-unused-vars": "off",
2089
- "no-unused-expressions": "off",
2090
2082
  "no-restricted-imports": "off",
2083
+ "no-undef": "off",
2084
+ "no-unused-expressions": "off",
2085
+ "no-unused-vars": "off",
2091
2086
  "node/prefer-global/buffer": "off",
2092
2087
  "node/prefer-global/process": "off",
2093
- "import-x/no-unresolved": "off",
2094
2088
  "unused-imports/no-unused-imports": "off",
2095
2089
  "unused-imports/no-unused-vars": "off",
2096
- "@typescript-eslint/comma-dangle": "off",
2097
- "@typescript-eslint/no-redeclare": "off",
2098
- "@typescript-eslint/no-namespace": "off",
2099
- "@typescript-eslint/no-unused-vars": "off",
2100
- "@typescript-eslint/no-require-imports": "off",
2101
- "@typescript-eslint/no-extraneous-class": "off",
2102
- "@typescript-eslint/no-use-before-define": "off",
2103
- "@typescript-eslint/no-unused-expressions": "off",
2104
- "@typescript-eslint/consistent-type-imports": "off",
2090
+ // disable all type-aware rules of @typescript-eslint
2091
+ ...configs.disableTypeChecked.rules,
2105
2092
  // Overrides rules
2106
2093
  ...options.overrides
2107
2094
  }
2108
2095
  }
2109
2096
  ];
2110
- if (disableTypeAwareLinting) {
2111
- configs2.push({
2112
- ...configs.disableTypeChecked,
2113
- name: "ntnyq/markdown/disable/type-aware",
2114
- files: [GLOB_MARKDOWN_CODE]
2115
- });
2116
- }
2117
2097
  return configs2;
2118
2098
  };
2119
2099
 
2120
2100
  // src/configs/prettier.ts
2121
- var prettier = (options = {}) => {
2101
+ var configPrettier = (options = {}) => {
2122
2102
  const {
2123
2103
  disabledFiles = [GLOB_SVG, GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
2124
2104
  // User defined disabled files
@@ -2128,7 +2108,7 @@ var prettier = (options = {}) => {
2128
2108
  {
2129
2109
  name: "ntnyq/prettier",
2130
2110
  plugins: {
2131
- prettier: default17
2111
+ prettier: default18
2132
2112
  },
2133
2113
  rules: {
2134
2114
  "vue/array-bracket-newline": "off",
@@ -2168,51 +2148,136 @@ var prettier = (options = {}) => {
2168
2148
  "vue/space-infix-ops": "off",
2169
2149
  "vue/space-unary-ops": "off",
2170
2150
  "vue/template-curly-spacing": "off",
2171
- ...default17.configs.recommended.rules,
2172
- "prettier/prettier": options.severity || options.level || "warn",
2151
+ ...default18.configs.recommended.rules,
2152
+ "prettier/prettier": options.severity || "warn",
2153
+ // Overrides rules
2154
+ ...options.overrides
2155
+ }
2156
+ },
2157
+ /**
2158
+ * Languages that prettier currently does not support
2159
+ */
2160
+ {
2161
+ name: "ntnyq/prettier/disabled",
2162
+ files: [...disabledFiles, ...userDisabledFiles],
2163
+ plugins: {
2164
+ prettier: default18
2165
+ },
2166
+ rules: {
2167
+ "prettier/prettier": "off"
2168
+ }
2169
+ }
2170
+ ];
2171
+ };
2172
+
2173
+ // src/configs/specials.ts
2174
+ import globals from "globals";
2175
+ var configSpecials = (options = {}) => {
2176
+ const {
2177
+ // Enable shadcn-vue support
2178
+ shadcnVue: enableShadcnVue = hasShadcnVue()
2179
+ } = options;
2180
+ const configs2 = [
2181
+ {
2182
+ name: "ntnyq/specials/scripts",
2183
+ files: [`**/scripts/${GLOB_SRC}`],
2184
+ rules: {
2185
+ "@typescript-eslint/explicit-function-return-type": "off",
2186
+ "no-console": "off",
2187
+ // Overrides rules
2188
+ ...options.overridesScriptsRules
2189
+ }
2190
+ },
2191
+ {
2192
+ name: "ntnyq/specials/cli",
2193
+ files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
2194
+ rules: {
2195
+ "@typescript-eslint/explicit-function-return-type": "off",
2196
+ "no-console": "off",
2173
2197
  // Overrides rules
2174
- ...options.overrides
2198
+ ...options.overridesCliRules
2175
2199
  }
2176
2200
  },
2177
- /**
2178
- * Languages that prettier currently does not support
2179
- */
2180
2201
  {
2181
- name: "ntnyq/prettier/disabled",
2182
- files: [...disabledFiles, ...userDisabledFiles],
2183
- plugins: {
2184
- prettier: default17
2202
+ name: "ntnyq/specials/bin",
2203
+ files: [`**/bin/${GLOB_SRC}`, `**/bin.${GLOB_SRC_EXT}`],
2204
+ rules: {
2205
+ "@typescript-eslint/explicit-function-return-type": "off",
2206
+ "antfu/no-import-dist": "off",
2207
+ "no-console": "off",
2208
+ // Overrides rules
2209
+ ...options.overridesBinRules
2210
+ }
2211
+ },
2212
+ {
2213
+ name: "ntnyq/specials/userscript",
2214
+ files: [`**/*.user.${GLOB_SRC_EXT}`],
2215
+ languageOptions: {
2216
+ globals: {
2217
+ ...globals.greasemonkey
2218
+ }
2185
2219
  },
2186
2220
  rules: {
2187
- "prettier/prettier": "off"
2221
+ camelcase: [
2222
+ "error",
2223
+ {
2224
+ allow: ["^GM_.+"]
2225
+ }
2226
+ ],
2227
+ // Overrides rules
2228
+ ...options.overridesUserScriptsRules
2188
2229
  }
2189
- }
2190
- ];
2191
- };
2192
-
2193
- // src/configs/stylistic.ts
2194
- var stylistic = async (options = {}) => {
2195
- await ensurePackages(["@stylistic/eslint-plugin"]);
2196
- const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
2197
- return [
2230
+ },
2198
2231
  {
2199
- name: "ntnyq/stylistic",
2232
+ name: "ntnyq/specials/config-file",
2233
+ files: [`**/*.config*.${GLOB_SRC_EXT}`],
2200
2234
  plugins: {
2201
- "@stylistic": pluginStylistic
2235
+ "import-x": default17,
2236
+ perfectionist: default22
2202
2237
  },
2203
2238
  rules: {
2204
- // Only rules are not conflicted with Prettier
2205
- // Use stylistic config to provide type support
2206
- // Overrides rules
2207
- ...options.overrides
2239
+ "@typescript-eslint/explicit-function-return-type": "off",
2240
+ "import-x/no-default-export": "off",
2241
+ "no-console": "off",
2242
+ "perfectionist/sort-objects": [
2243
+ "error",
2244
+ {
2245
+ ...PERFECTIONIST_COMMON_RULE_OPTIONS,
2246
+ ...PERFECTIONIST_EXTRA_RULE_OPTIONS,
2247
+ groups: PERFECTIONIST_SORT_OBJECTS_GROUPS
2248
+ }
2249
+ ],
2250
+ ...options.overridesConfigFileRules
2208
2251
  }
2209
2252
  }
2210
2253
  ];
2254
+ if (enableShadcnVue) {
2255
+ const shadcnOptions = resolveSubOptions(options, "shadcnVue");
2256
+ configs2.push({
2257
+ name: "ntnyq/specials/shadcn-vue",
2258
+ files: shadcnOptions.files || [
2259
+ "**/components/ui/**/*.ts",
2260
+ "**/components/ui/**/*.vue"
2261
+ ],
2262
+ rules: {
2263
+ "@typescript-eslint/consistent-type-imports": "off",
2264
+ "@typescript-eslint/no-unused-vars": "off",
2265
+ "import-x/consistent-type-specifier-style": "off",
2266
+ "vue/define-emits-declaration": "off",
2267
+ // Overrides rules
2268
+ ...shadcnOptions.overridesRules
2269
+ }
2270
+ });
2271
+ }
2272
+ if (options.specialCaseConfigs) {
2273
+ configs2.push(...options.specialCaseConfigs);
2274
+ }
2275
+ return configs2;
2211
2276
  };
2212
2277
 
2213
2278
  // src/configs/gitignore.ts
2214
2279
  import createGitIgnoreConfig from "eslint-config-flat-gitignore";
2215
- var gitignore = (options = {}) => {
2280
+ var configGitIgnore = (options = {}) => {
2216
2281
  options.strict ??= false;
2217
2282
  return [
2218
2283
  {
@@ -2227,27 +2292,27 @@ import jsConfig from "@eslint/js";
2227
2292
  import globals2 from "globals";
2228
2293
  var strictRules = {
2229
2294
  complexity: ["error", { max: 30 }],
2230
- "max-params": ["error", { max: 5 }],
2231
2295
  "max-depth": ["error", { max: 5 }],
2232
- "max-nested-callbacks": ["error", { max: 10 }],
2233
2296
  "max-lines": [
2234
2297
  "error",
2235
2298
  {
2236
2299
  max: 1e3,
2237
- skipComments: true,
2238
- skipBlankLines: true
2300
+ skipBlankLines: true,
2301
+ skipComments: true
2239
2302
  }
2240
2303
  ],
2241
2304
  "max-lines-per-function": [
2242
2305
  "error",
2243
2306
  {
2244
2307
  max: 200,
2245
- skipComments: true,
2246
- skipBlankLines: true
2308
+ skipBlankLines: true,
2309
+ skipComments: true
2247
2310
  }
2248
- ]
2311
+ ],
2312
+ "max-nested-callbacks": ["error", { max: 10 }],
2313
+ "max-params": ["error", { max: 5 }]
2249
2314
  };
2250
- var javascript = (options = {}) => [
2315
+ var configJavaScript = (options = {}) => [
2251
2316
  {
2252
2317
  ...jsConfig.configs.recommended,
2253
2318
  name: "ntnyq/js/recommended"
@@ -2255,38 +2320,50 @@ var javascript = (options = {}) => [
2255
2320
  {
2256
2321
  name: "ntnyq/js/core",
2257
2322
  languageOptions: {
2323
+ sourceType: "module",
2258
2324
  globals: {
2259
2325
  ...globals2.browser,
2260
2326
  ...globals2.es2021,
2261
2327
  ...globals2.node
2262
- },
2263
- sourceType: "module"
2328
+ }
2264
2329
  },
2265
2330
  rules: {
2266
- "require-await": "off",
2331
+ "consistent-return": "off",
2267
2332
  "no-return-assign": "off",
2268
2333
  "no-useless-escape": "off",
2269
- "consistent-return": "off",
2334
+ "require-await": "off",
2270
2335
  // disabled in favor of `perfectionist/sort-named-imports`
2271
2336
  "sort-imports": "off",
2272
2337
  // standard v17.0.0
2273
- "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
2338
+ "accessor-pairs": [
2339
+ "error",
2340
+ { enforceForClassMembers: true, setWithoutGet: true }
2341
+ ],
2342
+ "array-callback-return": "error",
2343
+ "block-scoped-var": "error",
2274
2344
  camelcase: [
2275
2345
  "error",
2276
2346
  {
2277
2347
  allow: ["^UNSAFE_"],
2278
- properties: "never",
2279
- ignoreGlobals: true
2348
+ ignoreGlobals: true,
2349
+ properties: "never"
2280
2350
  }
2281
2351
  ],
2282
2352
  "constructor-super": "error",
2283
2353
  curly: ["error", "multi-line"],
2284
2354
  "default-case-last": "error",
2285
2355
  "dot-notation": ["error", { allowKeywords: true }],
2286
- "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
2356
+ // best-practice
2357
+ eqeqeq: ["error", "smart"],
2358
+ "new-cap": [
2359
+ "error",
2360
+ { capIsNew: false, newIsCap: true, properties: true }
2361
+ ],
2362
+ "no-alert": "error",
2287
2363
  "no-array-constructor": "error",
2288
2364
  "no-async-promise-executor": "error",
2289
2365
  "no-caller": "error",
2366
+ "no-case-declarations": "error",
2290
2367
  "no-class-assign": "error",
2291
2368
  "no-compare-neg-zero": "error",
2292
2369
  "no-cond-assign": "error",
@@ -2299,10 +2376,10 @@ var javascript = (options = {}) => [
2299
2376
  "no-dupe-class-members": "error",
2300
2377
  "no-dupe-keys": "error",
2301
2378
  "no-duplicate-case": "error",
2302
- "no-useless-backreference": "error",
2303
2379
  "no-empty": ["error", { allowEmptyCatch: true }],
2304
2380
  "no-empty-character-class": "error",
2305
2381
  "no-empty-pattern": "error",
2382
+ "no-empty-static-block": "error",
2306
2383
  "no-eval": "error",
2307
2384
  "no-ex-assign": "error",
2308
2385
  "no-extend-native": "error",
@@ -2320,15 +2397,16 @@ var javascript = (options = {}) => [
2320
2397
  "no-lone-blocks": "error",
2321
2398
  "no-loss-of-precision": "error",
2322
2399
  "no-misleading-character-class": "error",
2323
- "no-prototype-builtins": "error",
2324
- "no-useless-catch": "error",
2400
+ "no-multi-str": "error",
2325
2401
  "no-new": "error",
2326
2402
  "no-new-func": "error",
2403
+ "no-new-native-nonconstructor": "error",
2327
2404
  "no-new-wrappers": "error",
2328
2405
  "no-obj-calls": "error",
2329
2406
  "no-octal": "error",
2330
2407
  "no-octal-escape": "error",
2331
2408
  "no-proto": "error",
2409
+ "no-prototype-builtins": "error",
2332
2410
  "no-redeclare": ["error", { builtinGlobals: false }],
2333
2411
  "no-regex-spaces": "error",
2334
2412
  "no-self-assign": ["error", { props: true }],
@@ -2352,8 +2430,8 @@ var javascript = (options = {}) => [
2352
2430
  "error",
2353
2431
  {
2354
2432
  allowShortCircuit: true,
2355
- allowTernary: true,
2356
- allowTaggedTemplates: true
2433
+ allowTaggedTemplates: true,
2434
+ allowTernary: true
2357
2435
  }
2358
2436
  ],
2359
2437
  "no-unused-vars": [
@@ -2365,38 +2443,35 @@ var javascript = (options = {}) => [
2365
2443
  vars: "all"
2366
2444
  }
2367
2445
  ],
2446
+ "no-use-before-define": [
2447
+ "error",
2448
+ {
2449
+ allowNamedExports: false,
2450
+ classes: false,
2451
+ functions: false,
2452
+ variables: true
2453
+ }
2454
+ ],
2455
+ "no-useless-backreference": "error",
2368
2456
  "no-useless-call": "error",
2457
+ "no-useless-catch": "error",
2369
2458
  "no-useless-computed-key": "error",
2370
2459
  "no-useless-constructor": "error",
2371
2460
  "no-useless-rename": "error",
2372
2461
  "no-useless-return": "error",
2373
- "prefer-promise-reject-errors": "error",
2374
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
2375
- "symbol-description": "error",
2376
- "unicode-bom": ["error", "never"],
2377
- "use-isnan": [
2378
- "error",
2379
- {
2380
- enforceForSwitchCase: true,
2381
- enforceForIndexOf: true
2382
- }
2383
- ],
2384
- "valid-typeof": ["error", { requireStringLiterals: true }],
2385
- yoda: ["error", "never"],
2386
2462
  // es6+
2387
2463
  "no-var": "error",
2388
- "prefer-rest-params": "error",
2389
- "prefer-spread": "error",
2390
- "prefer-template": "error",
2391
- "no-empty-static-block": "error",
2392
- "no-new-native-nonconstructor": "error",
2393
- "prefer-const": [
2464
+ "no-void": "error",
2465
+ "no-with": "error",
2466
+ "object-shorthand": [
2394
2467
  "error",
2468
+ "always",
2395
2469
  {
2396
- destructuring: "all",
2397
- ignoreReadBeforeAssign: true
2470
+ avoidQuotes: true,
2471
+ ignoreConstructors: false
2398
2472
  }
2399
2473
  ],
2474
+ "one-var": ["error", "never"],
2400
2475
  "prefer-arrow-callback": [
2401
2476
  "error",
2402
2477
  {
@@ -2404,34 +2479,30 @@ var javascript = (options = {}) => [
2404
2479
  allowUnboundThis: true
2405
2480
  }
2406
2481
  ],
2407
- "object-shorthand": [
2482
+ "prefer-const": [
2408
2483
  "error",
2409
- "always",
2410
2484
  {
2411
- ignoreConstructors: false,
2412
- avoidQuotes: true
2485
+ destructuring: "all",
2486
+ ignoreReadBeforeAssign: true
2413
2487
  }
2414
2488
  ],
2415
- // best-practice
2416
- eqeqeq: ["error", "smart"],
2417
- "array-callback-return": "error",
2418
- "block-scoped-var": "error",
2419
- "no-alert": "error",
2420
- "no-case-declarations": "error",
2421
- "no-multi-str": "error",
2422
- "no-with": "error",
2423
- "no-void": "error",
2424
- "vars-on-top": "error",
2425
- "one-var": ["error", "never"],
2426
- "no-use-before-define": [
2489
+ "prefer-promise-reject-errors": "error",
2490
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
2491
+ "prefer-rest-params": "error",
2492
+ "prefer-spread": "error",
2493
+ "prefer-template": "error",
2494
+ "symbol-description": "error",
2495
+ "unicode-bom": ["error", "never"],
2496
+ "use-isnan": [
2427
2497
  "error",
2428
2498
  {
2429
- functions: false,
2430
- classes: false,
2431
- variables: true,
2432
- allowNamedExports: false
2499
+ enforceForIndexOf: true,
2500
+ enforceForSwitchCase: true
2433
2501
  }
2434
2502
  ],
2503
+ "valid-typeof": ["error", { requireStringLiterals: true }],
2504
+ "vars-on-top": "error",
2505
+ yoda: ["error", "never"],
2435
2506
  // Strict rules
2436
2507
  ...options.strict ? strictRules : {},
2437
2508
  // Overrides rules
@@ -2439,10 +2510,10 @@ var javascript = (options = {}) => [
2439
2510
  }
2440
2511
  }
2441
2512
  ];
2442
- var jsx = () => [
2513
+ var configJSX = () => [
2443
2514
  {
2444
2515
  name: "ntnyq/jsx",
2445
- files: ["**/*.jsx"],
2516
+ files: [GLOB_JSX_ONLY],
2446
2517
  languageOptions: {
2447
2518
  parserOptions: {
2448
2519
  ecmaFeatures: {
@@ -2456,41 +2527,44 @@ var jsx = () => [
2456
2527
  // src/configs/typescript.ts
2457
2528
  import process4 from "node:process";
2458
2529
  var typeAwareRules = {
2530
+ // too strict
2531
+ "@typescript-eslint/strict-boolean-expressions": "off",
2459
2532
  "dot-notation": "off",
2460
- "require-await": "off",
2461
2533
  "no-implied-eval": "off",
2462
2534
  "no-throw-literal": "off",
2463
- // too strict
2464
- "@typescript-eslint/strict-boolean-expressions": "off",
2465
- "@typescript-eslint/require-await": "error",
2466
- "@typescript-eslint/unbound-method": "error",
2467
- "@typescript-eslint/no-unsafe-call": "error",
2535
+ "require-await": "off",
2468
2536
  "@typescript-eslint/await-thenable": "error",
2537
+ "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
2538
+ "@typescript-eslint/no-duplicate-type-constituents": "error",
2539
+ "@typescript-eslint/no-floating-promises": "error",
2469
2540
  "@typescript-eslint/no-for-in-array": "error",
2470
2541
  "@typescript-eslint/no-implied-eval": "error",
2471
- "@typescript-eslint/only-throw-error": "error",
2472
- "@typescript-eslint/no-unsafe-return": "error",
2542
+ "@typescript-eslint/no-misused-promises": "error",
2473
2543
  "@typescript-eslint/no-misused-spread": "error",
2544
+ "@typescript-eslint/no-redundant-type-constituents": "error",
2545
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
2474
2546
  "@typescript-eslint/no-unsafe-argument": "error",
2475
- "@typescript-eslint/no-misused-promises": "error",
2476
2547
  "@typescript-eslint/no-unsafe-assignment": "error",
2477
- "@typescript-eslint/no-floating-promises": "error",
2548
+ "@typescript-eslint/no-unsafe-call": "error",
2549
+ "@typescript-eslint/no-unsafe-member-access": "error",
2550
+ "@typescript-eslint/no-unsafe-return": "error",
2551
+ "@typescript-eslint/only-throw-error": "error",
2478
2552
  "@typescript-eslint/promise-function-async": "error",
2553
+ "@typescript-eslint/require-await": "error",
2479
2554
  "@typescript-eslint/restrict-plus-operands": "error",
2480
- "@typescript-eslint/triple-slash-reference": "error",
2481
- "@typescript-eslint/no-unsafe-member-access": "error",
2482
- "@typescript-eslint/switch-exhaustiveness-check": "error",
2483
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
2484
2555
  "@typescript-eslint/restrict-template-expressions": "error",
2485
- "@typescript-eslint/no-redundant-type-constituents": "error",
2486
- "@typescript-eslint/no-duplicate-type-constituents": "error",
2487
2556
  "@typescript-eslint/return-await": ["error", "in-try-catch"],
2488
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }]
2557
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
2558
+ "@typescript-eslint/triple-slash-reference": "error",
2559
+ "@typescript-eslint/unbound-method": "error"
2489
2560
  };
2490
- var recommendedRules = configs.recommended.reduce((rules, config) => {
2491
- return { ...rules, ...config.rules || {} };
2492
- }, {});
2493
- var typescript = (options = {}) => {
2561
+ var recommendedRules = configs.recommended.reduce(
2562
+ (rules, config) => {
2563
+ return { ...rules, ...config.rules || {} };
2564
+ },
2565
+ {}
2566
+ );
2567
+ var configTypeScript = (options = {}) => {
2494
2568
  const enableTypeAwareLint = !!options?.tsconfigPath;
2495
2569
  const {
2496
2570
  extensions = [],
@@ -2505,25 +2579,25 @@ var typescript = (options = {}) => {
2505
2579
  // Enable typescript in these exts
2506
2580
  ...extensions.map((ext) => `**/*.${ext}`)
2507
2581
  ];
2508
- function createParserConfig(enableTypeAware = false, files2 = [], ignores2 = []) {
2582
+ function createParserConfig(enableTypeAware = false, files2 = [], ignores = []) {
2509
2583
  const typescriptParserOptions = {
2510
2584
  extraFileExtensions: extensions.map((ext) => `.${ext}`),
2511
2585
  sourceType: "module",
2512
2586
  ...enableTypeAware ? {
2587
+ tsconfigRootDir: process4.cwd(),
2513
2588
  projectService: {
2514
2589
  allowDefaultProject: ["./*.js"],
2515
2590
  defaultProject: options.tsconfigPath
2516
- },
2517
- tsconfigRootDir: process4.cwd()
2591
+ }
2518
2592
  } : {},
2519
2593
  ...parserOptions
2520
2594
  };
2521
2595
  const parserConfig = {
2522
2596
  name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
2523
2597
  files: files2,
2524
- ignores: [...ignores2],
2598
+ ignores: [...ignores],
2525
2599
  languageOptions: {
2526
- parser: parserTypeScript,
2600
+ parser,
2527
2601
  parserOptions: typescriptParserOptions
2528
2602
  }
2529
2603
  };
@@ -2534,7 +2608,7 @@ var typescript = (options = {}) => {
2534
2608
  name: "ntnyq/ts/setup",
2535
2609
  plugins: {
2536
2610
  "@typescript-eslint": plugin,
2537
- antfu: default9
2611
+ antfu: default8
2538
2612
  }
2539
2613
  },
2540
2614
  ...enableTypeAwareLint ? [
@@ -2546,100 +2620,103 @@ var typescript = (options = {}) => {
2546
2620
  files,
2547
2621
  rules: {
2548
2622
  ...recommendedRules,
2549
- "@typescript-eslint/no-namespace": "off",
2550
- "@typescript-eslint/no-explicit-any": "off",
2623
+ "@typescript-eslint/consistent-indexed-object-style": "off",
2624
+ "@typescript-eslint/explicit-function-return-type": "off",
2625
+ "@typescript-eslint/explicit-member-accessibility": "off",
2626
+ "@typescript-eslint/explicit-module-boundary-types": "off",
2551
2627
  "@typescript-eslint/naming-convention": "off",
2552
2628
  "@typescript-eslint/no-empty-function": "off",
2629
+ "@typescript-eslint/no-explicit-any": "off",
2630
+ "@typescript-eslint/no-namespace": "off",
2553
2631
  "@typescript-eslint/no-non-null-assertion": "off",
2554
2632
  "@typescript-eslint/triple-slash-reference": "off",
2555
- "@typescript-eslint/explicit-member-accessibility": "off",
2556
- "@typescript-eslint/explicit-function-return-type": "off",
2557
- "@typescript-eslint/explicit-module-boundary-types": "off",
2558
- "@typescript-eslint/consistent-indexed-object-style": "off",
2559
- "@typescript-eslint/prefer-as-const": "warn",
2633
+ "default-param-last": "off",
2560
2634
  // Disabled in favor of enhanced ts rules
2561
2635
  "no-redeclare": "off",
2562
2636
  "no-unused-vars": "off",
2563
- "default-param-last": "off",
2564
2637
  "no-use-before-define": "off",
2565
2638
  "no-useless-constructor": "off",
2566
- "@typescript-eslint/default-param-last": "error",
2567
- "@typescript-eslint/no-useless-constructor": "error",
2568
- "@typescript-eslint/no-redeclare": [
2639
+ "@typescript-eslint/prefer-as-const": "warn",
2640
+ "@typescript-eslint/ban-ts-comment": [
2569
2641
  "error",
2570
2642
  {
2571
- builtinGlobals: false,
2572
- ignoreDeclarationMerge: true
2643
+ minimumDescriptionLength: 1,
2644
+ "ts-check": false,
2645
+ "ts-expect-error": "allow-with-description",
2646
+ "ts-ignore": "allow-with-description",
2647
+ "ts-nocheck": "allow-with-description"
2573
2648
  }
2574
2649
  ],
2575
- "@typescript-eslint/no-use-before-define": [
2650
+ // Extra rules
2651
+ "@typescript-eslint/ban-tslint-comment": "error",
2652
+ "@typescript-eslint/consistent-generic-constructors": [
2653
+ "error",
2654
+ "constructor"
2655
+ ],
2656
+ "@typescript-eslint/consistent-type-assertions": [
2576
2657
  "error",
2577
2658
  {
2578
- functions: false,
2579
- classes: false,
2580
- variables: true,
2581
- allowNamedExports: false,
2582
- enums: true,
2583
- typedefs: false,
2584
- ignoreTypeReferences: false
2659
+ assertionStyle: "as",
2660
+ objectLiteralTypeAssertions: "allow-as-parameter"
2585
2661
  }
2586
2662
  ],
2587
- "@typescript-eslint/no-unused-vars": [
2663
+ "@typescript-eslint/consistent-type-imports": [
2588
2664
  "error",
2589
2665
  {
2590
- // Args after the last used will be reported
2591
- args: "after-used",
2592
- argsIgnorePattern: "^_",
2593
- caughtErrors: "all",
2594
- caughtErrorsIgnorePattern: "^_",
2595
- destructuredArrayIgnorePattern: "^_",
2596
- varsIgnorePattern: "^_",
2597
- ignoreRestSiblings: true
2666
+ disallowTypeAnnotations: false,
2667
+ fixStyle: "separate-type-imports",
2668
+ prefer: "type-imports"
2598
2669
  }
2599
2670
  ],
2600
- // Extra rules
2601
- "@typescript-eslint/ban-tslint-comment": "error",
2602
- "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
2603
- "@typescript-eslint/ban-ts-comment": [
2671
+ "@typescript-eslint/default-param-last": "error",
2672
+ "@typescript-eslint/no-empty-object-type": [
2604
2673
  "error",
2605
2674
  {
2606
- minimumDescriptionLength: 1,
2607
- "ts-check": false,
2608
- "ts-expect-error": "allow-with-description",
2609
- "ts-ignore": "allow-with-description",
2610
- "ts-nocheck": "allow-with-description"
2675
+ allowInterfaces: "always",
2676
+ allowObjectTypes: "always"
2611
2677
  }
2612
2678
  ],
2613
- "@typescript-eslint/no-unused-expressions": [
2679
+ "@typescript-eslint/no-redeclare": [
2614
2680
  "error",
2615
2681
  {
2616
- allowShortCircuit: true,
2617
- allowTernary: true,
2618
- allowTaggedTemplates: true
2682
+ builtinGlobals: false,
2683
+ ignoreDeclarationMerge: true
2619
2684
  }
2620
2685
  ],
2621
- "@typescript-eslint/consistent-type-imports": [
2686
+ "@typescript-eslint/no-unused-expressions": [
2622
2687
  "error",
2623
2688
  {
2624
- prefer: "type-imports",
2625
- fixStyle: "separate-type-imports",
2626
- disallowTypeAnnotations: false
2689
+ allowShortCircuit: true,
2690
+ allowTaggedTemplates: true,
2691
+ allowTernary: true
2627
2692
  }
2628
2693
  ],
2629
- "@typescript-eslint/no-empty-object-type": [
2694
+ "@typescript-eslint/no-unused-vars": [
2630
2695
  "error",
2631
2696
  {
2632
- allowInterfaces: "always",
2633
- allowObjectTypes: "always"
2697
+ // Args after the last used will be reported
2698
+ args: "after-used",
2699
+ argsIgnorePattern: "^_",
2700
+ caughtErrors: "all",
2701
+ caughtErrorsIgnorePattern: "^_",
2702
+ destructuredArrayIgnorePattern: "^_",
2703
+ ignoreRestSiblings: true,
2704
+ varsIgnorePattern: "^_"
2634
2705
  }
2635
2706
  ],
2636
- "@typescript-eslint/consistent-type-assertions": [
2707
+ "@typescript-eslint/no-use-before-define": [
2637
2708
  "error",
2638
2709
  {
2639
- assertionStyle: "as",
2640
- objectLiteralTypeAssertions: "allow-as-parameter"
2710
+ allowNamedExports: false,
2711
+ classes: false,
2712
+ enums: true,
2713
+ functions: false,
2714
+ ignoreTypeReferences: false,
2715
+ typedefs: false,
2716
+ variables: true
2641
2717
  }
2642
2718
  ],
2719
+ "@typescript-eslint/no-useless-constructor": "error",
2643
2720
  // Overrides rules
2644
2721
  ...options.overrides
2645
2722
  }
@@ -2660,20 +2737,26 @@ var typescript = (options = {}) => {
2660
2737
  name: "ntnyq/ts/types",
2661
2738
  files: [...GLOB_TYPES],
2662
2739
  rules: {
2663
- "no-use-before-define": "off",
2664
- "no-restricted-syntax": "off",
2665
- "import-x/no-duplicates": "off",
2740
+ "@typescript-eslint/no-use-before-define": "off",
2666
2741
  "import-x/newline-after-import": "off",
2667
- "@typescript-eslint/no-use-before-define": "off"
2742
+ "import-x/no-duplicates": "off",
2743
+ "no-restricted-syntax": "off",
2744
+ "no-use-before-define": "off",
2745
+ // `var` is special for type extend
2746
+ // e.g: extend globalThis
2747
+ "no-var": "off",
2748
+ "vars-on-top": "off"
2668
2749
  }
2669
2750
  }
2670
2751
  ];
2671
2752
  };
2672
2753
 
2673
2754
  // src/configs/eslintPlugin.ts
2674
- var eslintPlugin = async (options = {}) => {
2755
+ var configESLintPlugin = async (options = {}) => {
2675
2756
  await ensurePackages(["eslint-plugin-eslint-plugin"]);
2676
- const pluginESLintPlugin = await interopDefault(import("eslint-plugin-eslint-plugin"));
2757
+ const pluginESLintPlugin = await interopDefault(
2758
+ import("eslint-plugin-eslint-plugin")
2759
+ );
2677
2760
  return [
2678
2761
  {
2679
2762
  ...pluginESLintPlugin.configs["flat/all"],
@@ -2691,21 +2774,22 @@ var eslintPlugin = async (options = {}) => {
2691
2774
 
2692
2775
  // src/configs/githubAction.ts
2693
2776
  import { createConfig } from "eslint-plugin-github-action";
2694
- var githubAction = (options = {}) => {
2777
+ var configGitHubAction = (options = {}) => {
2695
2778
  const {
2696
- // Support common overrides rules
2779
+ files = [GLOB_GITHUB_ACTION],
2780
+ rules = {},
2697
2781
  overrides: overridesRules = {},
2698
- // Config options
2699
2782
  ...restOptions
2700
2783
  } = options;
2701
2784
  return [
2702
2785
  createConfig({
2703
2786
  name: "ntnyq/github-action",
2704
- files: [GLOB_GITHUB_ACTION],
2787
+ files,
2705
2788
  rules: {
2706
2789
  "github-action/no-invalid-key": "error",
2707
2790
  "github-action/prefer-file-extension": "error",
2708
2791
  "github-action/require-action-name": "error",
2792
+ ...rules,
2709
2793
  ...overridesRules
2710
2794
  },
2711
2795
  ...restOptions
@@ -2714,192 +2798,209 @@ var githubAction = (options = {}) => {
2714
2798
  };
2715
2799
 
2716
2800
  // src/configs/perfectionist.ts
2717
- var sharedGroupsForInterfaceOrObjectTypes = [
2718
- "required-property",
2719
- "optional-property",
2720
- "required-method",
2721
- "optional-method",
2722
- "required-multiline-property",
2723
- "optional-multiline-property",
2724
- "required-multiline-method",
2725
- "optional-multiline-method",
2726
- "unknown",
2727
- "index-signature",
2728
- "multiline-index-signature"
2729
- ];
2730
- var sharedGroupsForIntersectionOrUnion = [
2731
- /**
2732
- * eg. 'foobar', 24, false
2733
- */
2734
- "literal",
2735
- /**
2736
- * eg. number, string
2737
- */
2738
- "keyword",
2739
- /**
2740
- * eg. FooBar
2741
- */
2742
- "named",
2743
- /**
2744
- * eg. Foo & Bar
2745
- */
2746
- "intersection",
2747
- /**
2748
- * eg. Foobar extends string ? Foo : Bar
2749
- */
2750
- "conditional",
2751
- /**
2752
- * eg. (...args: any[]) => void
2753
- */
2754
- "function",
2755
- /**
2756
- * eg. import('eslint').Linter
2757
- */
2758
- "import",
2759
- /**
2760
- * eg. { foo: string; bar: number; }
2761
- */
2762
- "object",
2763
- /**
2764
- * eg. keyof T
2765
- */
2766
- "operator",
2767
- /**
2768
- * eg. [string, number]
2769
- */
2770
- "tuple",
2771
- /**
2772
- * eg. Foo | Bar
2773
- */
2774
- "union",
2775
- /**
2776
- * eg. null | undefined
2777
- */
2778
- "nullish"
2779
- ];
2780
- var defaultSortInterfacesGroups = [...sharedGroupsForInterfaceOrObjectTypes];
2781
- var defaultSortObjectTypesGroups = [...sharedGroupsForInterfaceOrObjectTypes];
2782
- var defaultSortIntersectionTypesGroups = [...sharedGroupsForIntersectionOrUnion];
2783
- var defaultSortUnionTypesGroups = [...sharedGroupsForIntersectionOrUnion];
2784
- var perfectionist = (options = {}) => {
2801
+ var configPerfectionist = (options = {}) => {
2785
2802
  const {
2803
+ partitionByComment = PERFECTIONIST_EXTRA_RULE_OPTIONS.partitionByComment,
2804
+ sortConstants: enableSortConstants = true,
2786
2805
  sortEnums: enableSortEnums = true,
2787
- sortTypes: enableSortTypes = true,
2788
- sortConstants: enableSortConstants = true
2806
+ sortTypes: enableSortTypes = true
2789
2807
  } = options;
2808
+ const commonRuleOptions = {
2809
+ ...PERFECTIONIST_COMMON_RULE_OPTIONS
2810
+ };
2811
+ const commonRuleOptionsWithNewlinesBetween = {
2812
+ ...commonRuleOptions,
2813
+ newlinesBetween: "ignore"
2814
+ };
2815
+ const commonRuleOptionsWithPartitionByComment = {
2816
+ ...commonRuleOptions,
2817
+ partitionByComment
2818
+ };
2819
+ const commonRuleOptionsWithBoth = {
2820
+ ...commonRuleOptionsWithNewlinesBetween,
2821
+ ...commonRuleOptionsWithPartitionByComment
2822
+ };
2823
+ const commonRules = {
2824
+ "perfectionist/sort-exports": [
2825
+ "error",
2826
+ {
2827
+ ...commonRuleOptionsWithPartitionByComment,
2828
+ groupKind: "values-first",
2829
+ type: "line-length"
2830
+ }
2831
+ ],
2832
+ "perfectionist/sort-imports": [
2833
+ "error",
2834
+ {
2835
+ ...commonRuleOptionsWithBoth,
2836
+ groups: PERFECTIONIST_SORT_IMPORTS_GROUPS,
2837
+ internalPattern: ["^~/.+", "^@/.+", "^#.+"]
2838
+ }
2839
+ ],
2840
+ "perfectionist/sort-named-exports": [
2841
+ "error",
2842
+ {
2843
+ ...commonRuleOptionsWithPartitionByComment,
2844
+ groupKind: "values-first",
2845
+ ignoreAlias: false
2846
+ }
2847
+ ],
2848
+ "perfectionist/sort-named-imports": [
2849
+ "error",
2850
+ {
2851
+ ...commonRuleOptionsWithPartitionByComment,
2852
+ groupKind: "values-first",
2853
+ ignoreAlias: false
2854
+ }
2855
+ ]
2856
+ };
2857
+ const sharedRules2 = {
2858
+ "perfectionist/sort-enums": [
2859
+ "error",
2860
+ {
2861
+ ...commonRuleOptionsWithBoth
2862
+ }
2863
+ ]
2864
+ };
2865
+ const sortEnumsRules = {
2866
+ "perfectionist/sort-modules": [
2867
+ "error",
2868
+ {
2869
+ ...commonRuleOptionsWithBoth
2870
+ }
2871
+ ]
2872
+ };
2873
+ const sortTypesRules = {
2874
+ "perfectionist/sort-heritage-clauses": [
2875
+ "error",
2876
+ {
2877
+ ...commonRuleOptions
2878
+ }
2879
+ ],
2880
+ "perfectionist/sort-interfaces": [
2881
+ "error",
2882
+ {
2883
+ ...commonRuleOptionsWithBoth,
2884
+ groups: PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS
2885
+ }
2886
+ ],
2887
+ "perfectionist/sort-intersection-types": [
2888
+ "error",
2889
+ {
2890
+ ...commonRuleOptionsWithBoth,
2891
+ groups: PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS
2892
+ }
2893
+ ],
2894
+ "perfectionist/sort-object-types": [
2895
+ "error",
2896
+ {
2897
+ ...commonRuleOptionsWithBoth,
2898
+ groups: PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS
2899
+ }
2900
+ ],
2901
+ "perfectionist/sort-union-types": [
2902
+ "error",
2903
+ {
2904
+ ...commonRuleOptionsWithBoth,
2905
+ groups: PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS
2906
+ }
2907
+ ]
2908
+ };
2909
+ const sortConstantsRules = {
2910
+ "perfectionist/sort-maps": [
2911
+ "error",
2912
+ {
2913
+ ...commonRuleOptionsWithBoth
2914
+ }
2915
+ ],
2916
+ "perfectionist/sort-objects": [
2917
+ "error",
2918
+ {
2919
+ ...commonRuleOptionsWithBoth,
2920
+ groups: PERFECTIONIST_SORT_OBJECTS_GROUPS
2921
+ }
2922
+ ],
2923
+ "perfectionist/sort-sets": [
2924
+ "error",
2925
+ {
2926
+ ...commonRuleOptionsWithBoth
2927
+ }
2928
+ ]
2929
+ };
2930
+ const extraRules = {
2931
+ "perfectionist/sort-array-includes": [
2932
+ "error",
2933
+ {
2934
+ ...commonRuleOptionsWithBoth,
2935
+ groups: ["literal", "spread"]
2936
+ }
2937
+ ],
2938
+ "perfectionist/sort-classes": [
2939
+ "error",
2940
+ {
2941
+ ...commonRuleOptionsWithBoth,
2942
+ groups: PERFECTIONIST_SORT_CLASSES_GROUPS
2943
+ }
2944
+ ],
2945
+ "perfectionist/sort-decorators": [
2946
+ "error",
2947
+ {
2948
+ ...commonRuleOptionsWithPartitionByComment
2949
+ }
2950
+ ],
2951
+ "perfectionist/sort-jsx-props": [
2952
+ "error",
2953
+ {
2954
+ ...commonRuleOptions,
2955
+ groups: ["shorthand", "multiline", "unknown"]
2956
+ }
2957
+ ],
2958
+ "perfectionist/sort-switch-case": [
2959
+ "error",
2960
+ {
2961
+ ...commonRuleOptions
2962
+ }
2963
+ ],
2964
+ "perfectionist/sort-variable-declarations": [
2965
+ "error",
2966
+ {
2967
+ ...commonRuleOptionsWithPartitionByComment
2968
+ }
2969
+ ]
2970
+ };
2790
2971
  const configs2 = [
2791
2972
  {
2792
- name: "ntnyq/perfectionist/common",
2973
+ name: options.all ? "ntnyq/perfectionist/all" : "ntnyq/perfectionist/common",
2793
2974
  plugins: {
2794
- perfectionist: default19
2975
+ perfectionist: default22
2795
2976
  },
2796
2977
  rules: {
2797
- "perfectionist/sort-imports": [
2798
- "error",
2799
- {
2800
- groups: [
2801
- // Side effect style imports (e.g. 'normalize.css')
2802
- "side-effect-style",
2803
- // Styles (e.g. *.{css,scss,less})
2804
- "style",
2805
- // Node.js built-in modules. (e.g. fs, path)
2806
- "builtin",
2807
- // External modules installed in the project (e.g. vue, lodash)
2808
- "external",
2809
- // Internal modules (e.g. @/utils, @/components)
2810
- "internal",
2811
- // Modules from parent directory (e.g. ../utils)
2812
- "parent",
2813
- // Modules from the same directory (e.g. ./utils)
2814
- "sibling",
2815
- // Main file from the current directory (e.g. ./index)
2816
- "index",
2817
- // TypeScript object-imports (e.g. import log = console.log)
2818
- "object",
2819
- // Side effect imports (e.g. import 'babel-polyfill')
2820
- "side-effect",
2821
- /**
2822
- * Type import at the end
2823
- */
2824
- "builtin-type",
2825
- "external-type",
2826
- "internal-type",
2827
- "parent-type",
2828
- "sibling-type",
2829
- "index-type",
2830
- "type",
2831
- /**
2832
- * Imports that don’t fit into any other group
2833
- */
2834
- "unknown"
2835
- ],
2836
- order: "asc",
2837
- type: "natural",
2838
- ignoreCase: true,
2839
- internalPattern: ["^~/.+", "^@/.+", "^#.+"],
2840
- newlinesBetween: "ignore",
2841
- partitionByComment: true
2842
- }
2843
- ],
2844
- "perfectionist/sort-exports": [
2845
- "error",
2846
- {
2847
- order: "asc",
2848
- type: "line-length",
2849
- groupKind: "values-first",
2850
- partitionByComment: true
2851
- }
2852
- ],
2853
- "perfectionist/sort-named-exports": [
2854
- "error",
2855
- {
2856
- type: "alphabetical",
2857
- order: "asc",
2858
- ignoreCase: true,
2859
- groupKind: "values-first",
2860
- partitionByComment: true
2861
- }
2862
- ],
2863
- "perfectionist/sort-named-imports": [
2864
- "error",
2865
- {
2866
- type: "alphabetical",
2867
- order: "asc",
2868
- ignoreCase: true,
2869
- ignoreAlias: false,
2870
- groupKind: "values-first",
2871
- partitionByComment: true
2872
- }
2873
- ],
2978
+ ...commonRules,
2979
+ ...options.all ? {
2980
+ ...sharedRules2,
2981
+ ...sortEnumsRules,
2982
+ ...sortTypesRules,
2983
+ ...sortConstantsRules,
2984
+ ...extraRules
2985
+ } : {},
2874
2986
  // Overrides rules
2875
2987
  ...options.overrides
2876
2988
  }
2877
2989
  }
2878
2990
  ];
2991
+ if (options.all) {
2992
+ return configs2;
2993
+ }
2879
2994
  if (enableSortEnums) {
2880
2995
  configs2.push({
2881
2996
  name: "ntnyq/perfectionist/enums",
2882
2997
  files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
2883
2998
  plugins: {
2884
- perfectionist: default19
2999
+ perfectionist: default22
2885
3000
  },
2886
3001
  rules: {
2887
- "perfectionist/sort-enums": [
2888
- "error",
2889
- {
2890
- type: "alphabetical",
2891
- order: "asc",
2892
- partitionByComment: true
2893
- }
2894
- ],
2895
- "perfectionist/sort-modules": [
2896
- "error",
2897
- {
2898
- type: "alphabetical",
2899
- order: "asc",
2900
- partitionByComment: true
2901
- }
2902
- ],
3002
+ ...sharedRules2,
3003
+ ...sortEnumsRules,
2903
3004
  // Overrides rules
2904
3005
  ...options.overridesEnumsRules
2905
3006
  }
@@ -2910,60 +3011,11 @@ var perfectionist = (options = {}) => {
2910
3011
  name: "ntnyq/perfectionist/types",
2911
3012
  files: [...GLOB_TYPES],
2912
3013
  plugins: {
2913
- perfectionist: default19
3014
+ perfectionist: default22
2914
3015
  },
2915
3016
  rules: {
2916
- "perfectionist/sort-heritage-clauses": [
2917
- "error",
2918
- {
2919
- type: "alphabetical",
2920
- order: "asc"
2921
- }
2922
- ],
2923
- "perfectionist/sort-interfaces": [
2924
- "error",
2925
- {
2926
- type: "alphabetical",
2927
- order: "asc",
2928
- partitionByComment: true,
2929
- groups: defaultSortInterfacesGroups
2930
- }
2931
- ],
2932
- "perfectionist/sort-intersection-types": [
2933
- "error",
2934
- {
2935
- type: "alphabetical",
2936
- order: "asc",
2937
- partitionByComment: true,
2938
- groups: defaultSortIntersectionTypesGroups
2939
- }
2940
- ],
2941
- "perfectionist/sort-modules": [
2942
- "error",
2943
- {
2944
- type: "alphabetical",
2945
- order: "asc",
2946
- partitionByComment: true
2947
- }
2948
- ],
2949
- "perfectionist/sort-object-types": [
2950
- "error",
2951
- {
2952
- type: "alphabetical",
2953
- order: "asc",
2954
- partitionByComment: true,
2955
- groups: defaultSortObjectTypesGroups
2956
- }
2957
- ],
2958
- "perfectionist/sort-union-types": [
2959
- "error",
2960
- {
2961
- type: "alphabetical",
2962
- order: "asc",
2963
- partitionByComment: true,
2964
- groups: defaultSortUnionTypesGroups
2965
- }
2966
- ],
3017
+ ...sharedRules2,
3018
+ ...sortTypesRules,
2967
3019
  // Overrides rules
2968
3020
  ...options.overridesTypesRules
2969
3021
  }
@@ -2974,42 +3026,11 @@ var perfectionist = (options = {}) => {
2974
3026
  name: "ntnyq/perfectionist/constants",
2975
3027
  files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
2976
3028
  plugins: {
2977
- perfectionist: default19
3029
+ perfectionist: default22
2978
3030
  },
2979
3031
  rules: {
2980
- "perfectionist/sort-maps": [
2981
- "error",
2982
- {
2983
- type: "alphabetical",
2984
- order: "asc",
2985
- partitionByComment: true
2986
- }
2987
- ],
2988
- "perfectionist/sort-objects": [
2989
- "error",
2990
- {
2991
- type: "alphabetical",
2992
- order: "asc",
2993
- partitionByComment: true,
2994
- groups: ["unknown", "method", "multiline"]
2995
- }
2996
- ],
2997
- "perfectionist/sort-sets": [
2998
- "error",
2999
- {
3000
- type: "alphabetical",
3001
- order: "asc",
3002
- partitionByComment: true
3003
- }
3004
- ],
3005
- "perfectionist/sort-modules": [
3006
- "error",
3007
- {
3008
- type: "alphabetical",
3009
- order: "asc",
3010
- partitionByComment: true
3011
- }
3012
- ],
3032
+ ...sharedRules2,
3033
+ ...sortConstantsRules,
3013
3034
  // Overrides rules
3014
3035
  ...options.overridesConstantsRules
3015
3036
  }
@@ -3019,11 +3040,11 @@ var perfectionist = (options = {}) => {
3019
3040
  };
3020
3041
 
3021
3042
  // src/configs/unusedImports.ts
3022
- var unusedImports = (options = {}) => [
3043
+ var configUnusedImports = (options = {}) => [
3023
3044
  {
3024
3045
  name: "ntnyq/unused-imports",
3025
3046
  plugins: {
3026
- "unused-imports": default20
3047
+ "unused-imports": default23
3027
3048
  },
3028
3049
  rules: {
3029
3050
  "@typescript-eslint/no-unused-vars": "off",
@@ -3031,14 +3052,14 @@ var unusedImports = (options = {}) => [
3031
3052
  "unused-imports/no-unused-vars": [
3032
3053
  "error",
3033
3054
  {
3034
- vars: "all",
3035
- varsIgnorePattern: "^_",
3036
3055
  args: "after-used",
3037
3056
  argsIgnorePattern: "^_",
3038
- ignoreRestSiblings: true,
3039
- destructuredArrayIgnorePattern: "^_",
3040
3057
  caughtErrors: "all",
3041
- caughtErrorsIgnorePattern: "^_"
3058
+ caughtErrorsIgnorePattern: "^_",
3059
+ destructuredArrayIgnorePattern: "^_",
3060
+ ignoreRestSiblings: true,
3061
+ vars: "all",
3062
+ varsIgnorePattern: "^_"
3042
3063
  }
3043
3064
  ],
3044
3065
  // Overrides rules
@@ -3047,6 +3068,25 @@ var unusedImports = (options = {}) => [
3047
3068
  }
3048
3069
  ];
3049
3070
 
3071
+ // src/configs/eslintComments.ts
3072
+ var configESLintComments = (options = {}) => [
3073
+ {
3074
+ name: "ntnyq/eslint-comments",
3075
+ plugins: {
3076
+ "@eslint-community/eslint-comments": default24
3077
+ },
3078
+ rules: {
3079
+ ...default24.configs.recommended.rules,
3080
+ "@eslint-community/eslint-comments/disable-enable-pair": [
3081
+ "error",
3082
+ { allowWholeFile: true }
3083
+ ],
3084
+ // Overrides rules
3085
+ ...options.overrides
3086
+ }
3087
+ }
3088
+ ];
3089
+
3050
3090
  // src/core.ts
3051
3091
  function defineESLintConfig(options = {}, ...userConfigs) {
3052
3092
  const {
@@ -3057,11 +3097,11 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3057
3097
  /**
3058
3098
  * Conditional by deps
3059
3099
  */
3060
- vue: enableVue = hasVue,
3061
- pinia: enablePinia = hasPinia,
3062
- test: enableTest = hasVitest,
3063
- unocss: enableUnoCSS = hasUnoCSS,
3064
- typescript: enableTypeScript = hasTypeScript,
3100
+ vue: enableVue = hasVue(),
3101
+ pinia: enablePinia = hasPinia(),
3102
+ test: enableTest = hasVitest(),
3103
+ unocss: enableUnoCSS = hasUnoCSS(),
3104
+ typescript: enableTypeScript = hasTypeScript(),
3065
3105
  /**
3066
3106
  * Enabled by default
3067
3107
  */
@@ -3074,6 +3114,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3074
3114
  depend: enableDepend = true,
3075
3115
  regexp: enableRegexp = true,
3076
3116
  unicorn: enableUnicorn = true,
3117
+ deMorgan: enableDeMorgan = true,
3077
3118
  prettier: enablePrettier = true,
3078
3119
  markdown: enableMarkdown = true,
3079
3120
  gitignore: enableGitIgnore = true,
@@ -3081,7 +3122,6 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3081
3122
  perfectionist: enablePerfectionist = true,
3082
3123
  // disabled by default
3083
3124
  svgo: enableSVGO = false,
3084
- stylistic: enableStylistic = false,
3085
3125
  eslintPlugin: enableESLintPlugin = false
3086
3126
  } = options;
3087
3127
  const configs2 = [];
@@ -3089,36 +3129,36 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3089
3129
  supportedExtensions.push("vue");
3090
3130
  }
3091
3131
  if (enableGitIgnore) {
3092
- configs2.push(gitignore(resolveSubOptions(options, "gitignore")));
3132
+ configs2.push(configGitIgnore(resolveSubOptions(options, "gitignore")));
3093
3133
  }
3094
3134
  configs2.push(
3095
- ignores(options.ignores),
3096
- jsx(),
3097
- node({
3135
+ configIgnores(options.ignores),
3136
+ configJSX(),
3137
+ configNode({
3098
3138
  overrides: getOverrides(options, "node")
3099
3139
  }),
3100
- command(resolveSubOptions(options, "command")),
3101
- importX({
3140
+ configCommand(resolveSubOptions(options, "command")),
3141
+ configImportX({
3102
3142
  ...resolveSubOptions(options, "importX"),
3103
3143
  typescript: !!enableTypeScript,
3104
3144
  overrides: getOverrides(options, "importX")
3105
3145
  }),
3106
- jsdoc({
3146
+ configJsdoc({
3107
3147
  typescript: !!enableTypeScript,
3108
3148
  overrides: getOverrides(options, "jsdoc"),
3109
3149
  ...resolveSubOptions(options, "jsdoc")
3110
3150
  }),
3111
- comments({
3112
- overrides: getOverrides(options, "comments")
3151
+ configESLintComments({
3152
+ overrides: getOverrides(options, "eslintComments")
3113
3153
  }),
3114
- javascript({
3154
+ configJavaScript({
3115
3155
  ...resolveSubOptions(options, "javascript"),
3116
3156
  overrides: getOverrides(options, "javascript")
3117
3157
  })
3118
3158
  );
3119
3159
  if (enablePerfectionist) {
3120
3160
  configs2.push(
3121
- perfectionist({
3161
+ configPerfectionist({
3122
3162
  ...resolveSubOptions(options, "perfectionist"),
3123
3163
  overrides: getOverrides(options, "perfectionist")
3124
3164
  })
@@ -3126,22 +3166,29 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3126
3166
  }
3127
3167
  if (enableUnicorn) {
3128
3168
  configs2.push(
3129
- unicorn({
3169
+ configUnicorn({
3130
3170
  overrides: getOverrides(options, "unicorn")
3131
3171
  })
3132
3172
  );
3133
3173
  }
3134
3174
  if (enablePinia) {
3135
3175
  configs2.push(
3136
- pinia({
3176
+ configPinia({
3137
3177
  ...resolveSubOptions(options, "pinia"),
3138
3178
  overrides: getOverrides(options, "pinia")
3139
3179
  })
3140
3180
  );
3141
3181
  }
3182
+ if (enableDeMorgan) {
3183
+ configs2.push(
3184
+ configDeMorgan({
3185
+ overrides: getOverrides(options, "deMorgan")
3186
+ })
3187
+ );
3188
+ }
3142
3189
  if (enableRegexp) {
3143
3190
  configs2.push(
3144
- regexp({
3191
+ configRegexp({
3145
3192
  ...resolveSubOptions(options, "regexp"),
3146
3193
  overrides: getOverrides(options, "regexp")
3147
3194
  })
@@ -3149,7 +3196,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3149
3196
  }
3150
3197
  if (enableTypeScript) {
3151
3198
  configs2.push(
3152
- typescript({
3199
+ configTypeScript({
3153
3200
  ...resolveSubOptions(options, "typescript"),
3154
3201
  extensions: supportedExtensions,
3155
3202
  overrides: getOverrides(options, "typescript")
@@ -3158,7 +3205,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3158
3205
  }
3159
3206
  if (enableVue) {
3160
3207
  configs2.push(
3161
- vue({
3208
+ configVue({
3162
3209
  ...resolveSubOptions(options, "vue"),
3163
3210
  typescript: !!enableTypeScript,
3164
3211
  overrides: getOverrides(options, "vue")
@@ -3167,48 +3214,49 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3167
3214
  }
3168
3215
  if (enableYML) {
3169
3216
  configs2.push(
3170
- yml({
3217
+ configYml({
3218
+ ...resolveSubOptions(options, "yml"),
3171
3219
  overrides: getOverrides(options, "yml")
3172
3220
  })
3173
3221
  );
3174
3222
  }
3175
3223
  if (enableTOML) {
3176
3224
  configs2.push(
3177
- toml({
3225
+ configToml({
3226
+ ...resolveSubOptions(options, "toml"),
3178
3227
  overrides: getOverrides(options, "toml")
3179
3228
  })
3180
3229
  );
3181
3230
  }
3182
3231
  if (enableJSONC) {
3183
3232
  configs2.push(
3184
- jsonc({
3233
+ configJsonc({
3234
+ ...resolveSubOptions(options, "jsonc"),
3185
3235
  overrides: getOverrides(options, "jsonc")
3186
3236
  })
3187
3237
  );
3188
3238
  }
3189
3239
  if (enableSort) {
3190
- configs2.push(sort(resolveSubOptions(options, "sort")));
3240
+ configs2.push(configSort(resolveSubOptions(options, "sort")));
3191
3241
  }
3192
3242
  if (enableTest) {
3193
3243
  configs2.push(
3194
- test({
3195
- overrides: getOverrides(options, "test")
3196
- }),
3197
- vitest({
3244
+ configTest({
3245
+ ...resolveSubOptions(options, "test"),
3198
3246
  overrides: getOverrides(options, "test")
3199
3247
  })
3200
3248
  );
3201
3249
  }
3202
3250
  if (enableUnoCSS) {
3203
3251
  configs2.push(
3204
- unocss({
3252
+ configUnoCSS({
3205
3253
  overrides: getOverrides(options, "unocss")
3206
3254
  })
3207
3255
  );
3208
3256
  }
3209
3257
  if (enableMarkdown) {
3210
3258
  configs2.push(
3211
- markdown({
3259
+ configMarkdown({
3212
3260
  ...resolveSubOptions(options, "markdown"),
3213
3261
  extensions: supportedExtensions,
3214
3262
  overrides: getOverrides(options, "markdown")
@@ -3217,14 +3265,14 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3217
3265
  }
3218
3266
  if (enableAntfu) {
3219
3267
  configs2.push(
3220
- antfu({
3268
+ configAntfu({
3221
3269
  overrides: getOverrides(options, "antfu")
3222
3270
  })
3223
3271
  );
3224
3272
  }
3225
3273
  if (enableDepend) {
3226
3274
  configs2.push(
3227
- depend({
3275
+ configDepend({
3228
3276
  ...resolveSubOptions(options, "depend"),
3229
3277
  overrides: getOverrides(options, "depend")
3230
3278
  })
@@ -3232,50 +3280,42 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3232
3280
  }
3233
3281
  if (enableNtnyq) {
3234
3282
  configs2.push(
3235
- ntnyq({
3283
+ configNtnyq({
3236
3284
  overrides: getOverrides(options, "ntnyq")
3237
3285
  })
3238
3286
  );
3239
3287
  }
3240
3288
  if (enableGitHubAction) {
3241
3289
  configs2.push(
3242
- githubAction({
3290
+ configGitHubAction({
3243
3291
  overrides: getOverrides(options, "githubAction")
3244
3292
  })
3245
3293
  );
3246
3294
  }
3247
3295
  if (enableESLintPlugin) {
3248
3296
  configs2.push(
3249
- eslintPlugin({
3297
+ configESLintPlugin({
3250
3298
  overrides: getOverrides(options, "eslintPlugin")
3251
3299
  })
3252
3300
  );
3253
3301
  }
3254
- if (enableStylistic) {
3255
- configs2.push(
3256
- stylistic({
3257
- overrides: getOverrides(options, "stylistic")
3258
- })
3259
- );
3260
- }
3261
3302
  if (enableSVGO) {
3262
- configs2.push(svgo(resolveSubOptions(options, "svgo")));
3303
+ configs2.push(configSVGO(resolveSubOptions(options, "svgo")));
3263
3304
  }
3264
- const configSpecials = specials(resolveSubOptions(options, "specials"));
3265
- const configPrettier = enablePrettier ? prettier({
3305
+ const specialsConfigs = configSpecials(resolveSubOptions(options, "specials"));
3306
+ const prettierConfigs = enablePrettier ? configPrettier({
3266
3307
  ...resolveSubOptions(options, "prettier"),
3267
3308
  overrides: getOverrides(options, "prettier")
3268
3309
  }) : [];
3269
3310
  const composer = new FlatConfigComposer(
3270
3311
  ...configs2,
3271
3312
  ...userConfigs,
3272
- ...configSpecials,
3273
- ...configPrettier
3313
+ ...specialsConfigs,
3314
+ ...prettierConfigs
3274
3315
  );
3275
3316
  return composer;
3276
3317
  }
3277
3318
  export {
3278
- DEFAULT_PRETTIER_OPTIONS,
3279
3319
  GLOB_ALL_SRC,
3280
3320
  GLOB_ASTRO,
3281
3321
  GLOB_ASTRO_TS,
@@ -3290,6 +3330,7 @@ export {
3290
3330
  GLOB_JSON5,
3291
3331
  GLOB_JSONC,
3292
3332
  GLOB_JSX,
3333
+ GLOB_JSX_ONLY,
3293
3334
  GLOB_LESS,
3294
3335
  GLOB_LOCKFILE,
3295
3336
  GLOB_MARKDOWN,
@@ -3308,93 +3349,105 @@ export {
3308
3349
  GLOB_TEST,
3309
3350
  GLOB_TOML,
3310
3351
  GLOB_TS,
3352
+ GLOB_TSCONFIG_JSON,
3311
3353
  GLOB_TSX,
3354
+ GLOB_TSX_ONLY,
3312
3355
  GLOB_TYPES,
3356
+ GLOB_TYPE_TEST,
3313
3357
  GLOB_VUE,
3314
3358
  GLOB_YAML,
3315
- antfu,
3359
+ PERFECTIONIST_COMMON_RULE_OPTIONS,
3360
+ PERFECTIONIST_EXTRA_RULE_OPTIONS,
3361
+ PERFECTIONIST_SORT_CLASSES_GROUPS,
3362
+ PERFECTIONIST_SORT_IMPORTS_GROUPS,
3363
+ PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS,
3364
+ PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS,
3365
+ PERFECTIONIST_SORT_OBJECTS_GROUPS,
3366
+ PRETTIER_DEFAULT_OPTIONS,
3316
3367
  combineConfigs,
3317
- command,
3318
- comments,
3368
+ configAntfu,
3369
+ configCommand,
3370
+ configDeMorgan,
3371
+ configDepend,
3372
+ configESLintComments,
3373
+ configESLintPlugin,
3374
+ configFormat,
3375
+ configGitHubAction,
3376
+ configGitIgnore,
3377
+ configIgnores,
3378
+ configImportX,
3379
+ configJSX,
3380
+ configJavaScript,
3381
+ configJsdoc,
3382
+ configJsonc,
3383
+ configMarkdown,
3384
+ configNode,
3385
+ configNtnyq,
3386
+ configPerfectionist,
3387
+ configPinia,
3388
+ configPrettier,
3389
+ configRegexp,
3390
+ configSVGO,
3391
+ configSort,
3392
+ configSpecials,
3393
+ configTest,
3394
+ configToml,
3395
+ configTypeScript,
3396
+ configUnicorn,
3397
+ configUnoCSS,
3398
+ configUnusedImports,
3399
+ configVue,
3400
+ configYml,
3401
+ configs as configsTypeScript,
3319
3402
  createNodeResolver,
3320
3403
  createTypeScriptImportResolver,
3321
3404
  defineESLintConfig,
3322
- depend,
3323
3405
  ensurePackages,
3324
- esX,
3325
- eslintPlugin,
3326
- format,
3327
3406
  getOverrides,
3328
- githubAction,
3329
- gitignore,
3330
3407
  hasPinia,
3331
3408
  hasShadcnVue,
3332
3409
  hasTypeScript,
3333
3410
  hasUnoCSS,
3334
3411
  hasVitest,
3335
3412
  hasVue,
3336
- ignores,
3337
- importX,
3338
3413
  interopDefault,
3339
3414
  isInGitHooksOrRunByNanoStagedOrRunByTSX,
3340
- javascript,
3341
- jsdoc,
3342
- jsonc,
3343
- jsx,
3344
- markdown,
3345
3415
  mergePrettierOptions,
3346
3416
  mergeProcessors,
3347
- node,
3348
- ntnyq,
3349
3417
  parserJsonc,
3350
3418
  parserPlain,
3351
3419
  parserToml,
3352
- parserTypeScript,
3420
+ parser as parserTypeScript,
3353
3421
  parserVue,
3354
3422
  parserYaml,
3355
- perfectionist,
3356
- pinia,
3357
- default9 as pluginAntfu,
3358
- default21 as pluginComments,
3423
+ default8 as pluginAntfu,
3424
+ default24 as pluginComments,
3425
+ default19 as pluginDeMorgan,
3359
3426
  pluginDepend,
3360
- default12 as pluginFormat,
3361
- default18 as pluginGitHubAction,
3362
- default16 as pluginImportX,
3363
- default10 as pluginJsdoc,
3364
- default11 as pluginJsonc,
3365
- default8 as pluginMarkdown,
3427
+ default13 as pluginFormat,
3428
+ default21 as pluginGitHubAction,
3429
+ default17 as pluginImportX,
3430
+ default9 as pluginJsdoc,
3431
+ default10 as pluginJsonc,
3432
+ default7 as pluginMarkdown,
3433
+ default20 as pluginNoOnlyTests,
3366
3434
  default2 as pluginNode,
3367
- default19 as pluginPerfectionist,
3368
- default7 as pluginPinia,
3369
- default17 as pluginPrettier,
3435
+ default12 as pluginNtnyq,
3436
+ default22 as pluginPerfectionist,
3437
+ default11 as pluginPinia,
3438
+ default18 as pluginPrettier,
3370
3439
  pluginRegexp,
3371
3440
  default5 as pluginSvgo,
3372
3441
  default6 as pluginToml,
3373
3442
  plugin as pluginTypeScript,
3374
- default15 as pluginUnicorn,
3375
- default13 as pluginUnoCSS,
3376
- default20 as pluginUnusedImports,
3377
- default14 as pluginVitest,
3443
+ default16 as pluginUnicorn,
3444
+ default14 as pluginUnoCSS,
3445
+ default23 as pluginUnusedImports,
3446
+ default15 as pluginVitest,
3378
3447
  default3 as pluginVue,
3379
- default4 as pluginYaml,
3380
- prettier,
3448
+ default4 as pluginYml,
3381
3449
  processorPassThrough,
3382
- default22 as processorVueBlocks,
3383
- regexp,
3450
+ default25 as processorVueBlocks,
3384
3451
  resolveSubOptions,
3385
- sort,
3386
- specials,
3387
- stylistic,
3388
- svgo,
3389
- test,
3390
- toArray,
3391
- toml,
3392
- typescript,
3393
- configs as typescriptConfigs,
3394
- unicorn,
3395
- unocss,
3396
- unusedImports,
3397
- vitest,
3398
- vue,
3399
- yml
3452
+ toArray
3400
3453
  };