@ntnyq/eslint-config 4.0.0-beta.1 → 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.
Files changed (4) hide show
  1. package/README.md +15 -10
  2. package/dist/index.d.ts +15451 -14302
  3. package/dist/index.js +1443 -1152
  4. package/package.json +56 -42
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 = [
@@ -178,58 +187,50 @@ var GLOB_EXCLUDE = [
178
187
  // src/configs/vue.ts
179
188
  var sharedRules = {
180
189
  ...default3.configs.base.rules,
181
- ...default3.configs["vue3-essential"].rules,
182
- ...default3.configs["vue3-strongly-recommended"].rules,
183
- ...default3.configs["vue3-recommended"].rules
190
+ ...default3.configs.essential.rules,
191
+ ...default3.configs["strongly-recommended"].rules,
192
+ ...default3.configs.recommended.rules
184
193
  };
185
194
  var disabledRules = {
186
- "vue/no-v-html": "off",
187
- "vue/require-prop-types": "off",
188
- "vue/require-default-prop": "off",
189
195
  "vue/multi-word-component-names": "off",
196
+ "vue/no-setup-props-reactivity-loss": "off",
197
+ "vue/no-v-html": "off",
190
198
  "vue/no-v-text-v-html-on-component": "off",
191
- "vue/no-setup-props-reactivity-loss": "off"
199
+ "vue/require-default-prop": "off",
200
+ "vue/require-prop-types": "off"
192
201
  };
193
202
  var extensionRules = {
194
- "vue/prefer-template": "error",
195
- "vue/no-sparse-arrays": "error",
196
- "vue/no-empty-pattern": "error",
197
- "vue/space-infix-ops": "error",
198
- "vue/no-loss-of-precision": "error",
199
- "vue/no-constant-condition": "error",
200
- "vue/template-curly-spacing": "error",
201
- "vue/eqeqeq": ["error", "smart"],
202
- "vue/comma-style": ["error", "last"],
203
- "vue/block-spacing": ["error", "always"],
204
- "vue/dot-location": ["error", "property"],
205
- "vue/space-in-parens": ["error", "never"],
206
- "vue/operator-linebreak": ["error", "before"],
207
- "vue/no-extra-parens": ["error", "functions"],
208
203
  "vue/array-bracket-spacing": ["error", "never"],
209
- "vue/object-curly-spacing": ["error", "always"],
210
- "vue/comma-dangle": ["error", "always-multiline"],
211
- "vue/quote-props": ["error", "consistent-as-needed"],
212
- "vue/arrow-spacing": ["error", { before: true, after: true }],
204
+ "vue/arrow-spacing": ["error", { after: true, before: true }],
205
+ "vue/block-spacing": ["error", "always"],
213
206
  "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
214
- "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"],
215
211
  "vue/dot-notation": ["error", { allowKeywords: true }],
216
- "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
217
- "vue/keyword-spacing": ["error", { before: true, after: true }],
218
- "vue/no-restricted-syntax": ["error", "DebuggerStatement", "LabeledStatement", "WithStatement"],
219
- "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": [
220
220
  "error",
221
- {
222
- words: true,
223
- nonwords: false
224
- }
221
+ "DebuggerStatement",
222
+ "LabeledStatement",
223
+ "WithStatement"
225
224
  ],
225
+ "vue/no-sparse-arrays": "error",
226
226
  "vue/object-curly-newline": [
227
227
  "error",
228
228
  {
229
- multiline: true,
230
- consistent: true
229
+ consistent: true,
230
+ multiline: true
231
231
  }
232
232
  ],
233
+ "vue/object-curly-spacing": ["error", "always"],
233
234
  "vue/object-property-newline": [
234
235
  "error",
235
236
  {
@@ -240,133 +241,152 @@ var extensionRules = {
240
241
  "error",
241
242
  "always",
242
243
  {
243
- ignoreConstructors: false,
244
- avoidQuotes: true
244
+ avoidQuotes: true,
245
+ ignoreConstructors: false
245
246
  }
246
- ]
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"
247
261
  };
248
262
  var unCategorizedRules = {
249
- "vue/no-v-text": "error",
250
- "vue/no-useless-v-bind": "error",
251
- "vue/valid-define-options": "error",
252
- "vue/prefer-define-options": "error",
253
- "vue/prefer-use-template-ref": "error",
254
- "vue/no-irregular-whitespace": "error",
255
- "vue/no-use-v-else-with-v-for": "error",
256
- "vue/no-deprecated-delete-set": "error",
257
- "vue/no-empty-component-block": "error",
258
- "vue/require-typed-object-prop": "error",
259
- "vue/no-unused-emit-declarations": "error",
260
- "vue/padding-line-between-blocks": "error",
261
- "vue/no-multiple-objects-in-class": "error",
262
- "vue/prefer-separate-static-class": "error",
263
- "vue/no-ref-object-reactivity-loss": "error",
264
- "vue/prefer-prop-type-boolean-first": "error",
265
- "vue/html-comment-indent": ["error", 2],
266
- "vue/next-tick-style": ["error", "promise"],
267
- "vue/v-for-delimiter-style": ["error", "in"],
268
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
269
- "vue/slot-name-casing": ["error", "kebab-case"],
270
- "vue/custom-event-name-casing": ["error", "camelCase"],
271
- "vue/define-props-declaration": ["error", "type-based"],
272
- "vue/define-emits-declaration": ["error", "type-literal"],
273
- "vue/prefer-true-attribute-shorthand": ["error", "always"],
274
- "vue/component-options-name-casing": ["error", "PascalCase"],
275
- "vue/component-api-style": ["error", ["script-setup", "composition"]],
276
- "vue/html-button-has-type": [
263
+ "vue/block-order": [
277
264
  "error",
278
265
  {
279
- button: true,
280
- submit: true,
281
- reset: true
266
+ order: ["script", "template", "style"]
282
267
  }
283
268
  ],
284
- "vue/no-duplicate-attr-inheritance": [
269
+ "vue/block-tag-newline": [
285
270
  "error",
286
271
  {
287
- checkMultiRootNodes: true
272
+ multiline: "always",
273
+ singleline: "always"
288
274
  }
289
275
  ],
290
- "vue/block-order": [
276
+ "vue/component-api-style": ["error", ["script-setup", "composition"]],
277
+ "vue/component-name-in-template-casing": [
291
278
  "error",
279
+ "PascalCase",
292
280
  {
293
- order: ["script", "template", "style"]
281
+ ignores: ["slot", "component"],
282
+ // Force auto-import components to be PascalCase
283
+ registeredComponentsOnly: false
294
284
  }
295
285
  ],
296
- "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": [
297
290
  "error",
298
291
  {
299
- allow: ["scoped", "plain"]
292
+ defineExposeLast: true,
293
+ order: [
294
+ "defineProps",
295
+ "defineEmits",
296
+ "defineOptions",
297
+ "defineSlots",
298
+ "defineModel"
299
+ ]
300
300
  }
301
301
  ],
302
- "vue/block-tag-newline": [
302
+ "vue/define-props-declaration": ["error", "type-based"],
303
+ "vue/enforce-style-attribute": [
303
304
  "error",
304
305
  {
305
- singleline: "always",
306
- multiline: "always"
306
+ allow: ["scoped", "plain"]
307
307
  }
308
308
  ],
309
- "vue/no-required-prop-with-default": [
309
+ "vue/html-button-has-type": [
310
310
  "error",
311
311
  {
312
- autofix: true
312
+ button: true,
313
+ reset: true,
314
+ submit: true
313
315
  }
314
316
  ],
315
317
  "vue/html-comment-content-newline": [
316
318
  "error",
317
319
  {
318
- singleline: "ignore",
319
- multiline: "always"
320
+ multiline: "always",
321
+ singleline: "ignore"
320
322
  },
321
323
  {
322
324
  exceptions: ["*"]
323
325
  }
324
326
  ],
325
- "vue/no-static-inline-styles": [
327
+ "vue/html-comment-content-spacing": [
326
328
  "error",
329
+ "always",
327
330
  {
328
- allowBinding: true
331
+ exceptions: ["-"]
329
332
  }
330
333
  ],
334
+ "vue/html-comment-indent": ["error", 2],
335
+ "vue/next-tick-style": ["error", "promise"],
336
+ "vue/no-deprecated-delete-set": "error",
331
337
  "vue/no-deprecated-model-definition": [
332
338
  "error",
333
339
  {
334
340
  allowVue3Compat: true
335
341
  }
336
342
  ],
337
- "vue/component-name-in-template-casing": [
343
+ "vue/no-duplicate-attr-inheritance": [
338
344
  "error",
339
- "PascalCase",
340
345
  {
341
- // Force auto-import components to be PascalCase
342
- registeredComponentsOnly: false,
343
- ignores: ["slot", "component"]
346
+ checkMultiRootNodes: true
344
347
  }
345
348
  ],
346
- "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": [
347
354
  "error",
348
355
  {
349
- order: ["defineProps", "defineEmits", "defineOptions", "defineSlots", "defineModel"],
350
- defineExposeLast: true
356
+ autofix: true
351
357
  }
352
358
  ],
353
- "vue/html-comment-content-spacing": [
359
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
360
+ "vue/no-static-inline-styles": [
354
361
  "error",
355
- "always",
356
362
  {
357
- exceptions: ["-"]
363
+ allowBinding: true
358
364
  }
359
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",
360
376
  "vue/require-macro-variable-name": [
361
377
  "error",
362
378
  {
363
- defineProps: "props",
364
379
  defineEmits: "emits",
380
+ defineProps: "props",
365
381
  defineSlots: "slots",
366
- useSlots: "slots",
367
- useAttrs: "attrs"
382
+ useAttrs: "attrs",
383
+ useSlots: "slots"
368
384
  }
369
- ]
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"
370
390
  };
371
391
  var configVue = (options = {}) => {
372
392
  const { files = [GLOB_VUE] } = options;
@@ -376,7 +396,7 @@ var configVue = (options = {}) => {
376
396
  if (!sfcBlocks) return processorVueSFC;
377
397
  return mergeProcessors2([
378
398
  processorVueSFC,
379
- default22({
399
+ default25({
380
400
  ...sfcBlocks,
381
401
  blocks: {
382
402
  styles: true,
@@ -389,45 +409,32 @@ var configVue = (options = {}) => {
389
409
  {
390
410
  name: "ntnyq/vue/setup",
391
411
  plugins: {
392
- vue: default3,
393
- "@typescript-eslint": plugin
412
+ "@typescript-eslint": plugin,
413
+ vue: default3
394
414
  }
395
415
  },
396
416
  {
397
417
  name: "ntnyq/vue/rules",
398
418
  files,
419
+ processor: getVueProcessor(),
399
420
  languageOptions: {
400
421
  parser: parserVue,
401
422
  parserOptions: {
402
- sourceType: "module",
403
423
  ecmaVersion: "latest",
404
424
  extraFileExtensions: [".vue"],
405
- parser: parserTypeScript,
425
+ parser,
426
+ sourceType: "module",
406
427
  ecmaFeatures: {
407
428
  jsx: true
408
429
  }
409
430
  }
410
431
  },
411
- processor: getVueProcessor(),
412
432
  rules: {
413
433
  ...sharedRules,
414
- "vue/html-self-closing": [
415
- "error",
416
- {
417
- html: {
418
- void: "always",
419
- normal: "always",
420
- component: "always"
421
- },
422
- svg: "always",
423
- math: "always"
424
- }
425
- ],
426
- "vue/this-in-template": ["error", "never"],
427
- "vue/prop-name-casing": ["error", "camelCase"],
428
434
  "vue/attributes-order": [
429
435
  "error",
430
436
  {
437
+ alphabetical: false,
431
438
  order: [
432
439
  "EVENTS",
433
440
  // `@click="functionCall"`, `v-on="event"`
@@ -458,8 +465,26 @@ var configVue = (options = {}) => {
458
465
  // `prop="foo", `static attributes
459
466
  "ATTR_SHORTHAND_BOOL"
460
467
  // `disabled`, prop shorthand
461
- ],
462
- 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
463
488
  }
464
489
  ],
465
490
  "vue/order-in-components": [
@@ -502,13 +527,8 @@ var configVue = (options = {}) => {
502
527
  ]
503
528
  }
504
529
  ],
505
- "vue/max-attributes-per-line": [
506
- "error",
507
- {
508
- singleline: 1,
509
- multiline: 1
510
- }
511
- ],
530
+ "vue/prop-name-casing": ["error", "camelCase"],
531
+ "vue/this-in-template": ["error", "never"],
512
532
  ...disabledRules,
513
533
  ...extensionRules,
514
534
  ...unCategorizedRules,
@@ -520,26 +540,29 @@ var configVue = (options = {}) => {
520
540
  };
521
541
 
522
542
  // src/configs/yml.ts
523
- var configYml = (options = {}) => [
524
- {
525
- name: "ntnyq/yml",
526
- files: [GLOB_YAML],
527
- languageOptions: {
528
- parser: parserYaml
529
- },
530
- plugins: {
531
- yml: default4
532
- },
533
- rules: {
534
- ...default4.configs.standard.rules,
535
- ...default4.configs.prettier.rules,
536
- "yml/no-empty-mapping-value": "off",
537
- "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
538
- // Overrides rules
539
- ...options.overrides
543
+ var configYml = (options = {}) => {
544
+ const { files = [GLOB_YAML] } = options;
545
+ return [
546
+ {
547
+ name: "ntnyq/yml",
548
+ files,
549
+ plugins: {
550
+ yml: default4
551
+ },
552
+ languageOptions: {
553
+ parser: parserYaml
554
+ },
555
+ rules: {
556
+ ...default4.configs.standard.rules,
557
+ ...default4.configs.prettier.rules,
558
+ "yml/no-empty-mapping-value": "off",
559
+ "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
560
+ // Overrides rules
561
+ ...options.overrides
562
+ }
540
563
  }
541
- }
542
- ];
564
+ ];
565
+ };
543
566
 
544
567
  // src/configs/node.ts
545
568
  var configNode = (options = {}) => [
@@ -567,10 +590,12 @@ var configNode = (options = {}) => [
567
590
  var configSort = (options = {}) => {
568
591
  const configs2 = [];
569
592
  const {
570
- tsconfig: enableSortTsconfig = true,
571
- packageJson: enableSortPackageJson = true,
593
+ additionalJsonFiles = [],
594
+ additionalYamlFiles = [],
572
595
  i18nLocale: enableSortI18nLocale = true,
573
- pnpmWorkspace: enableSortPnpmWorkspace = true
596
+ packageJson: enableSortPackageJson = true,
597
+ pnpmWorkspace: enableSortPnpmWorkspace = true,
598
+ tsconfig: enableSortTsconfig = true
574
599
  } = options;
575
600
  if (enableSortTsconfig) {
576
601
  configs2.push({
@@ -580,10 +605,20 @@ var configSort = (options = {}) => {
580
605
  "jsonc/sort-keys": [
581
606
  "error",
582
607
  {
583
- order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
584
- pathPattern: "^$"
608
+ pathPattern: "^$",
609
+ order: [
610
+ "extends",
611
+ "compilerOptions",
612
+ "references",
613
+ "files",
614
+ "include",
615
+ "exclude",
616
+ // vue.volar
617
+ "vueCompilerOptions"
618
+ ]
585
619
  },
586
620
  {
621
+ pathPattern: "^compilerOptions$",
587
622
  order: [
588
623
  /* Projects */
589
624
  "incremental",
@@ -681,8 +716,7 @@ var configSort = (options = {}) => {
681
716
  /* Completeness */
682
717
  "skipDefaultLibCheck",
683
718
  "skipLibCheck"
684
- ],
685
- pathPattern: "^compilerOptions$"
719
+ ]
686
720
  }
687
721
  ]
688
722
  }
@@ -693,6 +727,25 @@ var configSort = (options = {}) => {
693
727
  name: "ntnyq/sort/package-json",
694
728
  files: ["**/package.json"],
695
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
+ ],
696
749
  "jsonc/sort-keys": [
697
750
  "error",
698
751
  {
@@ -788,8 +841,8 @@ var configSort = (options = {}) => {
788
841
  ]
789
842
  },
790
843
  {
791
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
792
- order: { type: "asc" }
844
+ order: { type: "asc" },
845
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
793
846
  },
794
847
  {
795
848
  order: { type: "asc" },
@@ -797,7 +850,18 @@ var configSort = (options = {}) => {
797
850
  },
798
851
  {
799
852
  pathPattern: "^exports.*$",
800
- 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
+ ]
801
865
  },
802
866
  // VSCode extension
803
867
  {
@@ -809,15 +873,27 @@ var configSort = (options = {}) => {
809
873
  * @see {@link https://pnpm.io/package_json#publishconfig}
810
874
  */
811
875
  {
812
- order: { type: "asc" },
813
- 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
+ ]
814
889
  },
815
890
  // npm scripts
816
891
  {
817
- pathPattern: "^scripts$",
818
- order: { type: "asc" }
892
+ order: { type: "asc" },
893
+ pathPattern: "^scripts$"
819
894
  },
820
895
  {
896
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$",
821
897
  order: [
822
898
  // client hooks only
823
899
  "pre-commit",
@@ -830,27 +906,7 @@ var configSort = (options = {}) => {
830
906
  "post-merge",
831
907
  "pre-push",
832
908
  "pre-auto-gc"
833
- ],
834
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
835
- }
836
- ],
837
- "jsonc/sort-array-values": [
838
- "error",
839
- {
840
- pathPattern: "^files$",
841
- order: { type: "asc" }
842
- },
843
- {
844
- pathPattern: "^keywords$",
845
- order: { type: "asc" }
846
- },
847
- {
848
- pathPattern: "^activationEvents$",
849
- order: { type: "asc" }
850
- },
851
- {
852
- pathPattern: "^contributes.*$",
853
- order: { type: "asc" }
909
+ ]
854
910
  }
855
911
  ]
856
912
  }
@@ -860,26 +916,26 @@ var configSort = (options = {}) => {
860
916
  configs2.push(
861
917
  {
862
918
  name: "ntnyq/sort/i18n-locale/json",
863
- files: ["**/{locales,i18n}/*.json"],
919
+ files: ["**/{i18n,langs,locales}/*.json"],
864
920
  rules: {
865
921
  "jsonc/sort-keys": [
866
922
  "error",
867
923
  {
868
- pathPattern: ".*",
869
- order: { type: "asc" }
924
+ order: { type: "asc" },
925
+ pathPattern: ".*"
870
926
  }
871
927
  ]
872
928
  }
873
929
  },
874
930
  {
875
931
  name: "ntnyq/sort/i18n-locale/yaml",
876
- files: ["**/{locales,i18n}/*.y?(a)ml"],
932
+ files: ["**/{i18n,langs,locales}/*.y?(a)ml"],
877
933
  rules: {
878
934
  "yml/sort-keys": [
879
935
  "error",
880
936
  {
881
- pathPattern: ".*",
882
- order: { type: "asc" }
937
+ order: { type: "asc" },
938
+ pathPattern: ".*"
883
939
  }
884
940
  ]
885
941
  }
@@ -894,8 +950,38 @@ var configSort = (options = {}) => {
894
950
  "yml/sort-keys": [
895
951
  "error",
896
952
  {
897
- pathPattern: ".*",
898
- order: { type: "asc" }
953
+ order: { type: "asc" },
954
+ pathPattern: ".*"
955
+ }
956
+ ]
957
+ }
958
+ });
959
+ }
960
+ if (additionalJsonFiles.length) {
961
+ configs2.push({
962
+ name: "ntnyq/sort/additional-json",
963
+ files: additionalJsonFiles,
964
+ rules: {
965
+ "jsonc/sort-keys": [
966
+ "error",
967
+ {
968
+ order: { type: "asc" },
969
+ pathPattern: ".*"
970
+ }
971
+ ]
972
+ }
973
+ });
974
+ }
975
+ if (additionalYamlFiles.length) {
976
+ configs2.push({
977
+ name: "ntnyq/sort/additional-yaml",
978
+ files: additionalYamlFiles,
979
+ rules: {
980
+ "yml/sort-keys": [
981
+ "error",
982
+ {
983
+ order: { type: "asc" },
984
+ pathPattern: ".*"
899
985
  }
900
986
  ]
901
987
  }
@@ -904,88 +990,233 @@ var configSort = (options = {}) => {
904
990
  return configs2;
905
991
  };
906
992
 
907
- // src/configs/toml.ts
908
- var configToml = (options = {}) => [
909
- {
910
- name: "ntnyq/toml",
911
- files: [GLOB_TOML],
912
- languageOptions: {
913
- parser: parserToml
914
- },
915
- plugins: {
916
- toml: default6
917
- },
918
- rules: {
919
- "toml/keys-order": "error",
920
- "toml/key-spacing": "error",
921
- "toml/quoted-keys": "error",
922
- "toml/comma-style": "error",
923
- "toml/tables-order": "error",
924
- "toml/no-space-dots": "error",
925
- "toml/spaced-comment": "error",
926
- "toml/precision-of-integer": "error",
927
- "toml/table-bracket-spacing": "error",
928
- "toml/array-bracket-newline": "error",
929
- "toml/inline-table-curly-spacing": "error",
930
- "toml/padding-line-between-pairs": "error",
931
- "toml/padding-line-between-tables": "error",
932
- "toml/no-unreadable-number-separator": "error",
933
- "toml/precision-of-fractional-seconds": "error",
934
- "toml/vue-custom-block/no-parsing-error": "error",
935
- "toml/indent": ["error", 2],
936
- "toml/array-bracket-spacing": ["error", "never"],
937
- "toml/array-element-newline": ["error", "never"],
938
- // Overrides rules
939
- ...options.overrides
993
+ // src/configs/svgo.ts
994
+ var configSVGO = (options = {}) => {
995
+ const { files = [GLOB_SVG], ignores = [] } = options;
996
+ return [
997
+ {
998
+ name: "ntnyq/svgo",
999
+ files,
1000
+ ignores,
1001
+ plugins: {
1002
+ svgo: default5
1003
+ },
1004
+ languageOptions: {
1005
+ parser: parserPlain
1006
+ },
1007
+ rules: {
1008
+ "svgo/svgo": "error"
1009
+ }
940
1010
  }
941
- }
942
- ];
1011
+ ];
1012
+ };
943
1013
 
944
- // src/configs/test.ts
945
- var configTest = (options = {}) => [
946
- {
947
- name: "ntnyq/test",
948
- files: [...GLOB_TEST],
949
- rules: {
950
- "no-unused-expressions": "off",
951
- "max-lines-per-function": "off",
952
- // Overrides rules
953
- ...options.overrides
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
+ });
1029
+
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);
954
1092
  }
955
1093
  }
956
- ];
957
- var configVitest = (options = {}) => {
958
- if (!default14.configs?.recommended) return [];
959
- const vitestConfigs = default14.configs;
960
- return [
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 = [
961
1125
  {
962
- name: "ntnyq/vitest",
1126
+ name: "ntnyq/test/setup",
963
1127
  plugins: {
964
- vitest: default14
965
- },
966
- files: [...GLOB_TEST],
1128
+ "no-only-tests": default20
1129
+ }
1130
+ },
1131
+ {
1132
+ name: "ntnyq/test/base",
1133
+ files,
967
1134
  rules: {
968
- ...vitestConfigs.recommended.rules,
1135
+ "max-lines-per-function": "off",
1136
+ "no-unused-expressions": "off",
1137
+ "no-only-tests/no-only-tests": "error",
969
1138
  // Overrides rules
970
- ...options.overridesVitestRules
1139
+ ...options.overrides
971
1140
  }
972
1141
  }
973
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;
974
1181
  };
975
1182
 
976
- // src/configs/svgo.ts
977
- import { createConfig as createSVGOConfig } from "eslint-plugin-svgo";
978
- var configSVGO = (options = {}) => {
979
- const { files = [GLOB_SVG], rules: overridesRules = {} } = options;
1183
+ // src/configs/toml.ts
1184
+ var configToml = (options = {}) => {
1185
+ const { files = [GLOB_TOML] } = options;
980
1186
  return [
981
- createSVGOConfig({
982
- name: "ntnyq/svgo",
1187
+ {
1188
+ name: "ntnyq/toml",
983
1189
  files,
1190
+ plugins: {
1191
+ toml: default6
1192
+ },
1193
+ languageOptions: {
1194
+ parser: parserToml
1195
+ },
984
1196
  rules: {
985
- "svgo/svgo": "error",
986
- ...overridesRules
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
987
1218
  }
988
- })
1219
+ }
989
1220
  ];
990
1221
  };
991
1222
 
@@ -994,14 +1225,14 @@ var configAntfu = (options = {}) => [
994
1225
  {
995
1226
  name: "ntnyq/antfu",
996
1227
  plugins: {
997
- antfu: default9
1228
+ antfu: default8
998
1229
  },
999
1230
  rules: {
1000
1231
  // required `object-curly-newline` to be disabled
1001
1232
  // 'antfu/consistent-list-newline': 'error',
1002
1233
  "antfu/import-dedupe": "error",
1003
- "antfu/no-import-dist": "error",
1004
1234
  "antfu/indent-unindent": "error",
1235
+ "antfu/no-import-dist": "error",
1005
1236
  "antfu/no-import-node-modules-by-path": "error",
1006
1237
  // Overrides rules
1007
1238
  ...options.overrides
@@ -1028,7 +1259,7 @@ var configJsdoc = (options = {}) => [
1028
1259
  {
1029
1260
  name: "ntnyq/jsdoc",
1030
1261
  plugins: {
1031
- jsdoc: default10
1262
+ jsdoc: default9
1032
1263
  },
1033
1264
  rules: {
1034
1265
  // Disabled rules
@@ -1036,34 +1267,19 @@ var configJsdoc = (options = {}) => [
1036
1267
  // Use `jsdoc/sort-tags`
1037
1268
  "jsdoc/text-escaping": "off",
1038
1269
  // No need
1039
- // Fixable rules
1040
- "jsdoc/empty-tags": "error",
1041
- "jsdoc/no-defaults": "error",
1042
- "jsdoc/check-types": "error",
1043
- "jsdoc/no-blank-blocks": "error",
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",
1044
1279
  "jsdoc/check-alignment": "error",
1045
- "jsdoc/multiline-blocks": "error",
1046
- "jsdoc/check-param-names": "error",
1047
- "jsdoc/no-multi-asterisks": "error",
1048
1280
  "jsdoc/check-line-alignment": "error",
1281
+ "jsdoc/check-param-names": "error",
1049
1282
  "jsdoc/check-property-names": "error",
1050
- "jsdoc/require-asterisk-prefix": "error",
1051
- "jsdoc/no-blank-block-descriptions": "error",
1052
- "jsdoc/require-hyphen-before-param-description": "error",
1053
- "jsdoc/no-bad-blocks": [
1054
- "error",
1055
- {
1056
- ignore: [
1057
- // built-in default
1058
- "ts-check",
1059
- "ts-expect-error",
1060
- "ts-ignore",
1061
- "ts-nocheck",
1062
- // useful
1063
- "vite-ignore"
1064
- ]
1065
- }
1066
- ],
1067
1283
  "jsdoc/check-tag-names": [
1068
1284
  "error",
1069
1285
  {
@@ -1084,62 +1300,96 @@ var configJsdoc = (options = {}) => [
1084
1300
  ]
1085
1301
  }
1086
1302
  ],
1087
- "jsdoc/check-access": "warn",
1088
- "jsdoc/implements-on-classes": "warn",
1089
- "jsdoc/require-param-name": "warn",
1090
- "jsdoc/require-property": "warn",
1091
- "jsdoc/require-property-name": "warn",
1092
- "jsdoc/require-property-description": "warn",
1093
- "jsdoc/require-returns-check": "warn",
1094
- "jsdoc/require-returns-description": "warn",
1095
- "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",
1096
1327
  // TypeScript rules overrides
1097
1328
  ...options.typescript ? typescriptRules : javscriptRules,
1098
1329
  // Overrides rules
1099
1330
  ...options.overrides
1100
1331
  }
1101
- }
1102
- ];
1332
+ }
1333
+ ];
1334
+
1335
+ // src/configs/jsonc.ts
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
+ };
1103
1382
 
1104
- // src/configs/jsonc.ts
1105
- var configJsonc = (options = {}) => [
1383
+ // src/configs/ntnyq.ts
1384
+ var configNtnyq = (options = {}) => [
1106
1385
  {
1107
- name: "ntnyq/jsonc",
1108
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1386
+ name: "ntnyq/ntnyq",
1109
1387
  plugins: {
1110
- jsonc: default11
1111
- },
1112
- languageOptions: {
1113
- parser: parserJsonc
1388
+ ntnyq: default12
1114
1389
  },
1115
1390
  rules: {
1116
- ...default11.configs["recommended-with-jsonc"].rules,
1117
- "jsonc/no-octal-escape": "error",
1118
- "jsonc/indent": ["error", 2],
1119
- "jsonc/comma-style": ["error", "last"],
1120
- "jsonc/comma-dangle": ["error", "never"],
1121
- "jsonc/object-curly-spacing": ["error", "always"],
1122
- "jsonc/array-bracket-spacing": ["error", "never"],
1123
- "jsonc/key-spacing": [
1124
- "error",
1125
- {
1126
- beforeColon: false,
1127
- afterColon: true
1128
- }
1129
- ],
1130
- "jsonc/object-curly-newline": [
1131
- "error",
1132
- {
1133
- multiline: true,
1134
- consistent: true
1135
- }
1136
- ],
1137
- "jsonc/object-property-newline": [
1138
- "error",
1139
- {
1140
- allowMultiplePropertiesPerLine: true
1141
- }
1142
- ],
1391
+ "ntnyq/no-duplicate-exports": "error",
1392
+ "ntnyq/prefer-newline-after-file-header": "error",
1143
1393
  // Overrides rules
1144
1394
  ...options.overrides
1145
1395
  }
@@ -1154,15 +1404,14 @@ var configPinia = (options = {}) => {
1154
1404
  name: "ntnyq/pinia",
1155
1405
  files,
1156
1406
  plugins: {
1157
- pinia: default7
1407
+ pinia: default11
1158
1408
  },
1159
1409
  rules: {
1160
- "pinia/prefer-single-store-per-file": "error",
1410
+ "pinia/never-export-initialized-store": "error",
1161
1411
  "pinia/no-duplicate-store-ids": "error",
1162
1412
  "pinia/no-return-global-properties": "error",
1163
1413
  "pinia/no-store-to-refs-in-store": "error",
1164
- "pinia/never-export-initialized-store": "error",
1165
- "pinia/require-setup-store-properties-export": "error",
1414
+ "pinia/prefer-single-store-per-file": "error",
1166
1415
  "pinia/prefer-use-store-naming-convention": [
1167
1416
  "error",
1168
1417
  {
@@ -1170,6 +1419,7 @@ var configPinia = (options = {}) => {
1170
1419
  storeSuffix: "Store"
1171
1420
  }
1172
1421
  ],
1422
+ "pinia/require-setup-store-properties-export": "error",
1173
1423
  // Overrides rules
1174
1424
  ...options.overrides
1175
1425
  }
@@ -1177,21 +1427,6 @@ var configPinia = (options = {}) => {
1177
1427
  ];
1178
1428
  };
1179
1429
 
1180
- // src/configs/ntnyq.ts
1181
- import { createConfig as createNtnyqConfig } from "eslint-plugin-ntnyq";
1182
- var configNtnyq = (options = {}) => [
1183
- {
1184
- ...createNtnyqConfig({
1185
- rules: {
1186
- "ntnyq/prefer-newline-after-file-header": "error",
1187
- // Overrides rules
1188
- ...options.overrides
1189
- }
1190
- }),
1191
- name: "ntnyq/ntnyq"
1192
- }
1193
- ];
1194
-
1195
1430
  // src/configs/depend.ts
1196
1431
  var configDepend = (options = {}) => {
1197
1432
  const {
@@ -1233,196 +1468,152 @@ var configDepend = (options = {}) => {
1233
1468
  return configs2;
1234
1469
  };
1235
1470
 
1236
- // src/configs/regexp.ts
1237
- var configRegexp = (options = {}) => {
1238
- const recommendedConfig = pluginRegexp.configs["flat/recommended"];
1239
- const recommendedRules2 = {
1240
- ...recommendedConfig.rules
1241
- };
1242
- if (options.severity === "warn") {
1243
- for (const key in recommendedRules2) {
1244
- if (recommendedRules2[key] === "error") {
1245
- recommendedRules2[key] = "warn";
1246
- }
1247
- }
1248
- }
1249
- return [
1250
- {
1251
- ...recommendedConfig,
1252
- name: "ntnyq/regexp",
1253
- rules: {
1254
- ...recommendedRules2,
1255
- // Overrides rules
1256
- ...options.overrides
1257
- }
1258
- }
1259
- ];
1260
- };
1261
-
1262
- // src/configs/unocss.ts
1263
- var configUnoCSS = (options = {}) => [
1264
- {
1265
- name: "ntnyq/unocss",
1266
- plugins: {
1267
- unocss: default13
1268
- },
1269
- rules: {
1270
- "unocss/order": "error",
1271
- "unocss/order-attributify": options.attributify ? "error" : "off",
1272
- // Overrides rules
1273
- ...options.overrides
1274
- }
1275
- }
1276
- ];
1277
-
1278
- // src/constants.ts
1279
- var DEFAULT_PRETTIER_OPTIONS = {
1280
- // Include parentheses around a sole arrow function parameter
1471
+ // src/constants/prettier.ts
1472
+ var PRETTIER_DEFAULT_OPTIONS = {
1281
1473
  arrowParens: "avoid",
1282
- // 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)
1283
1474
  bracketSameLine: false,
1284
- // Print spaces between brackets in object literals.
1285
1475
  bracketSpacing: true,
1286
- // Control whether Prettier formats quoted code embedded in the file
1287
1476
  embeddedLanguageFormatting: "auto",
1288
- // End of line
1289
1477
  endOfLine: "lf",
1290
- // Specify the global whitespace sensitivity for HTML files
1478
+ experimentalOperatorPosition: "start",
1479
+ experimentalTernaries: false,
1291
1480
  htmlWhitespaceSensitivity: "css",
1292
- // Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
1293
1481
  insertPragma: false,
1294
- // Use single quotes instead of double quotes in JSX
1295
1482
  jsxSingleQuote: true,
1296
- // Maximum line length
1297
- printWidth: 100,
1298
- // 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,
1299
1485
  proseWrap: "preserve",
1300
- // Change when properties in objects are quoted
1301
1486
  quoteProps: "as-needed",
1302
1487
  rangeEnd: Number.POSITIVE_INFINITY,
1303
- // Format only a segment of a file.
1304
1488
  rangeStart: 0,
1305
- // Specify which parser to use.
1306
- // parser: undefined,
1307
- // Specify the file name to use to infer which parser to use.
1308
- // filepath: undefined,
1309
- // Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
1310
1489
  requirePragma: false,
1311
- // Use semicolons or not
1312
1490
  semi: false,
1313
- // Enforce single attribute per line in HTML, Vue and JSX
1314
1491
  singleAttributePerLine: true,
1315
- // Use single quotes instead of double quotes
1316
1492
  singleQuote: true,
1317
- // Specify the number of spaces per indentation-level
1318
1493
  tabWidth: 2,
1319
- // Print trailing commas wherever possible when multi-line
1320
1494
  trailingComma: "all",
1321
- // Indent lines with tabs instead of spaces
1322
1495
  useTabs: false,
1323
- // Whether or not to indent the code inside <script> and <style> tags in Vue files
1324
1496
  vueIndentScriptAndStyle: false
1325
1497
  };
1326
1498
 
1327
- // src/utils/env.ts
1328
- import { resolve } from "node:path";
1329
- import process from "node:process";
1330
- import { isPackageExists } from "local-pkg";
1331
- var hasPinia = isPackageExists("pinia");
1332
- var hasVitest = isPackageExists("vitest");
1333
- var hasTypeScript = isPackageExists("typescript");
1334
- var hasShadcnVue = isPackageExists("radix-vue") && isPackageExists("clsx");
1335
- var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
1336
- var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
1337
- paths: [resolve(process.cwd(), "playground"), resolve(process.cwd(), "docs")]
1338
- });
1339
-
1340
- // src/utils/toArray.ts
1341
- function toArray(val) {
1342
- val = val ?? [];
1343
- return Array.isArray(val) ? val : [val];
1344
- }
1345
-
1346
- // src/utils/resolveSubOptions.ts
1347
- function resolveSubOptions(options, key) {
1348
- return typeof options[key] === "boolean" ? {} : options[key] || {};
1349
- }
1350
-
1351
- // src/utils/getOverrides.ts
1352
- function getOverrides(options, key) {
1353
- const subOptions = resolveSubOptions(options, key);
1354
- return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
1355
- }
1356
-
1357
- // src/utils/combineConfigs.ts
1358
- async function combineConfigs(...configs2) {
1359
- const resolved = await Promise.all(configs2);
1360
- return resolved.flat();
1361
- }
1362
-
1363
- // src/utils/ensurePackages.ts
1364
- import process3 from "node:process";
1365
- import { fileURLToPath } from "node:url";
1366
- import { isPackageExists as isPackageExists2 } from "local-pkg";
1367
-
1368
- // src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
1369
- import process2 from "node:process";
1370
- function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
1371
- return !!(process2.env.GIT_PARAMS || process2.env.VSCODE_GIT_COMMAND || // lint staged files
1372
- process2.env.npm_lifecycle_script?.startsWith("nano-staged") || // run `scripts/generateType.ts`
1373
- process2.env.npm_lifecycle_script?.startsWith("tsx"));
1374
- }
1375
-
1376
- // src/utils/ensurePackages.ts
1377
- var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
1378
- var isCwdInScope = isPackageExists2("@ntnyq/eslint-config");
1379
- function isPackageInScope(name) {
1380
- return isPackageExists2(name, {
1381
- paths: [scopeUrl]
1382
- });
1383
- }
1384
- async function ensurePackages(packages) {
1385
- if (process3.env.CI || !process3.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
1386
- return;
1387
- }
1388
- const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
1389
- if (nonExistingPackages.length === 0) {
1390
- return;
1391
- }
1392
- const { confirm } = await import("@clack/prompts");
1393
- const confirmInstall = await confirm({
1394
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
1395
- });
1396
- if (confirmInstall) {
1397
- try {
1398
- const { installPackage } = await import("@antfu/install-pkg");
1399
- await installPackage(nonExistingPackages, { dev: true });
1400
- } catch (err) {
1401
- console.log(err);
1402
- }
1403
- }
1404
- }
1405
-
1406
- // src/utils/interopDefault.ts
1407
- async function interopDefault(mod) {
1408
- const resolved = await mod;
1409
- return resolved.default || resolved;
1410
- }
1411
-
1412
- // src/utils/mergePrettierOptions.ts
1413
- function mergePrettierOptions(options = {}, overrides = {}) {
1414
- const result = {
1415
- ...options,
1416
- ...overrides,
1417
- plugins: [
1418
- // built-in plugins
1419
- ...options.plugins || [],
1420
- // custom plugins
1421
- ...overrides.plugins || []
1422
- ]
1423
- };
1424
- return result;
1425
- }
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"];
1426
1617
 
1427
1618
  // src/configs/format.ts
1428
1619
  var configFormat = (options = {}) => {
@@ -1433,14 +1624,14 @@ var configFormat = (options = {}) => {
1433
1624
  prettierOptions = {}
1434
1625
  } = options;
1435
1626
  const sharedPrettierOptions = {
1436
- ...DEFAULT_PRETTIER_OPTIONS,
1627
+ ...PRETTIER_DEFAULT_OPTIONS,
1437
1628
  ...prettierOptions
1438
1629
  };
1439
1630
  const configs2 = [
1440
1631
  {
1441
1632
  name: "ntnyq/format/setup",
1442
1633
  plugins: {
1443
- format: default12
1634
+ format: default13
1444
1635
  }
1445
1636
  }
1446
1637
  ];
@@ -1508,11 +1699,53 @@ var configFormat = (options = {}) => {
1508
1699
  })
1509
1700
  ]
1510
1701
  }
1511
- });
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
+ }
1512
1719
  }
1513
- return configs2;
1720
+ return [
1721
+ {
1722
+ ...recommendedConfig,
1723
+ name: "ntnyq/regexp",
1724
+ rules: {
1725
+ ...recommendedRules2,
1726
+ // Overrides rules
1727
+ ...options.overrides
1728
+ }
1729
+ }
1730
+ ];
1514
1731
  };
1515
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
+
1516
1749
  // src/configs/command.ts
1517
1750
  import { builtinCommands } from "eslint-plugin-command/commands";
1518
1751
  import createCommandConfig from "eslint-plugin-command/config";
@@ -1553,7 +1786,10 @@ var regexper = defineCommand({
1553
1786
  removeComment: false,
1554
1787
  message: "Update the regexper link",
1555
1788
  fix(fixer) {
1556
- return fixer.replaceTextRange([indexStart, indexEnd], `@regexper ${url}`);
1789
+ return fixer.replaceTextRange(
1790
+ [indexStart, indexEnd],
1791
+ `@regexper ${url}`
1792
+ );
1557
1793
  }
1558
1794
  });
1559
1795
  }
@@ -1595,39 +1831,50 @@ var configIgnores = (customIgnores = []) => [
1595
1831
  // src/configs/importX.ts
1596
1832
  var configImportX = (options = {}) => {
1597
1833
  const {
1598
- typescript: enableTypeScript,
1599
1834
  // use typescript resolve if possible
1600
- preferTypeScriptResolver = true
1835
+ preferTypeScriptResolver = true,
1836
+ typescript: enableTypeScript
1601
1837
  } = options;
1602
1838
  return [
1603
1839
  {
1604
1840
  name: "ntnyq/import-x",
1605
1841
  plugins: {
1606
- "import-x": default16
1842
+ "import-x": default17
1607
1843
  },
1608
1844
  settings: {
1609
1845
  "import-x/resolver-next": [
1610
1846
  enableTypeScript && preferTypeScriptResolver ? createTypeScriptImportResolver({
1611
- 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
+ ]
1612
1856
  }) : createNodeResolver({
1613
1857
  extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
1614
1858
  })
1615
1859
  ]
1616
1860
  },
1617
1861
  rules: {
1618
- "import-x/no-unresolved": "off",
1619
1862
  "import-x/no-absolute-path": "off",
1620
1863
  "import-x/no-named-as-default-member": "off",
1621
1864
  "import-x/no-named-default": "off",
1865
+ "import-x/no-unresolved": "off",
1622
1866
  // disabled in favor or `perfectionist/sort-imports`
1623
1867
  "import-x/order": "off",
1624
- "import-x/first": "error",
1868
+ "import-x/consistent-type-specifier-style": [
1869
+ "error",
1870
+ "prefer-top-level"
1871
+ ],
1625
1872
  "import-x/export": "error",
1626
- "import-x/no-self-import": "error",
1873
+ "import-x/first": "error",
1874
+ "import-x/newline-after-import": "error",
1627
1875
  "import-x/no-duplicates": "error",
1628
1876
  "import-x/no-mutable-exports": "error",
1629
- "import-x/newline-after-import": "error",
1630
- "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
1877
+ "import-x/no-self-import": "error",
1631
1878
  // Overrides rules
1632
1879
  ...options.overrides
1633
1880
  }
@@ -1639,51 +1886,50 @@ var configImportX = (options = {}) => {
1639
1886
  var disabledRules2 = {
1640
1887
  "unicorn/better-regex": "off",
1641
1888
  "unicorn/explicit-length-check": "off",
1642
- "unicorn/prefer-top-level-await": "off",
1643
1889
  "unicorn/no-array-callback-reference": "off",
1644
1890
  /**
1645
1891
  * @see https://caniuse.com/?search=globalThis
1646
1892
  */
1647
- "unicorn/prefer-global-this": "off"
1893
+ "unicorn/prefer-global-this": "off",
1894
+ "unicorn/prefer-top-level-await": "off"
1648
1895
  };
1649
1896
  var configUnicorn = (options = {}) => [
1650
1897
  {
1651
1898
  name: "ntnyq/unicorn",
1652
1899
  plugins: {
1653
- unicorn: default15
1900
+ unicorn: default16
1654
1901
  },
1655
1902
  rules: {
1903
+ "unicorn/consistent-assert": "error",
1904
+ "unicorn/consistent-existence-index-check": "error",
1905
+ "unicorn/error-message": "error",
1656
1906
  "unicorn/escape-case": "error",
1907
+ "unicorn/new-for-builtins": "error",
1908
+ "unicorn/no-accessor-recursion": "error",
1909
+ "unicorn/no-console-spaces": "error",
1657
1910
  "unicorn/no-for-loop": "error",
1911
+ "unicorn/no-hex-escape": "error",
1912
+ "unicorn/no-instanceof-builtins": "error",
1658
1913
  "unicorn/no-lonely-if": "error",
1659
- "unicorn/error-message": "error",
1660
1914
  "unicorn/no-new-buffer": "error",
1661
- "unicorn/no-hex-escape": "error",
1662
- "unicorn/throw-new-error": "error",
1663
- "unicorn/prefer-includes": "error",
1664
- "unicorn/new-for-builtins": "error",
1665
- "unicorn/prefer-type-error": "error",
1666
- "unicorn/prefer-math-trunc": "error",
1667
- "unicorn/no-console-spaces": "error",
1668
- "unicorn/no-zero-fractions": "error",
1669
- "unicorn/prefer-regexp-test": "error",
1670
- "unicorn/number-literal-case": "error",
1915
+ "unicorn/no-static-only-class": "error",
1671
1916
  "unicorn/no-typeof-undefined": "error",
1917
+ "unicorn/no-unnecessary-await": "error",
1918
+ "unicorn/prefer-includes": "error",
1919
+ "unicorn/prefer-keyboard-event-key": "error",
1672
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",
1673
1924
  "unicorn/prefer-node-protocol": "error",
1674
- "unicorn/no-unnecessary-await": "error",
1675
- "unicorn/no-static-only-class": "error",
1925
+ "unicorn/prefer-optional-catch-binding": "error",
1926
+ "unicorn/prefer-prototype-methods": "error",
1676
1927
  "unicorn/prefer-reflect-apply": "error",
1677
- "unicorn/prefer-negative-index": "error",
1678
1928
  "unicorn/prefer-structured-clone": "error",
1679
- "unicorn/custom-error-definition": "error",
1680
- "unicorn/prefer-modern-math-apis": "error",
1681
- "unicorn/prefer-number-properties": "error",
1682
- "unicorn/prefer-prototype-methods": "error",
1683
- "unicorn/prefer-keyboard-event-key": "error",
1684
- "unicorn/prefer-optional-catch-binding": "error",
1685
- "unicorn/consistent-existence-index-check": "error",
1686
1929
  "unicorn/switch-case-braces": ["error", "avoid"],
1930
+ /**
1931
+ * @pg Error
1932
+ */
1687
1933
  "unicorn/catch-error-name": [
1688
1934
  "error",
1689
1935
  {
@@ -1691,32 +1937,56 @@ var configUnicorn = (options = {}) => [
1691
1937
  ignore: ["^_."]
1692
1938
  }
1693
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",
1694
1957
  "unicorn/prefer-date-now": "error",
1695
- // String
1958
+ /**
1959
+ * @pg String
1960
+ */
1696
1961
  "unicorn/prefer-code-point": "error",
1697
1962
  "unicorn/prefer-string-slice": "error",
1698
- "unicorn/prefer-string-trim-start-end": "error",
1699
1963
  "unicorn/prefer-string-starts-ends-with": "error",
1700
- // DOM
1701
- "unicorn/prefer-query-selector": "error",
1702
- "unicorn/prefer-modern-dom-apis": "error",
1703
- "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",
1704
1970
  "unicorn/prefer-dom-node-append": "error",
1705
1971
  "unicorn/prefer-dom-node-dataset": "error",
1706
- "unicorn/prefer-add-event-listener": "error",
1972
+ "unicorn/prefer-dom-node-remove": "error",
1707
1973
  "unicorn/prefer-dom-node-text-content": "error",
1708
- "unicorn/no-invalid-remove-event-listener": "error",
1709
- // Array
1710
- "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",
1711
1980
  "unicorn/no-array-push-push": "error",
1981
+ "unicorn/no-new-array": "error",
1712
1982
  "unicorn/prefer-array-find": "error",
1713
- "unicorn/prefer-array-some": "error",
1714
- "unicorn/no-instanceof-array": "error",
1715
1983
  "unicorn/prefer-array-flat-map": "error",
1716
1984
  "unicorn/prefer-array-index-of": "error",
1985
+ "unicorn/prefer-array-some": "error",
1717
1986
  "unicorn/require-array-join-separator": "error",
1718
- "unicorn/no-array-method-this-argument": "error",
1719
- // Set
1987
+ /**
1988
+ * @pg Set
1989
+ */
1720
1990
  "unicorn/prefer-set-has": "error",
1721
1991
  "unicorn/prefer-set-size": "error",
1722
1992
  ...disabledRules2,
@@ -1726,106 +1996,13 @@ var configUnicorn = (options = {}) => [
1726
1996
  }
1727
1997
  ];
1728
1998
 
1729
- // src/configs/specials.ts
1730
- import globals from "globals";
1731
- var configSpecials = (options = {}) => {
1732
- const {
1733
- // Enable shadcn-vue support
1734
- shadcnVue: enableShadcnVue = hasShadcnVue
1735
- } = options;
1736
- const configs2 = [
1737
- {
1738
- name: "ntnyq/specials/scripts",
1739
- files: [`**/scripts/${GLOB_SRC}`],
1740
- rules: {
1741
- "no-console": "off",
1742
- "@typescript-eslint/explicit-function-return-type": "off",
1743
- // Overrides rules
1744
- ...options.overridesScriptsRules
1745
- }
1746
- },
1747
- {
1748
- name: "ntnyq/specials/cli",
1749
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1750
- rules: {
1751
- "no-console": "off",
1752
- "@typescript-eslint/explicit-function-return-type": "off",
1753
- // Overrides rules
1754
- ...options.overridesCliRules
1755
- }
1756
- },
1757
- {
1758
- name: "ntnyq/specials/userscript",
1759
- files: [`**/*.user.${GLOB_SRC_EXT}`],
1760
- languageOptions: {
1761
- globals: {
1762
- ...globals.greasemonkey
1763
- }
1764
- },
1765
- rules: {
1766
- camelcase: [
1767
- "error",
1768
- {
1769
- allow: ["^GM_.+"]
1770
- }
1771
- ],
1772
- // Overrides rules
1773
- ...options.overridesUserScriptsRules
1774
- }
1775
- },
1776
- {
1777
- name: "ntnyq/specials/config-file",
1778
- files: [`**/*.config*.${GLOB_SRC_EXT}`],
1779
- plugins: {
1780
- "import-x": default16,
1781
- perfectionist: default19
1782
- },
1783
- rules: {
1784
- "no-console": "off",
1785
- "import-x/no-default-export": "off",
1786
- "@typescript-eslint/explicit-function-return-type": "off",
1787
- "perfectionist/sort-objects": [
1788
- "error",
1789
- {
1790
- type: "alphabetical",
1791
- order: "asc",
1792
- partitionByComment: true,
1793
- groups: ["unknown", "method", "multiline"]
1794
- }
1795
- ],
1796
- ...options.overridesConfigFileRules
1797
- }
1798
- }
1799
- ];
1800
- if (enableShadcnVue) {
1801
- const shadcnOptions = resolveSubOptions(options, "shadcnVue");
1802
- configs2.push({
1803
- name: "ntnyq/specials/shadcn-vue",
1804
- files: shadcnOptions.files || ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
1805
- rules: {
1806
- "@typescript-eslint/no-unused-vars": "off",
1807
- "@typescript-eslint/consistent-type-imports": "off",
1808
- // Overrides rules
1809
- ...shadcnOptions.overridesRules
1810
- }
1811
- });
1812
- }
1813
- if (options.specialCaseConfigs) {
1814
- configs2.push(...options.specialCaseConfigs);
1815
- }
1816
- return configs2;
1817
- };
1818
-
1819
- // src/configs/comments.ts
1820
- var configComments = (options = {}) => [
1999
+ // src/configs/deMorgan.ts
2000
+ var configDeMorgan = (options = {}) => [
1821
2001
  {
1822
- name: "ntnyq/eslint-comments",
1823
- plugins: {
1824
- "@eslint-community/eslint-comments": default21
1825
- },
2002
+ ...default19.configs.recommended,
2003
+ name: "ntnyq/de-morgan",
1826
2004
  rules: {
1827
- ...default21.configs.recommended.rules,
1828
- "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
2005
+ ...default19.configs.recommended.rules,
1829
2006
  // Overrides rules
1830
2007
  ...options.overrides
1831
2008
  }
@@ -1838,21 +2015,17 @@ var configMarkdown = (options = {}) => {
1838
2015
  /**
1839
2016
  * code block files
1840
2017
  */
1841
- files = [`${GLOB_MARKDOWN}/${GLOB_SRC}`],
2018
+ files = [GLOB_MARKDOWN_CODE],
1842
2019
  /**
1843
2020
  * other extensions
1844
2021
  */
1845
- extensions = [],
1846
- /**
1847
- * disbale type aware linting
1848
- */
1849
- disableTypeAwareLinting = false
2022
+ extensions = []
1850
2023
  } = options;
1851
2024
  const configs2 = [
1852
2025
  /**
1853
2026
  * extracting code blocks to be linted individually
1854
2027
  */
1855
- ...default8.configs.processor.map((config) => ({
2028
+ ...default7.configs.processor.map((config) => ({
1856
2029
  ...config,
1857
2030
  name: `ntnyq/${config.name}`
1858
2031
  })),
@@ -1864,7 +2037,7 @@ var configMarkdown = (options = {}) => {
1864
2037
  files,
1865
2038
  ignores: [GLOB_MARKDOWN_NESTED],
1866
2039
  processor: mergeProcessors([
1867
- default8.processors.markdown,
2040
+ default7.processors.markdown,
1868
2041
  // Just pass through processor
1869
2042
  processorPassThrough
1870
2043
  ])
@@ -1877,52 +2050,50 @@ var configMarkdown = (options = {}) => {
1877
2050
  }
1878
2051
  },
1879
2052
  {
1880
- name: "ntnyq/markdown/disabled/code-blocks",
2053
+ name: "ntnyq/markdown/disabled",
1881
2054
  files: [
1882
2055
  ...files,
1883
- // Extension block support
2056
+ // more nested extensions to disable
1884
2057
  ...extensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
1885
2058
  ],
1886
2059
  languageOptions: {
1887
2060
  parserOptions: {
2061
+ // type-aware lint related parserOptions
2062
+ project: false,
2063
+ projectService: false,
1888
2064
  ecmaFeatures: {
1889
2065
  impliedStrict: true
1890
2066
  }
1891
2067
  }
1892
2068
  },
1893
2069
  rules: {
1894
- "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",
1895
2080
  "no-alert": "off",
1896
2081
  "no-console": "off",
1897
- "no-unused-vars": "off",
1898
- "no-unused-expressions": "off",
1899
2082
  "no-restricted-imports": "off",
2083
+ "no-undef": "off",
2084
+ "no-unused-expressions": "off",
2085
+ "no-unused-vars": "off",
1900
2086
  "node/prefer-global/buffer": "off",
1901
2087
  "node/prefer-global/process": "off",
1902
- "import-x/no-unresolved": "off",
1903
2088
  "unused-imports/no-unused-imports": "off",
1904
2089
  "unused-imports/no-unused-vars": "off",
1905
- "@typescript-eslint/comma-dangle": "off",
1906
- "@typescript-eslint/no-redeclare": "off",
1907
- "@typescript-eslint/no-namespace": "off",
1908
- "@typescript-eslint/no-unused-vars": "off",
1909
- "@typescript-eslint/no-require-imports": "off",
1910
- "@typescript-eslint/no-extraneous-class": "off",
1911
- "@typescript-eslint/no-use-before-define": "off",
1912
- "@typescript-eslint/no-unused-expressions": "off",
1913
- "@typescript-eslint/consistent-type-imports": "off",
2090
+ // disable all type-aware rules of @typescript-eslint
2091
+ ...configs.disableTypeChecked.rules,
1914
2092
  // Overrides rules
1915
2093
  ...options.overrides
1916
2094
  }
1917
2095
  }
1918
2096
  ];
1919
- if (disableTypeAwareLinting) {
1920
- configs2.push({
1921
- ...configs.disableTypeChecked,
1922
- name: "ntnyq/markdown/disable/type-aware",
1923
- files: [GLOB_MARKDOWN_CODE]
1924
- });
1925
- }
1926
2097
  return configs2;
1927
2098
  };
1928
2099
 
@@ -1937,7 +2108,7 @@ var configPrettier = (options = {}) => {
1937
2108
  {
1938
2109
  name: "ntnyq/prettier",
1939
2110
  plugins: {
1940
- prettier: default17
2111
+ prettier: default18
1941
2112
  },
1942
2113
  rules: {
1943
2114
  "vue/array-bracket-newline": "off",
@@ -1977,26 +2148,131 @@ var configPrettier = (options = {}) => {
1977
2148
  "vue/space-infix-ops": "off",
1978
2149
  "vue/space-unary-ops": "off",
1979
2150
  "vue/template-curly-spacing": "off",
1980
- ...default17.configs.recommended.rules,
2151
+ ...default18.configs.recommended.rules,
1981
2152
  "prettier/prettier": options.severity || "warn",
1982
2153
  // Overrides rules
1983
- ...options.overrides
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",
2197
+ // Overrides rules
2198
+ ...options.overridesCliRules
1984
2199
  }
1985
2200
  },
1986
- /**
1987
- * Languages that prettier currently does not support
1988
- */
1989
2201
  {
1990
- name: "ntnyq/prettier/disabled",
1991
- files: [...disabledFiles, ...userDisabledFiles],
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
+ }
2219
+ },
2220
+ rules: {
2221
+ camelcase: [
2222
+ "error",
2223
+ {
2224
+ allow: ["^GM_.+"]
2225
+ }
2226
+ ],
2227
+ // Overrides rules
2228
+ ...options.overridesUserScriptsRules
2229
+ }
2230
+ },
2231
+ {
2232
+ name: "ntnyq/specials/config-file",
2233
+ files: [`**/*.config*.${GLOB_SRC_EXT}`],
1992
2234
  plugins: {
1993
- prettier: default17
2235
+ "import-x": default17,
2236
+ perfectionist: default22
1994
2237
  },
1995
2238
  rules: {
1996
- "prettier/prettier": "off"
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
1997
2251
  }
1998
2252
  }
1999
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;
2000
2276
  };
2001
2277
 
2002
2278
  // src/configs/gitignore.ts
@@ -2016,25 +2292,25 @@ import jsConfig from "@eslint/js";
2016
2292
  import globals2 from "globals";
2017
2293
  var strictRules = {
2018
2294
  complexity: ["error", { max: 30 }],
2019
- "max-params": ["error", { max: 5 }],
2020
2295
  "max-depth": ["error", { max: 5 }],
2021
- "max-nested-callbacks": ["error", { max: 10 }],
2022
2296
  "max-lines": [
2023
2297
  "error",
2024
2298
  {
2025
2299
  max: 1e3,
2026
- skipComments: true,
2027
- skipBlankLines: true
2300
+ skipBlankLines: true,
2301
+ skipComments: true
2028
2302
  }
2029
2303
  ],
2030
2304
  "max-lines-per-function": [
2031
2305
  "error",
2032
2306
  {
2033
2307
  max: 200,
2034
- skipComments: true,
2035
- skipBlankLines: true
2308
+ skipBlankLines: true,
2309
+ skipComments: true
2036
2310
  }
2037
- ]
2311
+ ],
2312
+ "max-nested-callbacks": ["error", { max: 10 }],
2313
+ "max-params": ["error", { max: 5 }]
2038
2314
  };
2039
2315
  var configJavaScript = (options = {}) => [
2040
2316
  {
@@ -2044,38 +2320,50 @@ var configJavaScript = (options = {}) => [
2044
2320
  {
2045
2321
  name: "ntnyq/js/core",
2046
2322
  languageOptions: {
2323
+ sourceType: "module",
2047
2324
  globals: {
2048
2325
  ...globals2.browser,
2049
2326
  ...globals2.es2021,
2050
2327
  ...globals2.node
2051
- },
2052
- sourceType: "module"
2328
+ }
2053
2329
  },
2054
2330
  rules: {
2055
- "require-await": "off",
2331
+ "consistent-return": "off",
2056
2332
  "no-return-assign": "off",
2057
2333
  "no-useless-escape": "off",
2058
- "consistent-return": "off",
2334
+ "require-await": "off",
2059
2335
  // disabled in favor of `perfectionist/sort-named-imports`
2060
2336
  "sort-imports": "off",
2061
2337
  // standard v17.0.0
2062
- "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",
2063
2344
  camelcase: [
2064
2345
  "error",
2065
2346
  {
2066
2347
  allow: ["^UNSAFE_"],
2067
- properties: "never",
2068
- ignoreGlobals: true
2348
+ ignoreGlobals: true,
2349
+ properties: "never"
2069
2350
  }
2070
2351
  ],
2071
2352
  "constructor-super": "error",
2072
2353
  curly: ["error", "multi-line"],
2073
2354
  "default-case-last": "error",
2074
2355
  "dot-notation": ["error", { allowKeywords: true }],
2075
- "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",
2076
2363
  "no-array-constructor": "error",
2077
2364
  "no-async-promise-executor": "error",
2078
2365
  "no-caller": "error",
2366
+ "no-case-declarations": "error",
2079
2367
  "no-class-assign": "error",
2080
2368
  "no-compare-neg-zero": "error",
2081
2369
  "no-cond-assign": "error",
@@ -2088,10 +2376,10 @@ var configJavaScript = (options = {}) => [
2088
2376
  "no-dupe-class-members": "error",
2089
2377
  "no-dupe-keys": "error",
2090
2378
  "no-duplicate-case": "error",
2091
- "no-useless-backreference": "error",
2092
2379
  "no-empty": ["error", { allowEmptyCatch: true }],
2093
2380
  "no-empty-character-class": "error",
2094
2381
  "no-empty-pattern": "error",
2382
+ "no-empty-static-block": "error",
2095
2383
  "no-eval": "error",
2096
2384
  "no-ex-assign": "error",
2097
2385
  "no-extend-native": "error",
@@ -2109,15 +2397,16 @@ var configJavaScript = (options = {}) => [
2109
2397
  "no-lone-blocks": "error",
2110
2398
  "no-loss-of-precision": "error",
2111
2399
  "no-misleading-character-class": "error",
2112
- "no-prototype-builtins": "error",
2113
- "no-useless-catch": "error",
2400
+ "no-multi-str": "error",
2114
2401
  "no-new": "error",
2115
2402
  "no-new-func": "error",
2403
+ "no-new-native-nonconstructor": "error",
2116
2404
  "no-new-wrappers": "error",
2117
2405
  "no-obj-calls": "error",
2118
2406
  "no-octal": "error",
2119
2407
  "no-octal-escape": "error",
2120
2408
  "no-proto": "error",
2409
+ "no-prototype-builtins": "error",
2121
2410
  "no-redeclare": ["error", { builtinGlobals: false }],
2122
2411
  "no-regex-spaces": "error",
2123
2412
  "no-self-assign": ["error", { props: true }],
@@ -2141,8 +2430,8 @@ var configJavaScript = (options = {}) => [
2141
2430
  "error",
2142
2431
  {
2143
2432
  allowShortCircuit: true,
2144
- allowTernary: true,
2145
- allowTaggedTemplates: true
2433
+ allowTaggedTemplates: true,
2434
+ allowTernary: true
2146
2435
  }
2147
2436
  ],
2148
2437
  "no-unused-vars": [
@@ -2154,38 +2443,35 @@ var configJavaScript = (options = {}) => [
2154
2443
  vars: "all"
2155
2444
  }
2156
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",
2157
2456
  "no-useless-call": "error",
2457
+ "no-useless-catch": "error",
2158
2458
  "no-useless-computed-key": "error",
2159
2459
  "no-useless-constructor": "error",
2160
2460
  "no-useless-rename": "error",
2161
2461
  "no-useless-return": "error",
2162
- "prefer-promise-reject-errors": "error",
2163
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
2164
- "symbol-description": "error",
2165
- "unicode-bom": ["error", "never"],
2166
- "use-isnan": [
2167
- "error",
2168
- {
2169
- enforceForSwitchCase: true,
2170
- enforceForIndexOf: true
2171
- }
2172
- ],
2173
- "valid-typeof": ["error", { requireStringLiterals: true }],
2174
- yoda: ["error", "never"],
2175
2462
  // es6+
2176
2463
  "no-var": "error",
2177
- "prefer-rest-params": "error",
2178
- "prefer-spread": "error",
2179
- "prefer-template": "error",
2180
- "no-empty-static-block": "error",
2181
- "no-new-native-nonconstructor": "error",
2182
- "prefer-const": [
2464
+ "no-void": "error",
2465
+ "no-with": "error",
2466
+ "object-shorthand": [
2183
2467
  "error",
2468
+ "always",
2184
2469
  {
2185
- destructuring: "all",
2186
- ignoreReadBeforeAssign: true
2470
+ avoidQuotes: true,
2471
+ ignoreConstructors: false
2187
2472
  }
2188
2473
  ],
2474
+ "one-var": ["error", "never"],
2189
2475
  "prefer-arrow-callback": [
2190
2476
  "error",
2191
2477
  {
@@ -2193,34 +2479,30 @@ var configJavaScript = (options = {}) => [
2193
2479
  allowUnboundThis: true
2194
2480
  }
2195
2481
  ],
2196
- "object-shorthand": [
2482
+ "prefer-const": [
2197
2483
  "error",
2198
- "always",
2199
2484
  {
2200
- ignoreConstructors: false,
2201
- avoidQuotes: true
2485
+ destructuring: "all",
2486
+ ignoreReadBeforeAssign: true
2202
2487
  }
2203
2488
  ],
2204
- // best-practice
2205
- eqeqeq: ["error", "smart"],
2206
- "array-callback-return": "error",
2207
- "block-scoped-var": "error",
2208
- "no-alert": "error",
2209
- "no-case-declarations": "error",
2210
- "no-multi-str": "error",
2211
- "no-with": "error",
2212
- "no-void": "error",
2213
- "vars-on-top": "error",
2214
- "one-var": ["error", "never"],
2215
- "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": [
2216
2497
  "error",
2217
2498
  {
2218
- functions: false,
2219
- classes: false,
2220
- variables: true,
2221
- allowNamedExports: false
2499
+ enforceForIndexOf: true,
2500
+ enforceForSwitchCase: true
2222
2501
  }
2223
2502
  ],
2503
+ "valid-typeof": ["error", { requireStringLiterals: true }],
2504
+ "vars-on-top": "error",
2505
+ yoda: ["error", "never"],
2224
2506
  // Strict rules
2225
2507
  ...options.strict ? strictRules : {},
2226
2508
  // Overrides rules
@@ -2231,7 +2513,7 @@ var configJavaScript = (options = {}) => [
2231
2513
  var configJSX = () => [
2232
2514
  {
2233
2515
  name: "ntnyq/jsx",
2234
- files: ["**/*.jsx"],
2516
+ files: [GLOB_JSX_ONLY],
2235
2517
  languageOptions: {
2236
2518
  parserOptions: {
2237
2519
  ecmaFeatures: {
@@ -2245,40 +2527,43 @@ var configJSX = () => [
2245
2527
  // src/configs/typescript.ts
2246
2528
  import process4 from "node:process";
2247
2529
  var typeAwareRules = {
2530
+ // too strict
2531
+ "@typescript-eslint/strict-boolean-expressions": "off",
2248
2532
  "dot-notation": "off",
2249
- "require-await": "off",
2250
2533
  "no-implied-eval": "off",
2251
2534
  "no-throw-literal": "off",
2252
- // too strict
2253
- "@typescript-eslint/strict-boolean-expressions": "off",
2254
- "@typescript-eslint/require-await": "error",
2255
- "@typescript-eslint/unbound-method": "error",
2256
- "@typescript-eslint/no-unsafe-call": "error",
2535
+ "require-await": "off",
2257
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",
2258
2540
  "@typescript-eslint/no-for-in-array": "error",
2259
2541
  "@typescript-eslint/no-implied-eval": "error",
2260
- "@typescript-eslint/only-throw-error": "error",
2261
- "@typescript-eslint/no-unsafe-return": "error",
2542
+ "@typescript-eslint/no-misused-promises": "error",
2262
2543
  "@typescript-eslint/no-misused-spread": "error",
2544
+ "@typescript-eslint/no-redundant-type-constituents": "error",
2545
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
2263
2546
  "@typescript-eslint/no-unsafe-argument": "error",
2264
- "@typescript-eslint/no-misused-promises": "error",
2265
2547
  "@typescript-eslint/no-unsafe-assignment": "error",
2266
- "@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",
2267
2552
  "@typescript-eslint/promise-function-async": "error",
2553
+ "@typescript-eslint/require-await": "error",
2268
2554
  "@typescript-eslint/restrict-plus-operands": "error",
2269
- "@typescript-eslint/triple-slash-reference": "error",
2270
- "@typescript-eslint/no-unsafe-member-access": "error",
2271
- "@typescript-eslint/switch-exhaustiveness-check": "error",
2272
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
2273
2555
  "@typescript-eslint/restrict-template-expressions": "error",
2274
- "@typescript-eslint/no-redundant-type-constituents": "error",
2275
- "@typescript-eslint/no-duplicate-type-constituents": "error",
2276
2556
  "@typescript-eslint/return-await": ["error", "in-try-catch"],
2277
- "@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"
2278
2560
  };
2279
- var recommendedRules = configs.recommended.reduce((rules, config) => {
2280
- return { ...rules, ...config.rules || {} };
2281
- }, {});
2561
+ var recommendedRules = configs.recommended.reduce(
2562
+ (rules, config) => {
2563
+ return { ...rules, ...config.rules || {} };
2564
+ },
2565
+ {}
2566
+ );
2282
2567
  var configTypeScript = (options = {}) => {
2283
2568
  const enableTypeAwareLint = !!options?.tsconfigPath;
2284
2569
  const {
@@ -2299,11 +2584,11 @@ var configTypeScript = (options = {}) => {
2299
2584
  extraFileExtensions: extensions.map((ext) => `.${ext}`),
2300
2585
  sourceType: "module",
2301
2586
  ...enableTypeAware ? {
2587
+ tsconfigRootDir: process4.cwd(),
2302
2588
  projectService: {
2303
2589
  allowDefaultProject: ["./*.js"],
2304
2590
  defaultProject: options.tsconfigPath
2305
- },
2306
- tsconfigRootDir: process4.cwd()
2591
+ }
2307
2592
  } : {},
2308
2593
  ...parserOptions
2309
2594
  };
@@ -2312,7 +2597,7 @@ var configTypeScript = (options = {}) => {
2312
2597
  files: files2,
2313
2598
  ignores: [...ignores],
2314
2599
  languageOptions: {
2315
- parser: parserTypeScript,
2600
+ parser,
2316
2601
  parserOptions: typescriptParserOptions
2317
2602
  }
2318
2603
  };
@@ -2323,7 +2608,7 @@ var configTypeScript = (options = {}) => {
2323
2608
  name: "ntnyq/ts/setup",
2324
2609
  plugins: {
2325
2610
  "@typescript-eslint": plugin,
2326
- antfu: default9
2611
+ antfu: default8
2327
2612
  }
2328
2613
  },
2329
2614
  ...enableTypeAwareLint ? [
@@ -2335,100 +2620,103 @@ var configTypeScript = (options = {}) => {
2335
2620
  files,
2336
2621
  rules: {
2337
2622
  ...recommendedRules,
2338
- "@typescript-eslint/no-namespace": "off",
2339
- "@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",
2340
2627
  "@typescript-eslint/naming-convention": "off",
2341
2628
  "@typescript-eslint/no-empty-function": "off",
2629
+ "@typescript-eslint/no-explicit-any": "off",
2630
+ "@typescript-eslint/no-namespace": "off",
2342
2631
  "@typescript-eslint/no-non-null-assertion": "off",
2343
2632
  "@typescript-eslint/triple-slash-reference": "off",
2344
- "@typescript-eslint/explicit-member-accessibility": "off",
2345
- "@typescript-eslint/explicit-function-return-type": "off",
2346
- "@typescript-eslint/explicit-module-boundary-types": "off",
2347
- "@typescript-eslint/consistent-indexed-object-style": "off",
2348
- "@typescript-eslint/prefer-as-const": "warn",
2633
+ "default-param-last": "off",
2349
2634
  // Disabled in favor of enhanced ts rules
2350
2635
  "no-redeclare": "off",
2351
2636
  "no-unused-vars": "off",
2352
- "default-param-last": "off",
2353
2637
  "no-use-before-define": "off",
2354
2638
  "no-useless-constructor": "off",
2355
- "@typescript-eslint/default-param-last": "error",
2356
- "@typescript-eslint/no-useless-constructor": "error",
2357
- "@typescript-eslint/no-redeclare": [
2639
+ "@typescript-eslint/prefer-as-const": "warn",
2640
+ "@typescript-eslint/ban-ts-comment": [
2358
2641
  "error",
2359
2642
  {
2360
- builtinGlobals: false,
2361
- 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"
2362
2648
  }
2363
2649
  ],
2364
- "@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": [
2365
2657
  "error",
2366
2658
  {
2367
- functions: false,
2368
- classes: false,
2369
- variables: true,
2370
- allowNamedExports: false,
2371
- enums: true,
2372
- typedefs: false,
2373
- ignoreTypeReferences: false
2659
+ assertionStyle: "as",
2660
+ objectLiteralTypeAssertions: "allow-as-parameter"
2374
2661
  }
2375
2662
  ],
2376
- "@typescript-eslint/no-unused-vars": [
2663
+ "@typescript-eslint/consistent-type-imports": [
2377
2664
  "error",
2378
2665
  {
2379
- // Args after the last used will be reported
2380
- args: "after-used",
2381
- argsIgnorePattern: "^_",
2382
- caughtErrors: "all",
2383
- caughtErrorsIgnorePattern: "^_",
2384
- destructuredArrayIgnorePattern: "^_",
2385
- varsIgnorePattern: "^_",
2386
- ignoreRestSiblings: true
2666
+ disallowTypeAnnotations: false,
2667
+ fixStyle: "separate-type-imports",
2668
+ prefer: "type-imports"
2387
2669
  }
2388
2670
  ],
2389
- // Extra rules
2390
- "@typescript-eslint/ban-tslint-comment": "error",
2391
- "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
2392
- "@typescript-eslint/ban-ts-comment": [
2671
+ "@typescript-eslint/default-param-last": "error",
2672
+ "@typescript-eslint/no-empty-object-type": [
2393
2673
  "error",
2394
2674
  {
2395
- minimumDescriptionLength: 1,
2396
- "ts-check": false,
2397
- "ts-expect-error": "allow-with-description",
2398
- "ts-ignore": "allow-with-description",
2399
- "ts-nocheck": "allow-with-description"
2675
+ allowInterfaces: "always",
2676
+ allowObjectTypes: "always"
2400
2677
  }
2401
2678
  ],
2402
- "@typescript-eslint/no-unused-expressions": [
2679
+ "@typescript-eslint/no-redeclare": [
2403
2680
  "error",
2404
2681
  {
2405
- allowShortCircuit: true,
2406
- allowTernary: true,
2407
- allowTaggedTemplates: true
2682
+ builtinGlobals: false,
2683
+ ignoreDeclarationMerge: true
2408
2684
  }
2409
2685
  ],
2410
- "@typescript-eslint/consistent-type-imports": [
2686
+ "@typescript-eslint/no-unused-expressions": [
2411
2687
  "error",
2412
2688
  {
2413
- prefer: "type-imports",
2414
- fixStyle: "separate-type-imports",
2415
- disallowTypeAnnotations: false
2689
+ allowShortCircuit: true,
2690
+ allowTaggedTemplates: true,
2691
+ allowTernary: true
2416
2692
  }
2417
2693
  ],
2418
- "@typescript-eslint/no-empty-object-type": [
2694
+ "@typescript-eslint/no-unused-vars": [
2419
2695
  "error",
2420
2696
  {
2421
- allowInterfaces: "always",
2422
- 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: "^_"
2423
2705
  }
2424
2706
  ],
2425
- "@typescript-eslint/consistent-type-assertions": [
2707
+ "@typescript-eslint/no-use-before-define": [
2426
2708
  "error",
2427
2709
  {
2428
- assertionStyle: "as",
2429
- 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
2430
2717
  }
2431
2718
  ],
2719
+ "@typescript-eslint/no-useless-constructor": "error",
2432
2720
  // Overrides rules
2433
2721
  ...options.overrides
2434
2722
  }
@@ -2449,11 +2737,15 @@ var configTypeScript = (options = {}) => {
2449
2737
  name: "ntnyq/ts/types",
2450
2738
  files: [...GLOB_TYPES],
2451
2739
  rules: {
2452
- "no-use-before-define": "off",
2453
- "no-restricted-syntax": "off",
2454
- "import-x/no-duplicates": "off",
2740
+ "@typescript-eslint/no-use-before-define": "off",
2455
2741
  "import-x/newline-after-import": "off",
2456
- "@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"
2457
2749
  }
2458
2750
  }
2459
2751
  ];
@@ -2462,7 +2754,9 @@ var configTypeScript = (options = {}) => {
2462
2754
  // src/configs/eslintPlugin.ts
2463
2755
  var configESLintPlugin = async (options = {}) => {
2464
2756
  await ensurePackages(["eslint-plugin-eslint-plugin"]);
2465
- const pluginESLintPlugin = await interopDefault(import("eslint-plugin-eslint-plugin"));
2757
+ const pluginESLintPlugin = await interopDefault(
2758
+ import("eslint-plugin-eslint-plugin")
2759
+ );
2466
2760
  return [
2467
2761
  {
2468
2762
  ...pluginESLintPlugin.configs["flat/all"],
@@ -2482,19 +2776,20 @@ var configESLintPlugin = async (options = {}) => {
2482
2776
  import { createConfig } from "eslint-plugin-github-action";
2483
2777
  var configGitHubAction = (options = {}) => {
2484
2778
  const {
2485
- // Support common overrides rules
2779
+ files = [GLOB_GITHUB_ACTION],
2780
+ rules = {},
2486
2781
  overrides: overridesRules = {},
2487
- // Config options
2488
2782
  ...restOptions
2489
2783
  } = options;
2490
2784
  return [
2491
2785
  createConfig({
2492
2786
  name: "ntnyq/github-action",
2493
- files: [GLOB_GITHUB_ACTION],
2787
+ files,
2494
2788
  rules: {
2495
2789
  "github-action/no-invalid-key": "error",
2496
2790
  "github-action/prefer-file-extension": "error",
2497
2791
  "github-action/require-action-name": "error",
2792
+ ...rules,
2498
2793
  ...overridesRules
2499
2794
  },
2500
2795
  ...restOptions
@@ -2503,191 +2798,209 @@ var configGitHubAction = (options = {}) => {
2503
2798
  };
2504
2799
 
2505
2800
  // src/configs/perfectionist.ts
2506
- var INTERFACE_OR_OBJECT_TYPES_GROUPS = [
2507
- "required-property",
2508
- "optional-property",
2509
- "required-method",
2510
- "optional-method",
2511
- "required-multiline-property",
2512
- "optional-multiline-property",
2513
- "required-multiline-method",
2514
- "optional-multiline-method",
2515
- "unknown",
2516
- "index-signature",
2517
- "multiline-index-signature"
2518
- ];
2519
- var INTERSECTION_OR_UNION_TYPES_GROUPS = [
2520
- /**
2521
- * eg. 'foobar', 24, false
2522
- */
2523
- "literal",
2524
- /**
2525
- * eg. number, string
2526
- */
2527
- "keyword",
2528
- /**
2529
- * eg. FooBar
2530
- */
2531
- "named",
2532
- /**
2533
- * eg. Foo & Bar
2534
- */
2535
- "intersection",
2536
- /**
2537
- * eg. Foobar extends string ? Foo : Bar
2538
- */
2539
- "conditional",
2540
- /**
2541
- * eg. (...args: any[]) => void
2542
- */
2543
- "function",
2544
- /**
2545
- * eg. import('eslint').Linter
2546
- */
2547
- "import",
2548
- /**
2549
- * eg. { foo: string; bar: number; }
2550
- */
2551
- "object",
2552
- /**
2553
- * eg. keyof T
2554
- */
2555
- "operator",
2556
- /**
2557
- * eg. [string, number]
2558
- */
2559
- "tuple",
2560
- /**
2561
- * eg. Foo | Bar
2562
- */
2563
- "union",
2564
- /**
2565
- * eg. null | undefined
2566
- */
2567
- "nullish"
2568
- ];
2569
2801
  var configPerfectionist = (options = {}) => {
2570
2802
  const {
2571
- sortEnums: enableSortEnums = true,
2572
- sortTypes: enableSortTypes = true,
2803
+ partitionByComment = PERFECTIONIST_EXTRA_RULE_OPTIONS.partitionByComment,
2573
2804
  sortConstants: enableSortConstants = true,
2574
- partitionByComment = ["@pg", "@perfectionist-group"]
2805
+ sortEnums: enableSortEnums = true,
2806
+ sortTypes: enableSortTypes = true
2575
2807
  } = options;
2576
- function getCommonRuleOptions(options2 = {}) {
2577
- const ruleOptions = {
2578
- type: "alphabetical",
2579
- order: "asc",
2580
- ignoreCase: true,
2581
- ...options2.disableNewlinesBetween ? {} : { newlinesBetween: "ignore" },
2582
- ...options2.disableNewlinesBetween ? {} : { partitionByComment }
2583
- };
2584
- return ruleOptions;
2585
- }
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
+ };
2586
2971
  const configs2 = [
2587
2972
  {
2588
- name: "ntnyq/perfectionist/common",
2973
+ name: options.all ? "ntnyq/perfectionist/all" : "ntnyq/perfectionist/common",
2589
2974
  plugins: {
2590
- perfectionist: default19
2975
+ perfectionist: default22
2591
2976
  },
2592
2977
  rules: {
2593
- "perfectionist/sort-imports": [
2594
- "error",
2595
- {
2596
- ...getCommonRuleOptions(),
2597
- groups: [
2598
- // Side effect style imports (e.g. 'normalize.css')
2599
- "side-effect-style",
2600
- // Styles (e.g. *.{css,scss,less})
2601
- "style",
2602
- // Node.js built-in modules. (e.g. fs, path)
2603
- "builtin",
2604
- // External modules installed in the project (e.g. vue, lodash)
2605
- "external",
2606
- // Internal modules (e.g. @/utils, @/components)
2607
- "internal",
2608
- // Modules from parent directory (e.g. ../utils)
2609
- "parent",
2610
- // Modules from the same directory (e.g. ./utils)
2611
- "sibling",
2612
- // Main file from the current directory (e.g. ./index)
2613
- "index",
2614
- // TypeScript object-imports (e.g. import log = console.log)
2615
- "object",
2616
- // Side effect imports (e.g. import 'babel-polyfill')
2617
- "side-effect",
2618
- /**
2619
- * Type import at the end
2620
- */
2621
- "builtin-type",
2622
- "external-type",
2623
- "internal-type",
2624
- "parent-type",
2625
- "sibling-type",
2626
- "index-type",
2627
- "type",
2628
- /**
2629
- * Imports that don’t fit into any other group
2630
- */
2631
- "unknown"
2632
- ],
2633
- internalPattern: ["^~/.+", "^@/.+", "^#.+"]
2634
- }
2635
- ],
2636
- "perfectionist/sort-exports": [
2637
- "error",
2638
- {
2639
- ...getCommonRuleOptions({
2640
- disableNewlinesBetween: true
2641
- }),
2642
- type: "line-length",
2643
- groupKind: "values-first"
2644
- }
2645
- ],
2646
- "perfectionist/sort-named-exports": [
2647
- "error",
2648
- {
2649
- ...getCommonRuleOptions({
2650
- disableNewlinesBetween: true
2651
- }),
2652
- ignoreAlias: false,
2653
- groupKind: "values-first"
2654
- }
2655
- ],
2656
- "perfectionist/sort-named-imports": [
2657
- "error",
2658
- {
2659
- ...getCommonRuleOptions({
2660
- disableNewlinesBetween: true
2661
- }),
2662
- ignoreAlias: false,
2663
- groupKind: "values-first"
2664
- }
2665
- ],
2978
+ ...commonRules,
2979
+ ...options.all ? {
2980
+ ...sharedRules2,
2981
+ ...sortEnumsRules,
2982
+ ...sortTypesRules,
2983
+ ...sortConstantsRules,
2984
+ ...extraRules
2985
+ } : {},
2666
2986
  // Overrides rules
2667
2987
  ...options.overrides
2668
2988
  }
2669
2989
  }
2670
2990
  ];
2991
+ if (options.all) {
2992
+ return configs2;
2993
+ }
2671
2994
  if (enableSortEnums) {
2672
2995
  configs2.push({
2673
2996
  name: "ntnyq/perfectionist/enums",
2674
2997
  files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
2675
2998
  plugins: {
2676
- perfectionist: default19
2999
+ perfectionist: default22
2677
3000
  },
2678
3001
  rules: {
2679
- "perfectionist/sort-enums": [
2680
- "error",
2681
- {
2682
- ...getCommonRuleOptions()
2683
- }
2684
- ],
2685
- "perfectionist/sort-modules": [
2686
- "error",
2687
- {
2688
- ...getCommonRuleOptions()
2689
- }
2690
- ],
3002
+ ...sharedRules2,
3003
+ ...sortEnumsRules,
2691
3004
  // Overrides rules
2692
3005
  ...options.overridesEnumsRules
2693
3006
  }
@@ -2698,52 +3011,11 @@ var configPerfectionist = (options = {}) => {
2698
3011
  name: "ntnyq/perfectionist/types",
2699
3012
  files: [...GLOB_TYPES],
2700
3013
  plugins: {
2701
- perfectionist: default19
3014
+ perfectionist: default22
2702
3015
  },
2703
3016
  rules: {
2704
- "perfectionist/sort-heritage-clauses": [
2705
- "error",
2706
- {
2707
- ...getCommonRuleOptions({
2708
- disableNewlinesBetween: true,
2709
- disablePartitionByComment: true
2710
- })
2711
- }
2712
- ],
2713
- "perfectionist/sort-interfaces": [
2714
- "error",
2715
- {
2716
- ...getCommonRuleOptions(),
2717
- groups: INTERFACE_OR_OBJECT_TYPES_GROUPS
2718
- }
2719
- ],
2720
- "perfectionist/sort-intersection-types": [
2721
- "error",
2722
- {
2723
- ...getCommonRuleOptions(),
2724
- groups: INTERSECTION_OR_UNION_TYPES_GROUPS
2725
- }
2726
- ],
2727
- "perfectionist/sort-modules": [
2728
- "error",
2729
- {
2730
- ...getCommonRuleOptions()
2731
- }
2732
- ],
2733
- "perfectionist/sort-object-types": [
2734
- "error",
2735
- {
2736
- ...getCommonRuleOptions(),
2737
- groups: INTERFACE_OR_OBJECT_TYPES_GROUPS
2738
- }
2739
- ],
2740
- "perfectionist/sort-union-types": [
2741
- "error",
2742
- {
2743
- ...getCommonRuleOptions(),
2744
- groups: INTERSECTION_OR_UNION_TYPES_GROUPS
2745
- }
2746
- ],
3017
+ ...sharedRules2,
3018
+ ...sortTypesRules,
2747
3019
  // Overrides rules
2748
3020
  ...options.overridesTypesRules
2749
3021
  }
@@ -2754,34 +3026,11 @@ var configPerfectionist = (options = {}) => {
2754
3026
  name: "ntnyq/perfectionist/constants",
2755
3027
  files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
2756
3028
  plugins: {
2757
- perfectionist: default19
3029
+ perfectionist: default22
2758
3030
  },
2759
3031
  rules: {
2760
- "perfectionist/sort-maps": [
2761
- "error",
2762
- {
2763
- ...getCommonRuleOptions()
2764
- }
2765
- ],
2766
- "perfectionist/sort-objects": [
2767
- "error",
2768
- {
2769
- ...getCommonRuleOptions(),
2770
- groups: ["property", "multiline-property", "method", "multiline-method", "unknown"]
2771
- }
2772
- ],
2773
- "perfectionist/sort-sets": [
2774
- "error",
2775
- {
2776
- ...getCommonRuleOptions()
2777
- }
2778
- ],
2779
- "perfectionist/sort-modules": [
2780
- "error",
2781
- {
2782
- ...getCommonRuleOptions()
2783
- }
2784
- ],
3032
+ ...sharedRules2,
3033
+ ...sortConstantsRules,
2785
3034
  // Overrides rules
2786
3035
  ...options.overridesConstantsRules
2787
3036
  }
@@ -2795,7 +3044,7 @@ var configUnusedImports = (options = {}) => [
2795
3044
  {
2796
3045
  name: "ntnyq/unused-imports",
2797
3046
  plugins: {
2798
- "unused-imports": default20
3047
+ "unused-imports": default23
2799
3048
  },
2800
3049
  rules: {
2801
3050
  "@typescript-eslint/no-unused-vars": "off",
@@ -2803,14 +3052,14 @@ var configUnusedImports = (options = {}) => [
2803
3052
  "unused-imports/no-unused-vars": [
2804
3053
  "error",
2805
3054
  {
2806
- vars: "all",
2807
- varsIgnorePattern: "^_",
2808
3055
  args: "after-used",
2809
3056
  argsIgnorePattern: "^_",
2810
- ignoreRestSiblings: true,
2811
- destructuredArrayIgnorePattern: "^_",
2812
3057
  caughtErrors: "all",
2813
- caughtErrorsIgnorePattern: "^_"
3058
+ caughtErrorsIgnorePattern: "^_",
3059
+ destructuredArrayIgnorePattern: "^_",
3060
+ ignoreRestSiblings: true,
3061
+ vars: "all",
3062
+ varsIgnorePattern: "^_"
2814
3063
  }
2815
3064
  ],
2816
3065
  // Overrides rules
@@ -2819,6 +3068,25 @@ var configUnusedImports = (options = {}) => [
2819
3068
  }
2820
3069
  ];
2821
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
+
2822
3090
  // src/core.ts
2823
3091
  function defineESLintConfig(options = {}, ...userConfigs) {
2824
3092
  const {
@@ -2829,11 +3097,11 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2829
3097
  /**
2830
3098
  * Conditional by deps
2831
3099
  */
2832
- vue: enableVue = hasVue,
2833
- pinia: enablePinia = hasPinia,
2834
- test: enableTest = hasVitest,
2835
- unocss: enableUnoCSS = hasUnoCSS,
2836
- typescript: enableTypeScript = hasTypeScript,
3100
+ vue: enableVue = hasVue(),
3101
+ pinia: enablePinia = hasPinia(),
3102
+ test: enableTest = hasVitest(),
3103
+ unocss: enableUnoCSS = hasUnoCSS(),
3104
+ typescript: enableTypeScript = hasTypeScript(),
2837
3105
  /**
2838
3106
  * Enabled by default
2839
3107
  */
@@ -2846,6 +3114,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2846
3114
  depend: enableDepend = true,
2847
3115
  regexp: enableRegexp = true,
2848
3116
  unicorn: enableUnicorn = true,
3117
+ deMorgan: enableDeMorgan = true,
2849
3118
  prettier: enablePrettier = true,
2850
3119
  markdown: enableMarkdown = true,
2851
3120
  gitignore: enableGitIgnore = true,
@@ -2879,8 +3148,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2879
3148
  overrides: getOverrides(options, "jsdoc"),
2880
3149
  ...resolveSubOptions(options, "jsdoc")
2881
3150
  }),
2882
- configComments({
2883
- overrides: getOverrides(options, "comments")
3151
+ configESLintComments({
3152
+ overrides: getOverrides(options, "eslintComments")
2884
3153
  }),
2885
3154
  configJavaScript({
2886
3155
  ...resolveSubOptions(options, "javascript"),
@@ -2910,6 +3179,13 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2910
3179
  })
2911
3180
  );
2912
3181
  }
3182
+ if (enableDeMorgan) {
3183
+ configs2.push(
3184
+ configDeMorgan({
3185
+ overrides: getOverrides(options, "deMorgan")
3186
+ })
3187
+ );
3188
+ }
2913
3189
  if (enableRegexp) {
2914
3190
  configs2.push(
2915
3191
  configRegexp({
@@ -2939,6 +3215,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2939
3215
  if (enableYML) {
2940
3216
  configs2.push(
2941
3217
  configYml({
3218
+ ...resolveSubOptions(options, "yml"),
2942
3219
  overrides: getOverrides(options, "yml")
2943
3220
  })
2944
3221
  );
@@ -2946,6 +3223,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2946
3223
  if (enableTOML) {
2947
3224
  configs2.push(
2948
3225
  configToml({
3226
+ ...resolveSubOptions(options, "toml"),
2949
3227
  overrides: getOverrides(options, "toml")
2950
3228
  })
2951
3229
  );
@@ -2953,6 +3231,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2953
3231
  if (enableJSONC) {
2954
3232
  configs2.push(
2955
3233
  configJsonc({
3234
+ ...resolveSubOptions(options, "jsonc"),
2956
3235
  overrides: getOverrides(options, "jsonc")
2957
3236
  })
2958
3237
  );
@@ -2963,9 +3242,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2963
3242
  if (enableTest) {
2964
3243
  configs2.push(
2965
3244
  configTest({
2966
- overrides: getOverrides(options, "test")
2967
- }),
2968
- configVitest({
3245
+ ...resolveSubOptions(options, "test"),
2969
3246
  overrides: getOverrides(options, "test")
2970
3247
  })
2971
3248
  );
@@ -3039,7 +3316,6 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3039
3316
  return composer;
3040
3317
  }
3041
3318
  export {
3042
- DEFAULT_PRETTIER_OPTIONS,
3043
3319
  GLOB_ALL_SRC,
3044
3320
  GLOB_ASTRO,
3045
3321
  GLOB_ASTRO_TS,
@@ -3054,6 +3330,7 @@ export {
3054
3330
  GLOB_JSON5,
3055
3331
  GLOB_JSONC,
3056
3332
  GLOB_JSX,
3333
+ GLOB_JSX_ONLY,
3057
3334
  GLOB_LESS,
3058
3335
  GLOB_LOCKFILE,
3059
3336
  GLOB_MARKDOWN,
@@ -3072,15 +3349,27 @@ export {
3072
3349
  GLOB_TEST,
3073
3350
  GLOB_TOML,
3074
3351
  GLOB_TS,
3352
+ GLOB_TSCONFIG_JSON,
3075
3353
  GLOB_TSX,
3354
+ GLOB_TSX_ONLY,
3076
3355
  GLOB_TYPES,
3356
+ GLOB_TYPE_TEST,
3077
3357
  GLOB_VUE,
3078
3358
  GLOB_YAML,
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,
3079
3367
  combineConfigs,
3080
3368
  configAntfu,
3081
3369
  configCommand,
3082
- configComments,
3370
+ configDeMorgan,
3083
3371
  configDepend,
3372
+ configESLintComments,
3084
3373
  configESLintPlugin,
3085
3374
  configFormat,
3086
3375
  configGitHubAction,
@@ -3107,10 +3396,9 @@ export {
3107
3396
  configUnicorn,
3108
3397
  configUnoCSS,
3109
3398
  configUnusedImports,
3110
- configVitest,
3111
3399
  configVue,
3112
3400
  configYml,
3113
- configs as configsTypescript,
3401
+ configs as configsTypeScript,
3114
3402
  createNodeResolver,
3115
3403
  createTypeScriptImportResolver,
3116
3404
  defineESLintConfig,
@@ -3129,34 +3417,37 @@ export {
3129
3417
  parserJsonc,
3130
3418
  parserPlain,
3131
3419
  parserToml,
3132
- parserTypeScript,
3420
+ parser as parserTypeScript,
3133
3421
  parserVue,
3134
3422
  parserYaml,
3135
- default9 as pluginAntfu,
3136
- default21 as pluginComments,
3423
+ default8 as pluginAntfu,
3424
+ default24 as pluginComments,
3425
+ default19 as pluginDeMorgan,
3137
3426
  pluginDepend,
3138
- default12 as pluginFormat,
3139
- default18 as pluginGitHubAction,
3140
- default16 as pluginImportX,
3141
- default10 as pluginJsdoc,
3142
- default11 as pluginJsonc,
3143
- 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,
3144
3434
  default2 as pluginNode,
3145
- default19 as pluginPerfectionist,
3146
- default7 as pluginPinia,
3147
- default17 as pluginPrettier,
3435
+ default12 as pluginNtnyq,
3436
+ default22 as pluginPerfectionist,
3437
+ default11 as pluginPinia,
3438
+ default18 as pluginPrettier,
3148
3439
  pluginRegexp,
3149
3440
  default5 as pluginSvgo,
3150
3441
  default6 as pluginToml,
3151
3442
  plugin as pluginTypeScript,
3152
- default15 as pluginUnicorn,
3153
- default13 as pluginUnoCSS,
3154
- default20 as pluginUnusedImports,
3155
- default14 as pluginVitest,
3443
+ default16 as pluginUnicorn,
3444
+ default14 as pluginUnoCSS,
3445
+ default23 as pluginUnusedImports,
3446
+ default15 as pluginVitest,
3156
3447
  default3 as pluginVue,
3157
3448
  default4 as pluginYml,
3158
3449
  processorPassThrough,
3159
- default22 as processorVueBlocks,
3450
+ default25 as processorVueBlocks,
3160
3451
  resolveSubOptions,
3161
3452
  toArray
3162
3453
  };