@ntnyq/eslint-config 3.0.0-beta.7 → 3.0.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -57,6 +57,7 @@ __export(src_exports, {
57
57
  GLOB_TSX: () => GLOB_TSX,
58
58
  GLOB_VUE: () => GLOB_VUE,
59
59
  GLOB_YAML: () => GLOB_YAML,
60
+ antfu: () => antfu,
60
61
  command: () => command,
61
62
  comments: () => comments,
62
63
  getOverrides: () => getOverrides,
@@ -81,11 +82,12 @@ __export(src_exports, {
81
82
  parserVue: () => parserVue,
82
83
  parserYaml: () => parserYaml,
83
84
  perfectionist: () => perfectionist,
85
+ pluginAntfu: () => import_eslint_plugin_antfu.default,
84
86
  pluginComments: () => import_eslint_plugin_eslint_comments.default,
85
87
  pluginImport: () => import_eslint_plugin_import_x.default,
86
88
  pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
87
89
  pluginJsonc: () => import_eslint_plugin_jsonc.default,
88
- pluginMarkdown: () => import_eslint_plugin_markdown.default,
90
+ pluginMarkdown: () => import_markdown.default,
89
91
  pluginNode: () => import_eslint_plugin_n.default,
90
92
  pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
91
93
  pluginPrettier: () => import_eslint_plugin_prettier.default,
@@ -117,48 +119,8 @@ __export(src_exports, {
117
119
  });
118
120
  module.exports = __toCommonJS(src_exports);
119
121
 
120
- // src/utils/env.ts
121
- var import_node_process = __toESM(require("process"), 1);
122
- var import_node_path = require("path");
123
- var import_local_pkg = require("local-pkg");
124
- var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
125
- var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
126
- var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli") || (0, import_local_pkg.isPackageExists)("vue", {
127
- paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground")]
128
- });
129
- var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
130
-
131
- // src/utils/toArray.ts
132
- function toArray(val) {
133
- val = val ?? [];
134
- return Array.isArray(val) ? val : [val];
135
- }
136
-
137
- // src/utils/interopDefault.ts
138
- async function interopDefault(mod) {
139
- const resolved = await mod;
140
- return resolved.default || resolved;
141
- }
142
-
143
- // src/utils/loadPlugin.ts
144
- async function loadPlugin(name) {
145
- const mod = await import(name).catch((err) => {
146
- console.error(err);
147
- throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
148
- });
149
- return interopDefault(mod);
150
- }
151
-
152
- // src/utils/resolveSubOptions.ts
153
- function resolveSubOptions(options, key) {
154
- return typeof options[key] === "boolean" ? {} : options[key] || {};
155
- }
156
-
157
- // src/utils/getOverrides.ts
158
- function getOverrides(options, key) {
159
- const sub = resolveSubOptions(options, key);
160
- return "overrides" in sub && sub.overrides ? sub.overrides : {};
161
- }
122
+ // src/core.ts
123
+ var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
162
124
 
163
125
  // src/globs.ts
164
126
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -248,479 +210,293 @@ var GLOB_EXCLUDE = [
248
210
  "**/.yarnrc"
249
211
  ];
250
212
 
251
- // src/configs/ignores.ts
252
- var ignores = (customIgnores = []) => [
253
- {
254
- name: "ntnyq/ignores",
255
- ignores: [
256
- ...GLOB_EXCLUDE,
257
- // Overrides built-in ignores
258
- ...customIgnores
259
- ]
260
- }
261
- ];
262
-
263
213
  // src/plugins.ts
264
214
  var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
215
+ var parserVue = __toESM(require("vue-eslint-parser"), 1);
216
+ var parserToml = __toESM(require("toml-eslint-parser"), 1);
217
+ var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
218
+ var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
265
219
  var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
266
220
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
267
221
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
268
222
  var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
269
223
  var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
270
- var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
224
+ var import_markdown = __toESM(require("@eslint/markdown"), 1);
225
+ var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
271
226
  var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
227
+ var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
272
228
  var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
273
229
  var import_eslint_plugin2 = __toESM(require("@vitest/eslint-plugin"), 1);
274
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
275
230
  var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
231
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
276
232
  var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
277
- var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
278
233
  var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
279
234
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
280
235
  var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
281
- var parserToml = __toESM(require("toml-eslint-parser"), 1);
282
- var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
283
- var parserVue = __toESM(require("vue-eslint-parser"), 1);
284
- var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
285
-
286
- // src/configs/node.ts
287
- var node = (options = {}) => [
288
- {
289
- name: "ntnyq/node",
290
- plugins: {
291
- node: import_eslint_plugin_n.default
292
- },
293
- rules: {
294
- "node/handle-callback-err": ["error", "^(err|error)$"],
295
- "node/no-deprecated-api": "error",
296
- "node/no-exports-assign": "error",
297
- "node/no-new-require": "error",
298
- "node/no-path-concat": "error",
299
- "node/prefer-global/buffer": ["error", "never"],
300
- "node/prefer-global/process": ["error", "never"],
301
- "node/process-exit-as-throw": "error",
302
- // Overrides built-in rules
303
- ...options.overrides
304
- }
305
- }
306
- ];
307
-
308
- // src/configs/jsdoc.ts
309
- var jsdoc = (options = {}) => [
310
- {
311
- name: "ntnyq/jsdoc",
312
- plugins: {
313
- jsdoc: import_eslint_plugin_jsdoc.default
314
- },
315
- rules: {
316
- "jsdoc/check-access": "warn",
317
- "jsdoc/check-param-names": "warn",
318
- "jsdoc/check-property-names": "warn",
319
- "jsdoc/check-types": "warn",
320
- "jsdoc/empty-tags": "warn",
321
- "jsdoc/implements-on-classes": "warn",
322
- "jsdoc/no-defaults": "warn",
323
- "jsdoc/no-multi-asterisks": "warn",
324
- "jsdoc/require-param-name": "warn",
325
- "jsdoc/require-property": "warn",
326
- "jsdoc/require-property-description": "warn",
327
- "jsdoc/require-property-name": "warn",
328
- "jsdoc/require-returns-check": "warn",
329
- "jsdoc/require-returns-description": "warn",
330
- "jsdoc/require-yields-check": "warn",
331
- "jsdoc/check-alignment": "warn",
332
- "jsdoc/multiline-blocks": "warn",
333
- // Overrides built-in rules
334
- ...options.overrides
335
- }
336
- }
337
- ];
338
236
 
339
- // src/configs/imports.ts
340
- var imports = (options = {}) => [
341
- {
342
- name: "ntnyq/imports",
343
- plugins: {
344
- import: import_eslint_plugin_import_x.default
345
- },
346
- settings: {
347
- "import/resolver": {
348
- node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
237
+ // src/configs/typescript.ts
238
+ var import_node_process = __toESM(require("process"), 1);
239
+ var typescriptCore = (options = {}) => {
240
+ const isTypeAware = !!options.tsconfigPath;
241
+ const configs = import_typescript_eslint.default.config({
242
+ name: "ntnyq/ts/core",
243
+ extends: [...import_typescript_eslint.default.configs.recommended],
244
+ files: [GLOB_TS, GLOB_TSX],
245
+ languageOptions: {
246
+ parser: import_typescript_eslint.default.parser,
247
+ parserOptions: {
248
+ sourceType: "module",
249
+ ...isTypeAware ? {
250
+ projectService: {
251
+ defaultProject: options.tsconfigPath
252
+ },
253
+ tsconfigRootDir: import_node_process.default.cwd()
254
+ } : {}
349
255
  }
350
256
  },
351
257
  rules: {
352
- "import/no-unresolved": "off",
353
- "import/no-absolute-path": "off",
354
- "import/no-named-as-default-member": "off",
355
- "import/first": "error",
356
- "import/export": "error",
357
- // 'import/no-named-default': 'error',
358
- "import/no-self-import": "error",
359
- "import/no-duplicates": "error",
360
- "import/no-mutable-exports": "error",
361
- "import/newline-after-import": "error",
362
- "import/order": [
258
+ "@typescript-eslint/no-unused-vars": [
363
259
  "error",
364
260
  {
365
- groups: [
366
- "builtin",
367
- "external",
368
- "internal",
369
- "parent",
370
- "sibling",
371
- "index",
372
- "object",
373
- "type"
374
- ],
375
- "newlines-between": "never",
376
- pathGroups: [{ pattern: "{{@,~}/,#}**", group: "internal" }],
377
- pathGroupsExcludedImportTypes: ["type"]
261
+ // Args after the last used will be reported
262
+ args: "after-used",
263
+ argsIgnorePattern: "^_",
264
+ caughtErrors: "all",
265
+ caughtErrorsIgnorePattern: "^_",
266
+ destructuredArrayIgnorePattern: "^_",
267
+ varsIgnorePattern: "^_",
268
+ ignoreRestSiblings: true
378
269
  }
379
270
  ],
380
- // Overrides built-in rules
381
- ...options.overrides
382
- }
383
- }
384
- ];
385
-
386
- // src/configs/unicorn.ts
387
- var unicorn = (options = {}) => [
388
- {
389
- name: "ntnyq/unicorn",
390
- plugins: {
391
- unicorn: import_eslint_plugin_unicorn.default
392
- },
393
- rules: {
394
- // Disabled for now
395
- "unicorn/better-regex": "off",
396
- "unicorn/prefer-top-level-await": "off",
397
- "unicorn/explicit-length-check": "off",
398
- "unicorn/no-array-callback-reference": "off",
399
- "unicorn/error-message": "error",
400
- "unicorn/escape-case": "error",
401
- "unicorn/no-new-buffer": "error",
402
- "unicorn/number-literal-case": "error",
403
- "unicorn/prefer-includes": "error",
404
- "unicorn/prefer-type-error": "error",
405
- "unicorn/throw-new-error": "error",
406
- "unicorn/no-unnecessary-await": "error",
407
- "unicorn/switch-case-braces": ["error", "avoid"],
408
- "unicorn/no-typeof-undefined": "error",
409
- "unicorn/prefer-set-size": "error",
410
- "unicorn/prefer-regexp-test": "error",
411
- "unicorn/no-static-only-class": "error",
412
- "unicorn/no-zero-fractions": "error",
413
- "unicorn/custom-error-definition": "error",
414
- "unicorn/prefer-modern-math-apis": "error",
415
- "unicorn/new-for-builtins": "error",
416
- "unicorn/no-console-spaces": "error",
417
- "unicorn/no-for-loop": "error",
418
- "unicorn/no-hex-escape": "error",
419
- "unicorn/no-lonely-if": "error",
420
- "unicorn/prefer-keyboard-event-key": "error",
421
- "unicorn/prefer-math-trunc": "error",
422
- "unicorn/prefer-negative-index": "error",
423
- "unicorn/prefer-node-protocol": "error",
424
- "unicorn/prefer-number-properties": "error",
425
- "unicorn/prefer-optional-catch-binding": "error",
426
- "unicorn/prefer-prototype-methods": "error",
427
- "unicorn/prefer-reflect-apply": "error",
428
- "unicorn/catch-error-name": [
271
+ "@typescript-eslint/no-redeclare": "error",
272
+ "@typescript-eslint/consistent-type-imports": [
429
273
  "error",
430
274
  {
431
- name: "err",
432
- ignore: ["^_."]
275
+ prefer: "type-imports",
276
+ fixStyle: "separate-type-imports",
277
+ disallowTypeAnnotations: false
433
278
  }
434
279
  ],
435
- "unicorn/prefer-date-now": "error",
436
- // String
437
- "unicorn/prefer-string-slice": "error",
438
- "unicorn/prefer-string-trim-start-end": "error",
439
- "unicorn/prefer-string-starts-ends-with": "error",
440
- // DOM
441
- "unicorn/prefer-add-event-listener": "error",
442
- "unicorn/no-invalid-remove-event-listener": "error",
443
- "unicorn/prefer-query-selector": "error",
444
- "unicorn/prefer-modern-dom-apis": "error",
445
- "unicorn/prefer-dom-node-append": "error",
446
- "unicorn/prefer-dom-node-dataset": "error",
447
- "unicorn/prefer-dom-node-remove": "error",
448
- "unicorn/prefer-dom-node-text-content": "error",
449
- // Array
450
- "unicorn/no-new-array": "error",
451
- "unicorn/no-instanceof-array": "error",
452
- "unicorn/no-array-push-push": "error",
453
- "unicorn/no-array-method-this-argument": "error",
454
- "unicorn/prefer-array-find": "error",
455
- "unicorn/prefer-array-some": "error",
456
- "unicorn/prefer-array-flat-map": "error",
457
- "unicorn/prefer-array-index-of": "error",
458
- // Overrides built-in rules
459
- ...options.overrides
460
- }
461
- }
462
- ];
463
-
464
- // src/configs/prettier.ts
465
- var prettier = (options = {}) => [
466
- {
467
- name: "ntnyq/prettier",
468
- plugins: {
469
- prettier: import_eslint_plugin_prettier.default
280
+ "@typescript-eslint/no-empty-object-type": [
281
+ "error",
282
+ {
283
+ allowInterfaces: "always",
284
+ allowObjectTypes: "always"
285
+ }
286
+ ],
287
+ "@typescript-eslint/consistent-type-assertions": [
288
+ "error",
289
+ {
290
+ assertionStyle: "as",
291
+ objectLiteralTypeAssertions: "allow-as-parameter"
292
+ }
293
+ ],
294
+ "@typescript-eslint/prefer-as-const": "warn",
295
+ "@typescript-eslint/ban-types": "off",
296
+ "@typescript-eslint/camelcase": "off",
297
+ "@typescript-eslint/no-namespace": "off",
298
+ "@typescript-eslint/ban-ts-ignore": "off",
299
+ "@typescript-eslint/ban-ts-comment": "off",
300
+ "@typescript-eslint/no-explicit-any": "off",
301
+ "@typescript-eslint/no-empty-function": "off",
302
+ "@typescript-eslint/naming-convention": "off",
303
+ "@typescript-eslint/no-non-null-assertion": "off",
304
+ "@typescript-eslint/triple-slash-reference": "off",
305
+ "@typescript-eslint/no-parameter-properties": "off",
306
+ "@typescript-eslint/explicit-member-accessibility": "off",
307
+ "@typescript-eslint/explicit-function-return-type": "off",
308
+ "@typescript-eslint/explicit-module-boundary-types": "off",
309
+ "@typescript-eslint/consistent-indexed-object-style": "off"
470
310
  },
311
+ // Overrides built-in rules
312
+ ...options.overrides
313
+ });
314
+ return configs;
315
+ };
316
+ var typescript = (options = {}) => [
317
+ ...typescriptCore(options),
318
+ {
319
+ name: "ntnyq/ts/dts",
320
+ files: [GLOB_DTS],
471
321
  rules: {
472
- "vue/array-bracket-newline": "off",
473
- "vue/array-bracket-spacing": "off",
474
- "vue/array-element-newline": "off",
475
- "vue/arrow-spacing": "off",
476
- "vue/block-spacing": "off",
477
- "vue/block-tag-newline": "off",
478
- "vue/brace-style": "off",
479
- "vue/comma-dangle": "off",
480
- "vue/comma-spacing": "off",
481
- "vue/comma-style": "off",
482
- "vue/dot-location": "off",
483
- "vue/func-call-spacing": "off",
484
- "vue/html-closing-bracket-newline": "off",
485
- "vue/html-closing-bracket-spacing": "off",
486
- "vue/html-end-tags": "off",
487
- "vue/html-indent": "off",
488
- "vue/html-quotes": "off",
489
- "vue/key-spacing": "off",
490
- "vue/keyword-spacing": "off",
491
- "vue/max-attributes-per-line": "off",
492
- "vue/multiline-html-element-content-newline": "off",
493
- "vue/multiline-ternary": "off",
494
- "vue/mustache-interpolation-spacing": "off",
495
- "vue/no-extra-parens": "off",
496
- "vue/no-multi-spaces": "off",
497
- "vue/no-spaces-around-equal-signs-in-attribute": "off",
498
- "vue/object-curly-newline": "off",
499
- "vue/object-curly-spacing": "off",
500
- "vue/object-property-newline": "off",
501
- "vue/operator-linebreak": "off",
502
- "vue/quote-props": "off",
503
- "vue/script-indent": "off",
504
- "vue/singleline-html-element-content-newline": "off",
505
- "vue/space-in-parens": "off",
506
- "vue/space-infix-ops": "off",
507
- "vue/space-unary-ops": "off",
508
- "vue/template-curly-spacing": "off",
509
- ...import_eslint_plugin_prettier.default.configs.recommended.rules,
510
- "prettier/prettier": options.level || "warn",
511
- // Overrides built-in rules
512
- ...options.overrides
322
+ "no-use-before-define": "off",
323
+ "no-restricted-syntax": "off",
324
+ "import/no-duplicates": "off",
325
+ "import/newline-after-import": "off"
513
326
  }
514
327
  },
515
- /**
516
- * Languages that prettier currently does not support
517
- */
518
328
  {
519
- name: "ntnyq/prettier/disabled",
520
- files: [GLOB_TOML],
521
- plugins: {
522
- prettier: import_eslint_plugin_prettier.default
523
- },
329
+ name: "ntnyq/ts/test",
330
+ files: ["**/*.{spec,test}.ts?(x)"],
524
331
  rules: {
525
- "prettier/prettier": "off"
332
+ "no-unused-expressions": "off",
333
+ "max-lines-per-function": "off"
526
334
  }
527
- }
528
- ];
529
-
530
- // src/configs/comments.ts
531
- var comments = (options = {}) => [
335
+ },
532
336
  {
533
- name: "ntnyq/eslint-comments",
534
- plugins: {
535
- "@eslint-community/eslint-comments": import_eslint_plugin_eslint_comments.default
536
- },
537
- rules: {
538
- ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
539
- "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
540
- // Overrides built-in rules
541
- ...options.overrides
542
- }
337
+ name: "ntnyq/ts/cjs",
338
+ files: [GLOB_JS],
339
+ rules: {}
543
340
  }
544
341
  ];
545
342
 
546
- // src/configs/javascript.ts
547
- var import_globals = __toESM(require("globals"), 1);
548
- var import_js = __toESM(require("@eslint/js"), 1);
549
- var javascript = (options = {}) => {
550
- const strictRules = {
551
- complexity: ["error", { max: 30 }],
552
- "max-params": ["error", { max: 5 }],
553
- "max-depth": ["error", { max: 5 }],
554
- "max-nested-callbacks": ["error", { max: 10 }],
555
- "max-lines": [
556
- "error",
557
- {
558
- max: 1e3,
559
- skipComments: true,
560
- skipBlankLines: true
561
- }
562
- ],
563
- "max-lines-per-function": [
564
- "error",
565
- {
566
- max: 200,
567
- skipComments: true,
568
- skipBlankLines: true
569
- }
570
- ]
571
- };
343
+ // src/configs/vue.ts
344
+ var vue2Rules = {
345
+ ...import_eslint_plugin_vue.default.configs.base.rules,
346
+ ...import_eslint_plugin_vue.default.configs.essential.rules,
347
+ ...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
348
+ ...import_eslint_plugin_vue.default.configs.recommended.rules
349
+ };
350
+ var vue3Rules = {
351
+ ...import_eslint_plugin_vue.default.configs.base.rules,
352
+ ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
353
+ ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
354
+ ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
355
+ };
356
+ var vue = (options = {}) => {
357
+ const isVue3 = options.vueVersion !== 2;
572
358
  return [
359
+ ...import_typescript_eslint.default.config({
360
+ name: "ntnyq/vue/ts",
361
+ files: [GLOB_VUE],
362
+ extends: typescriptCore()
363
+ }),
573
364
  {
574
- ...import_js.default.configs.recommended,
575
- name: "ntnyq/js/recommended"
576
- },
577
- {
578
- name: "ntnyq/js/core",
365
+ name: "ntnyq/vue/core",
366
+ files: [GLOB_VUE],
367
+ plugins: {
368
+ vue: import_eslint_plugin_vue.default,
369
+ "@typescript-eslint": import_typescript_eslint.default.plugin
370
+ },
579
371
  languageOptions: {
580
- globals: {
581
- ...import_globals.default.browser,
582
- ...import_globals.default.es2021,
583
- ...import_globals.default.node
584
- },
585
- sourceType: "module"
372
+ parser: parserVue,
373
+ parserOptions: {
374
+ parser: "@typescript-eslint/parser",
375
+ sourceType: "module",
376
+ extraFileExtensions: [".vue"],
377
+ ecmaFeatures: {
378
+ jsx: true
379
+ }
380
+ }
586
381
  },
382
+ processor: import_eslint_plugin_vue.default.processors[".vue"],
587
383
  rules: {
588
- // standard v17.0.0
589
- "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
590
- camelcase: [
384
+ ...isVue3 ? vue3Rules : vue2Rules,
385
+ // OFF
386
+ "vue/no-v-html": "off",
387
+ "vue/require-prop-types": "off",
388
+ "vue/require-default-prop": "off",
389
+ "vue/multi-word-component-names": "off",
390
+ "vue/no-v-text-v-html-on-component": "off",
391
+ "vue/no-setup-props-reactivity-loss": "off",
392
+ "vue/html-self-closing": [
591
393
  "error",
592
394
  {
593
- allow: ["^UNSAFE_"],
594
- properties: "never",
595
- ignoreGlobals: true
395
+ html: {
396
+ void: "always",
397
+ normal: "always",
398
+ component: "always"
399
+ },
400
+ svg: "always",
401
+ math: "always"
596
402
  }
597
403
  ],
598
- "constructor-super": "error",
599
- curly: ["error", "multi-line"],
600
- "default-case-last": "error",
601
- "dot-notation": ["error", { allowKeywords: true }],
602
- "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
603
- "no-array-constructor": "error",
604
- "no-async-promise-executor": "error",
605
- "no-caller": "error",
606
- "no-class-assign": "error",
607
- "no-compare-neg-zero": "error",
608
- "no-cond-assign": "error",
609
- "no-const-assign": "error",
610
- "no-constant-condition": ["error", { checkLoops: false }],
611
- "no-control-regex": "error",
612
- "no-debugger": "error",
613
- "no-delete-var": "error",
614
- "no-dupe-args": "error",
615
- "no-dupe-class-members": "error",
616
- "no-dupe-keys": "error",
617
- "no-duplicate-case": "error",
618
- "no-useless-backreference": "error",
619
- "no-empty": ["error", { allowEmptyCatch: true }],
620
- "no-empty-character-class": "error",
621
- "no-empty-pattern": "error",
622
- "no-eval": "error",
623
- "no-ex-assign": "error",
624
- "no-extend-native": "error",
625
- "no-extra-bind": "error",
626
- "no-extra-boolean-cast": "error",
627
- "no-fallthrough": "error",
628
- "no-func-assign": "error",
629
- "no-global-assign": "error",
630
- "no-implied-eval": "error",
631
- "no-import-assign": "error",
632
- "no-invalid-regexp": "error",
633
- "no-irregular-whitespace": "error",
634
- "no-iterator": "error",
635
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
636
- "no-lone-blocks": "error",
637
- "no-loss-of-precision": "error",
638
- "no-misleading-character-class": "error",
639
- "no-prototype-builtins": "error",
640
- "no-useless-catch": "error",
641
- "no-new": "error",
642
- "no-new-func": "error",
643
- "no-new-wrappers": "error",
644
- "no-obj-calls": "error",
645
- "no-octal": "error",
646
- "no-octal-escape": "error",
647
- "no-proto": "error",
648
- "no-redeclare": ["error", { builtinGlobals: false }],
649
- "no-regex-spaces": "error",
650
- "no-self-assign": ["error", { props: true }],
651
- "no-self-compare": "error",
652
- "no-sequences": "error",
653
- "no-shadow-restricted-names": "error",
654
- "no-sparse-arrays": "error",
655
- "no-template-curly-in-string": "error",
656
- "no-this-before-super": "error",
657
- "no-throw-literal": "error",
658
- "no-undef": "error",
659
- "no-undef-init": "error",
660
- "no-unexpected-multiline": "error",
661
- "no-unmodified-loop-condition": "error",
662
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
663
- "no-unreachable": "error",
664
- "no-unreachable-loop": "error",
665
- "no-unsafe-finally": "error",
666
- "no-unsafe-negation": "error",
667
- "no-unused-expressions": [
404
+ "vue/block-tag-newline": [
668
405
  "error",
669
406
  {
670
- allowShortCircuit: true,
671
- allowTernary: true,
672
- allowTaggedTemplates: true
407
+ singleline: "always",
408
+ multiline: "always"
673
409
  }
674
410
  ],
675
- "no-unused-vars": [
411
+ "vue/component-name-in-template-casing": [
676
412
  "error",
413
+ "PascalCase",
677
414
  {
678
- args: "none",
679
- caughtErrors: "none",
680
- ignoreRestSiblings: true,
681
- vars: "all"
415
+ // Force auto-import components to be PascalCase
416
+ registeredComponentsOnly: false,
417
+ ignores: ["slot", "component"]
682
418
  }
683
419
  ],
684
- "no-useless-call": "error",
685
- "no-useless-computed-key": "error",
686
- "no-useless-constructor": "error",
687
- "no-useless-rename": "error",
688
- "no-useless-return": "error",
689
- "prefer-promise-reject-errors": "error",
690
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
691
- "symbol-description": "error",
692
- "unicode-bom": ["error", "never"],
693
- "use-isnan": [
420
+ "vue/component-options-name-casing": ["error", "PascalCase"],
421
+ "vue/custom-event-name-casing": ["error", "camelCase"],
422
+ "vue/define-macros-order": [
694
423
  "error",
695
424
  {
696
- enforceForSwitchCase: true,
697
- enforceForIndexOf: true
425
+ order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
698
426
  }
699
427
  ],
700
- "valid-typeof": ["error", { requireStringLiterals: true }],
701
- yoda: ["error", "never"],
702
- // es6+
703
- "no-var": "error",
704
- "prefer-rest-params": "error",
705
- "prefer-spread": "error",
706
- "prefer-template": "error",
707
- "no-empty-static-block": "error",
708
- "no-new-native-nonconstructor": "error",
709
- "prefer-const": [
428
+ "vue/html-comment-content-spacing": [
710
429
  "error",
430
+ "always",
711
431
  {
712
- destructuring: "all",
713
- ignoreReadBeforeAssign: true
432
+ exceptions: ["-"]
714
433
  }
715
434
  ],
716
- "prefer-arrow-callback": [
435
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
436
+ "vue/no-useless-v-bind": "error",
437
+ "vue/padding-line-between-blocks": "error",
438
+ "vue/next-tick-style": ["error", "promise"],
439
+ "vue/array-bracket-spacing": ["error", "never"],
440
+ "vue/prefer-separate-static-class": "error",
441
+ "vue/no-constant-condition": "error",
442
+ "vue/prefer-true-attribute-shorthand": ["error", "always"],
443
+ "vue/prefer-define-options": "error",
444
+ "vue/valid-define-options": "error",
445
+ // TypeScript enhancements
446
+ "vue/define-emits-declaration": ["error", "type-literal"],
447
+ "vue/no-unused-emit-declarations": "error",
448
+ "vue/this-in-template": ["error", "never"],
449
+ "vue/arrow-spacing": ["error", { before: true, after: true }],
450
+ "vue/block-spacing": ["error", "always"],
451
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
452
+ "vue/comma-dangle": ["error", "always-multiline"],
453
+ "vue/comma-spacing": ["error", { before: false, after: true }],
454
+ "vue/comma-style": ["error", "last"],
455
+ "vue/dot-location": ["error", "property"],
456
+ "vue/dot-notation": ["error", { allowKeywords: true }],
457
+ "vue/eqeqeq": ["error", "smart"],
458
+ "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
459
+ "vue/keyword-spacing": ["error", { before: true, after: true }],
460
+ "vue/no-empty-pattern": "error",
461
+ "vue/no-loss-of-precision": "error",
462
+ "vue/no-irregular-whitespace": "error",
463
+ "vue/no-use-v-else-with-v-for": "error",
464
+ "vue/require-typed-object-prop": "error",
465
+ "vue/no-extra-parens": ["error", "functions"],
466
+ "vue/no-restricted-syntax": [
467
+ "error",
468
+ "DebuggerStatement",
469
+ "LabeledStatement",
470
+ "WithStatement"
471
+ ],
472
+ "vue/no-sparse-arrays": "error",
473
+ "vue/no-deprecated-model-definition": [
717
474
  "error",
718
475
  {
719
- allowNamedFunctions: false,
720
- allowUnboundThis: true
476
+ allowVue3Compat: true
721
477
  }
722
478
  ],
723
- "object-shorthand": [
479
+ "vue/object-curly-newline": [
480
+ "error",
481
+ {
482
+ multiline: true,
483
+ consistent: true
484
+ }
485
+ ],
486
+ "vue/no-static-inline-styles": [
487
+ "error",
488
+ {
489
+ allowBinding: true
490
+ }
491
+ ],
492
+ "vue/object-curly-spacing": ["error", "always"],
493
+ "vue/object-property-newline": [
494
+ "error",
495
+ {
496
+ allowMultiplePropertiesPerLine: true
497
+ }
498
+ ],
499
+ "vue/object-shorthand": [
724
500
  "error",
725
501
  "always",
726
502
  {
@@ -728,954 +504,1222 @@ var javascript = (options = {}) => {
728
504
  avoidQuotes: true
729
505
  }
730
506
  ],
731
- // best-practice
732
- eqeqeq: ["error", "smart"],
733
- "array-callback-return": "error",
734
- "block-scoped-var": "error",
735
- "consistent-return": "off",
736
- "no-alert": "error",
737
- "no-case-declarations": "error",
738
- "no-multi-str": "error",
739
- "no-with": "error",
740
- "no-void": "error",
741
- "no-useless-escape": "off",
742
- "vars-on-top": "error",
743
- "require-await": "off",
744
- "no-return-assign": "off",
745
- "one-var": ["error", "never"],
746
- "no-use-before-define": [
507
+ "vue/operator-linebreak": ["error", "before"],
508
+ "vue/prefer-template": "error",
509
+ "vue/prop-name-casing": ["error", "camelCase"],
510
+ "vue/quote-props": ["error", "consistent-as-needed"],
511
+ "vue/space-in-parens": ["error", "never"],
512
+ "vue/space-infix-ops": "error",
513
+ "vue/space-unary-ops": [
747
514
  "error",
748
515
  {
749
- functions: false,
750
- classes: false,
751
- variables: true
516
+ words: true,
517
+ nonwords: false
752
518
  }
753
519
  ],
754
- "sort-imports": [
520
+ "vue/template-curly-spacing": "error",
521
+ "vue/block-order": [
755
522
  "error",
756
523
  {
757
- ignoreCase: false,
758
- ignoreDeclarationSort: true,
759
- ignoreMemberSort: false,
760
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
761
- allowSeparatedGroups: false
524
+ order: ["script", "template", "style"]
762
525
  }
763
526
  ],
764
- // Strict rules
765
- ...options.strict ? strictRules : {},
766
- // Overrides built-in rules
767
- ...options.overrides
768
- }
769
- },
770
- {
771
- name: "ntnyq/js/scripts",
772
- files: ["**/scripts/*", "**/cli.*"],
773
- rules: {
774
- "no-console": "off"
775
- }
776
- },
777
- {
778
- name: "ntnyq/js/test",
779
- files: ["**/*.{test,spec}.js?(x)"],
780
- rules: {
781
- "no-unused-expressions": "off",
782
- "max-lines-per-function": "off"
783
- }
784
- }
785
- ];
786
- };
787
- var jsx = () => [
788
- {
789
- name: "ntnyq/jsx",
790
- files: ["**/*.jsx"],
791
- languageOptions: {
792
- parserOptions: {
793
- ecmaFeatures: {
794
- jsx: true
795
- }
796
- }
797
- }
798
- }
799
- ];
800
-
801
- // src/configs/typescript.ts
802
- var import_node_process2 = __toESM(require("process"), 1);
803
- var typescriptCore = (options = {}) => {
804
- const isTypeAware = !!options.tsconfigPath;
805
- const configs = import_typescript_eslint.default.config({
806
- name: "ntnyq/ts/core",
807
- extends: [...import_typescript_eslint.default.configs.recommended],
808
- files: [GLOB_TS, GLOB_TSX],
809
- languageOptions: {
810
- parser: import_typescript_eslint.default.parser,
811
- parserOptions: {
812
- sourceType: "module",
813
- ...isTypeAware ? {
814
- projectService: {
815
- defaultProject: options.tsconfigPath
816
- },
817
- tsconfigRootDir: import_node_process2.default.cwd()
818
- } : {}
819
- }
820
- },
821
- rules: {
822
- "@typescript-eslint/no-unused-vars": [
823
- "error",
824
- {
825
- // Args after the last used will be reported
826
- args: "after-used",
827
- argsIgnorePattern: "^_",
828
- caughtErrors: "all",
829
- caughtErrorsIgnorePattern: "^_",
830
- destructuredArrayIgnorePattern: "^_",
831
- varsIgnorePattern: "^_",
832
- ignoreRestSiblings: true
833
- }
834
- ],
835
- "@typescript-eslint/no-redeclare": "error",
836
- "@typescript-eslint/consistent-type-imports": [
837
- "error",
838
- {
839
- prefer: "type-imports",
840
- fixStyle: "separate-type-imports",
841
- disallowTypeAnnotations: false
842
- }
843
- ],
844
- "@typescript-eslint/no-empty-object-type": [
845
- "error",
846
- {
847
- allowInterfaces: "always",
848
- allowObjectTypes: "always"
849
- }
850
- ],
851
- "@typescript-eslint/consistent-type-assertions": [
852
- "error",
853
- {
854
- assertionStyle: "as",
855
- objectLiteralTypeAssertions: "allow-as-parameter"
856
- }
857
- ],
858
- "@typescript-eslint/prefer-as-const": "warn",
859
- "@typescript-eslint/ban-types": "off",
860
- "@typescript-eslint/camelcase": "off",
861
- "@typescript-eslint/no-namespace": "off",
862
- "@typescript-eslint/ban-ts-ignore": "off",
863
- "@typescript-eslint/ban-ts-comment": "off",
864
- "@typescript-eslint/no-explicit-any": "off",
865
- "@typescript-eslint/no-empty-function": "off",
866
- "@typescript-eslint/naming-convention": "off",
867
- "@typescript-eslint/no-non-null-assertion": "off",
868
- "@typescript-eslint/triple-slash-reference": "off",
869
- "@typescript-eslint/no-parameter-properties": "off",
870
- "@typescript-eslint/explicit-member-accessibility": "off",
871
- "@typescript-eslint/explicit-function-return-type": "off",
872
- "@typescript-eslint/explicit-module-boundary-types": "off",
873
- "@typescript-eslint/consistent-indexed-object-style": "off"
874
- },
875
- // Overrides built-in rules
876
- ...options.overrides
877
- });
878
- return configs;
879
- };
880
- var typescript = (options = {}) => [
881
- ...typescriptCore(options),
882
- {
883
- name: "ntnyq/ts/dts",
884
- files: [GLOB_DTS],
885
- rules: {
886
- "no-use-before-define": "off",
887
- "no-restricted-syntax": "off",
888
- "import/no-duplicates": "off",
889
- "import/newline-after-import": "off"
890
- }
891
- },
892
- {
893
- name: "ntnyq/ts/test",
894
- files: ["**/*.{spec,test}.ts?(x)"],
895
- rules: {
896
- "no-unused-expressions": "off",
897
- "max-lines-per-function": "off"
527
+ "vue/attributes-order": [
528
+ "error",
529
+ {
530
+ order: [
531
+ "EVENTS",
532
+ // `@click="functionCall"`, `v-on="event"`
533
+ "TWO_WAY_BINDING",
534
+ // `v-model`
535
+ "OTHER_DIRECTIVES",
536
+ // `v-custom-directive`
537
+ "LIST_RENDERING",
538
+ // `v-for item in items`
539
+ "CONDITIONALS",
540
+ // `v-if`, `v-show`, `v-cloak`
541
+ "CONTENT",
542
+ // `v-text`, `v-html`
543
+ "SLOT",
544
+ // `v-slot`, `slot`
545
+ "UNIQUE",
546
+ // `ref`, `key`
547
+ "DEFINITION",
548
+ // `is`, `v-is`
549
+ "ATTR_DYNAMIC",
550
+ // `v-bind:prop="foo"`, `:prop="foo"`
551
+ // `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
552
+ "RENDER_MODIFIERS",
553
+ // `v-once`, `v-pre`
554
+ "GLOBAL",
555
+ // `id`
556
+ "ATTR_STATIC",
557
+ // `prop="foo", `static attributes
558
+ "ATTR_SHORTHAND_BOOL"
559
+ // `disabled`, prop shorthand
560
+ ],
561
+ alphabetical: false
562
+ }
563
+ ],
564
+ "vue/order-in-components": [
565
+ "error",
566
+ {
567
+ order: [
568
+ "el",
569
+ "name",
570
+ "key",
571
+ "parent",
572
+ "functional",
573
+ ["provide", "inject"],
574
+ ["delimiters", "comments"],
575
+ ["components", "directives", "filters"],
576
+ "extends",
577
+ "mixins",
578
+ "layout",
579
+ "middleware",
580
+ "validate",
581
+ "scrollToTop",
582
+ "transition",
583
+ "loading",
584
+ "inheritAttrs",
585
+ "model",
586
+ ["props", "propsData"],
587
+ "emits",
588
+ "setup",
589
+ "asyncData",
590
+ "computed",
591
+ "data",
592
+ "fetch",
593
+ "head",
594
+ "methods",
595
+ ["template", "render"],
596
+ "watch",
597
+ "watchQuery",
598
+ "LIFECYCLE_HOOKS",
599
+ "renderError",
600
+ "ROUTER_GUARDS"
601
+ ]
602
+ }
603
+ ],
604
+ "vue/max-attributes-per-line": [
605
+ "error",
606
+ {
607
+ singleline: 1,
608
+ multiline: 1
609
+ }
610
+ ],
611
+ // Overrides built-in rules
612
+ ...options.overrides
613
+ }
898
614
  }
899
- },
900
- {
901
- name: "ntnyq/ts/cjs",
902
- files: [GLOB_JS],
903
- rules: {}
904
- }
905
- ];
615
+ ];
616
+ };
906
617
 
907
- // src/configs/unusedImports.ts
908
- var unusedImports = (options = {}) => [
618
+ // src/configs/yml.ts
619
+ var yml = (options = {}) => [
909
620
  {
910
- name: "ntnyq/unused-imports",
621
+ name: "ntnyq/yaml",
622
+ files: [GLOB_YAML],
623
+ languageOptions: {
624
+ parser: parserYaml
625
+ },
911
626
  plugins: {
912
- "unused-imports": import_eslint_plugin_unused_imports.default
627
+ yml: import_eslint_plugin_yml.default
913
628
  },
914
629
  rules: {
915
- "@typescript-eslint/no-unused-vars": "off",
916
- "unused-imports/no-unused-imports": "error",
917
- "unused-imports/no-unused-vars": [
918
- "warn",
919
- {
920
- vars: "all",
921
- varsIgnorePattern: "^_",
922
- args: "after-used",
923
- argsIgnorePattern: "^_"
924
- }
925
- ],
630
+ ...import_eslint_plugin_yml.default.configs.standard.rules,
631
+ ...import_eslint_plugin_yml.default.configs.prettier.rules,
632
+ "yml/no-empty-mapping-value": "off",
633
+ "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
926
634
  // Overrides built-in rules
927
635
  ...options.overrides
928
636
  }
929
637
  }
930
638
  ];
931
639
 
932
- // src/configs/perfectionist.ts
933
- var perfectionist = (options = {}) => [
640
+ // src/configs/node.ts
641
+ var node = (options = {}) => [
934
642
  {
935
- name: "ntnyq/perfectionist",
643
+ name: "ntnyq/node",
936
644
  plugins: {
937
- perfectionist: import_eslint_plugin_perfectionist.default
645
+ node: import_eslint_plugin_n.default
938
646
  },
939
647
  rules: {
940
- "perfectionist/sort-imports": [
941
- "error",
942
- {
943
- groups: [
944
- "builtin",
945
- "external",
946
- "internal",
947
- "internal-type",
948
- "parent",
949
- "parent-type",
950
- "sibling",
951
- "sibling-type",
952
- "index",
953
- "index-type",
954
- "object",
955
- "type",
956
- "side-effect",
957
- "side-effect-style"
958
- ],
959
- internalPattern: ["~/**", "@/**", "#**"],
960
- newlinesBetween: "ignore"
961
- }
962
- ],
963
- "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
964
- "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }],
648
+ "node/handle-callback-err": ["error", "^(err|error)$"],
649
+ "node/no-deprecated-api": "error",
650
+ "node/no-exports-assign": "error",
651
+ "node/no-new-require": "error",
652
+ "node/no-path-concat": "error",
653
+ "node/prefer-global/buffer": ["error", "never"],
654
+ "node/prefer-global/process": ["error", "never"],
655
+ "node/process-exit-as-throw": "error",
965
656
  // Overrides built-in rules
966
657
  ...options.overrides
967
658
  }
968
659
  }
969
660
  ];
970
661
 
971
- // src/configs/regexp.ts
972
- var regexp = (options = {}) => [
973
- /**
974
- * https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/rules/recommended.ts
975
- */
976
- {
977
- name: "ntnyq/regexp",
978
- ...pluginRegexp.configs["flat/recommended"],
979
- // Overrides built-in rules
980
- ...options.overrides
981
- }
982
- ];
983
-
984
- // src/configs/unocss.ts
985
- var unocss = (options = {}) => [
662
+ // src/configs/sort.ts
663
+ var sortPackageJson = () => [
986
664
  {
987
- name: "ntnyq/unocss",
988
- plugins: {
989
- unocss: import_eslint_plugin.default
990
- },
665
+ name: "ntnyq/sort/package-json",
666
+ files: ["**/package.json"],
991
667
  rules: {
992
- "unocss/order": "error",
993
- // We don't use this
994
- "unocss/order-attributify": "off",
995
- // Overrides built-in rules
996
- ...options.overrides
997
- }
998
- }
999
- ];
1000
-
1001
- // src/configs/gitignore.ts
1002
- var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
1003
- var gitignore = (options = {}) => [
1004
- {
1005
- ...(0, import_eslint_config_flat_gitignore.default)(options),
1006
- name: "ntnyq/gitignore"
668
+ "jsonc/sort-keys": [
669
+ "error",
670
+ {
671
+ pathPattern: "^$",
672
+ order: [
673
+ "publisher",
674
+ "name",
675
+ "displayName",
676
+ "preview",
677
+ "type",
678
+ "version",
679
+ "private",
680
+ "packageManager",
681
+ "description",
682
+ "keywords",
683
+ "license",
684
+ "author",
685
+ "homepage",
686
+ "repository",
687
+ "funding",
688
+ "exports",
689
+ "main",
690
+ "module",
691
+ "unpkg",
692
+ "jsdelivr",
693
+ // workaround for `type: "module"` with TS `moduleResolution: "node16"`
694
+ "types",
695
+ "typesVersions",
696
+ "bin",
697
+ "icon",
698
+ "files",
699
+ "sideEffects",
700
+ "scripts",
701
+ "peerDependencies",
702
+ "peerDependenciesMeta",
703
+ "dependencies",
704
+ "optionalDependencies",
705
+ "devDependencies",
706
+ "activationEvents",
707
+ "contributes",
708
+ "categories",
709
+ "engines",
710
+ "pnpm",
711
+ "overrides",
712
+ "resolutions",
713
+ "husky",
714
+ "prettier",
715
+ "nano-staged",
716
+ "lint-staged",
717
+ "eslintConfig"
718
+ ]
719
+ },
720
+ {
721
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
722
+ order: { type: "asc" }
723
+ },
724
+ {
725
+ order: { type: "asc" },
726
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
727
+ },
728
+ {
729
+ pathPattern: "^exports.*$",
730
+ order: ["types", "import", "require", "default"]
731
+ },
732
+ {
733
+ pathPattern: "^scripts$",
734
+ order: { type: "asc" }
735
+ },
736
+ {
737
+ order: [
738
+ // client hooks only
739
+ "pre-commit",
740
+ "prepare-commit-msg",
741
+ "commit-msg",
742
+ "post-commit",
743
+ "pre-rebase",
744
+ "post-rewrite",
745
+ "post-checkout",
746
+ "post-merge",
747
+ "pre-push",
748
+ "pre-auto-gc"
749
+ ],
750
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
751
+ }
752
+ ],
753
+ "jsonc/sort-array-values": [
754
+ "error",
755
+ {
756
+ pathPattern: "^files$",
757
+ order: { type: "asc" }
758
+ }
759
+ ]
760
+ }
1007
761
  }
1008
762
  ];
1009
-
1010
- // src/configs/command.ts
1011
- var import_config = __toESM(require("eslint-plugin-command/config"), 1);
1012
- var command = (options = {}) => [
763
+ var sortTsConfig = () => [
1013
764
  {
1014
- ...(0, import_config.default)(options),
1015
- name: "ntnyq/command"
765
+ name: "ntnyq/sort/tsconfig",
766
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
767
+ rules: {
768
+ "jsonc/sort-keys": [
769
+ "error",
770
+ {
771
+ order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
772
+ pathPattern: "^$"
773
+ },
774
+ {
775
+ order: [
776
+ /* Projects */
777
+ "incremental",
778
+ "composite",
779
+ "tsBuildInfoFile",
780
+ "disableSourceOfProjectReferenceRedirect",
781
+ "disableSolutionSearching",
782
+ "disableReferencedProjectLoad",
783
+ /* Language and Environment */
784
+ "target",
785
+ "lib",
786
+ "jsx",
787
+ "experimentalDecorators",
788
+ "emitDecoratorMetadata",
789
+ "jsxFactory",
790
+ "jsxFragmentFactory",
791
+ "jsxImportSource",
792
+ "reactNamespace",
793
+ "noLib",
794
+ "useDefineForClassFields",
795
+ "moduleDetection",
796
+ /* Modules */
797
+ "module",
798
+ "rootDir",
799
+ "moduleResolution",
800
+ "baseUrl",
801
+ "paths",
802
+ "rootDirs",
803
+ "typeRoots",
804
+ "types",
805
+ "allowUmdGlobalAccess",
806
+ "moduleSuffixes",
807
+ "allowImportingTsExtensions",
808
+ "resolvePackageJsonExports",
809
+ "resolvePackageJsonImports",
810
+ "customConditions",
811
+ "resolveJsonModule",
812
+ "allowArbitraryExtensions",
813
+ "noResolve",
814
+ /* JavaScript Support */
815
+ "allowJs",
816
+ "checkJs",
817
+ "maxNodeModuleJsDepth",
818
+ /* Emit */
819
+ "declaration",
820
+ "declarationMap",
821
+ "emitDeclarationOnly",
822
+ "sourceMap",
823
+ "inlineSourceMap",
824
+ "outFile",
825
+ "outDir",
826
+ "removeComments",
827
+ "noEmit",
828
+ "importHelpers",
829
+ "importsNotUsedAsValues",
830
+ "downlevelIteration",
831
+ "sourceRoot",
832
+ "mapRoot",
833
+ "inlineSources",
834
+ "emitBOM",
835
+ "newLine",
836
+ "stripInternal",
837
+ "noEmitHelpers",
838
+ "noEmitOnError",
839
+ "preserveConstEnums",
840
+ "declarationDir",
841
+ "preserveValueImports",
842
+ /* Interop Constraints */
843
+ "isolatedModules",
844
+ "verbatimModuleSyntax",
845
+ "allowSyntheticDefaultImports",
846
+ "esModuleInterop",
847
+ "preserveSymlinks",
848
+ "forceConsistentCasingInFileNames",
849
+ /* Type Checking */
850
+ "strict",
851
+ "strictBindCallApply",
852
+ "strictFunctionTypes",
853
+ "strictNullChecks",
854
+ "strictPropertyInitialization",
855
+ "allowUnreachableCode",
856
+ "allowUnusedLabels",
857
+ "alwaysStrict",
858
+ "exactOptionalPropertyTypes",
859
+ "noFallthroughCasesInSwitch",
860
+ "noImplicitAny",
861
+ "noImplicitOverride",
862
+ "noImplicitReturns",
863
+ "noImplicitThis",
864
+ "noPropertyAccessFromIndexSignature",
865
+ "noUncheckedIndexedAccess",
866
+ "noUnusedLocals",
867
+ "noUnusedParameters",
868
+ "useUnknownInCatchVariables",
869
+ /* Completeness */
870
+ "skipDefaultLibCheck",
871
+ "skipLibCheck"
872
+ ],
873
+ pathPattern: "^compilerOptions$"
874
+ }
875
+ ]
876
+ }
1016
877
  }
1017
878
  ];
1018
-
1019
- // src/configs/vitest.ts
1020
- var vitest = (options = {}) => [
879
+ var sortI18nLocale = () => [
1021
880
  {
1022
- name: "ntnyq/vitest",
1023
- plugins: {
1024
- vitest: import_eslint_plugin2.default
1025
- },
1026
- files: [GLOB_TEST],
881
+ name: "ntnyq/sort/i18n-locale",
882
+ files: ["**/{locales,i18n}/*.json", "**/{locales,i18n}/*.y?(a)ml"],
1027
883
  rules: {
1028
- ...import_eslint_plugin2.default.configs.recommended.rules,
1029
- // Overrides built-in rules
1030
- ...options.overrides
884
+ "jsonc/sort-keys": [
885
+ "error",
886
+ {
887
+ pathPattern: ".*",
888
+ order: { type: "asc" }
889
+ }
890
+ ]
1031
891
  }
1032
892
  }
1033
893
  ];
1034
894
 
1035
- // src/configs/vue.ts
1036
- var vue2Rules = {
1037
- ...import_eslint_plugin_vue.default.configs.base.rules,
1038
- ...import_eslint_plugin_vue.default.configs.essential.rules,
1039
- ...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
1040
- ...import_eslint_plugin_vue.default.configs.recommended.rules
1041
- };
1042
- var vue3Rules = {
1043
- ...import_eslint_plugin_vue.default.configs.base.rules,
1044
- ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
1045
- ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
1046
- ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
1047
- };
1048
- var vue = (options = {}) => {
1049
- const isVue3 = options.vueVersion !== 2;
1050
- return [
1051
- ...import_typescript_eslint.default.config({
1052
- name: "ntnyq/vue/ts",
1053
- files: [GLOB_VUE],
1054
- extends: typescriptCore()
1055
- }),
1056
- {
1057
- name: "ntnyq/vue/core",
1058
- files: [GLOB_VUE],
1059
- plugins: {
1060
- vue: import_eslint_plugin_vue.default,
1061
- "@typescript-eslint": import_typescript_eslint.default.plugin
1062
- },
1063
- languageOptions: {
1064
- parser: parserVue,
1065
- parserOptions: {
1066
- parser: "@typescript-eslint/parser",
1067
- sourceType: "module",
1068
- extraFileExtensions: [".vue"],
1069
- ecmaFeatures: {
1070
- jsx: true
1071
- }
895
+ // src/configs/toml.ts
896
+ var toml = (options = {}) => [
897
+ {
898
+ name: "ntnyq/toml",
899
+ files: [GLOB_TOML],
900
+ languageOptions: {
901
+ parser: parserToml
902
+ },
903
+ plugins: {
904
+ toml: import_eslint_plugin_toml.default
905
+ },
906
+ rules: {
907
+ "toml/comma-style": "error",
908
+ "toml/keys-order": "error",
909
+ "toml/no-space-dots": "error",
910
+ "toml/no-unreadable-number-separator": "error",
911
+ "toml/precision-of-fractional-seconds": "error",
912
+ "toml/precision-of-integer": "error",
913
+ "toml/tables-order": "error",
914
+ "toml/indent": ["error", 2],
915
+ "toml/vue-custom-block/no-parsing-error": "error",
916
+ "toml/array-bracket-newline": "error",
917
+ "toml/array-bracket-spacing": ["error", "never"],
918
+ "toml/array-element-newline": ["error", "never"],
919
+ "toml/inline-table-curly-spacing": "error",
920
+ "toml/key-spacing": "error",
921
+ "toml/padding-line-between-pairs": "error",
922
+ "toml/padding-line-between-tables": "error",
923
+ "toml/quoted-keys": "error",
924
+ "toml/spaced-comment": "error",
925
+ "toml/table-bracket-spacing": "error",
926
+ // Overrides built-in rules
927
+ ...options.overrides
928
+ }
929
+ }
930
+ ];
931
+
932
+ // src/configs/antfu.ts
933
+ var antfu = (options = {}) => [
934
+ {
935
+ name: "ntnyq/antfu",
936
+ plugins: {
937
+ antfu: import_eslint_plugin_antfu.default
938
+ },
939
+ rules: {
940
+ // required `object-curly-newline` to be disabled
941
+ // 'antfu/consistent-list-newline': 'error',
942
+ "antfu/import-dedupe": "error",
943
+ "antfu/top-level-function": "error",
944
+ ...options.overrides
945
+ }
946
+ }
947
+ ];
948
+
949
+ // src/configs/jsdoc.ts
950
+ var jsdoc = (options = {}) => [
951
+ {
952
+ name: "ntnyq/jsdoc",
953
+ plugins: {
954
+ jsdoc: import_eslint_plugin_jsdoc.default
955
+ },
956
+ rules: {
957
+ "jsdoc/check-access": "warn",
958
+ "jsdoc/check-param-names": "warn",
959
+ "jsdoc/check-property-names": "warn",
960
+ "jsdoc/check-types": "warn",
961
+ "jsdoc/empty-tags": "warn",
962
+ "jsdoc/implements-on-classes": "warn",
963
+ "jsdoc/no-defaults": "warn",
964
+ "jsdoc/no-multi-asterisks": "warn",
965
+ "jsdoc/require-param-name": "warn",
966
+ "jsdoc/require-property": "warn",
967
+ "jsdoc/require-property-description": "warn",
968
+ "jsdoc/require-property-name": "warn",
969
+ "jsdoc/require-returns-check": "warn",
970
+ "jsdoc/require-returns-description": "warn",
971
+ "jsdoc/require-yields-check": "warn",
972
+ "jsdoc/check-alignment": "warn",
973
+ "jsdoc/multiline-blocks": "warn",
974
+ // Overrides built-in rules
975
+ ...options.overrides
976
+ }
977
+ }
978
+ ];
979
+
980
+ // src/configs/jsonc.ts
981
+ var jsonc = (options = {}) => [
982
+ {
983
+ name: "ntnyq/jsonc",
984
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
985
+ plugins: {
986
+ jsonc: import_eslint_plugin_jsonc.default
987
+ },
988
+ languageOptions: {
989
+ parser: parserJsonc
990
+ },
991
+ rules: {
992
+ ...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
993
+ "jsonc/array-bracket-spacing": ["error", "never"],
994
+ "jsonc/comma-dangle": ["error", "never"],
995
+ "jsonc/comma-style": ["error", "last"],
996
+ "jsonc/indent": ["error", 2],
997
+ "jsonc/key-spacing": [
998
+ "error",
999
+ {
1000
+ beforeColon: false,
1001
+ afterColon: true
1072
1002
  }
1073
- },
1074
- processor: import_eslint_plugin_vue.default.processors[".vue"],
1075
- rules: {
1076
- ...isVue3 ? vue3Rules : vue2Rules,
1077
- // OFF
1078
- "vue/no-v-html": "off",
1079
- "vue/require-prop-types": "off",
1080
- "vue/require-default-prop": "off",
1081
- "vue/multi-word-component-names": "off",
1082
- "vue/no-v-text-v-html-on-component": "off",
1083
- "vue/no-setup-props-reactivity-loss": "off",
1084
- "vue/html-self-closing": [
1085
- "error",
1086
- {
1087
- html: {
1088
- void: "always",
1089
- normal: "always",
1090
- component: "always"
1091
- },
1092
- svg: "always",
1093
- math: "always"
1094
- }
1095
- ],
1096
- "vue/block-tag-newline": [
1097
- "error",
1098
- {
1099
- singleline: "always",
1100
- multiline: "always"
1101
- }
1102
- ],
1103
- "vue/component-name-in-template-casing": [
1104
- "error",
1105
- "PascalCase",
1106
- {
1107
- // Force auto-import components to be PascalCase
1108
- registeredComponentsOnly: false,
1109
- ignores: ["slot", "component"]
1110
- }
1111
- ],
1112
- "vue/component-options-name-casing": ["error", "PascalCase"],
1113
- "vue/custom-event-name-casing": ["error", "camelCase"],
1114
- "vue/define-macros-order": [
1115
- "error",
1116
- {
1117
- order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
1118
- }
1119
- ],
1120
- "vue/html-comment-content-spacing": [
1121
- "error",
1122
- "always",
1123
- {
1124
- exceptions: ["-"]
1125
- }
1126
- ],
1127
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
1128
- "vue/no-useless-v-bind": "error",
1129
- "vue/padding-line-between-blocks": "error",
1130
- "vue/next-tick-style": ["error", "promise"],
1131
- "vue/array-bracket-spacing": ["error", "never"],
1132
- "vue/prefer-separate-static-class": "error",
1133
- "vue/no-constant-condition": "error",
1134
- "vue/prefer-true-attribute-shorthand": ["error", "always"],
1135
- "vue/prefer-define-options": "error",
1136
- "vue/valid-define-options": "error",
1137
- // TypeScript enhancements
1138
- "vue/define-emits-declaration": ["error", "type-literal"],
1139
- "vue/no-unused-emit-declarations": "error",
1140
- "vue/this-in-template": ["error", "never"],
1141
- "vue/arrow-spacing": ["error", { before: true, after: true }],
1142
- "vue/block-spacing": ["error", "always"],
1143
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
1144
- "vue/comma-dangle": ["error", "always-multiline"],
1145
- "vue/comma-spacing": ["error", { before: false, after: true }],
1146
- "vue/comma-style": ["error", "last"],
1147
- "vue/dot-location": ["error", "property"],
1148
- "vue/dot-notation": ["error", { allowKeywords: true }],
1149
- "vue/eqeqeq": ["error", "smart"],
1150
- "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
1151
- "vue/keyword-spacing": ["error", { before: true, after: true }],
1152
- "vue/no-empty-pattern": "error",
1153
- "vue/no-loss-of-precision": "error",
1154
- "vue/no-irregular-whitespace": "error",
1155
- "vue/no-use-v-else-with-v-for": "error",
1156
- "vue/require-typed-object-prop": "error",
1157
- "vue/no-extra-parens": ["error", "functions"],
1158
- "vue/no-restricted-syntax": [
1159
- "error",
1160
- "DebuggerStatement",
1161
- "LabeledStatement",
1162
- "WithStatement"
1163
- ],
1164
- "vue/no-sparse-arrays": "error",
1165
- "vue/no-deprecated-model-definition": [
1166
- "error",
1167
- {
1168
- allowVue3Compat: true
1169
- }
1170
- ],
1171
- "vue/object-curly-newline": [
1172
- "error",
1173
- {
1174
- multiline: true,
1175
- consistent: true
1176
- }
1177
- ],
1178
- "vue/no-static-inline-styles": [
1179
- "error",
1180
- {
1181
- allowBinding: true
1182
- }
1183
- ],
1184
- "vue/object-curly-spacing": ["error", "always"],
1185
- "vue/object-property-newline": [
1186
- "error",
1187
- {
1188
- allowMultiplePropertiesPerLine: true
1189
- }
1190
- ],
1191
- "vue/object-shorthand": [
1192
- "error",
1193
- "always",
1194
- {
1195
- ignoreConstructors: false,
1196
- avoidQuotes: true
1197
- }
1198
- ],
1199
- "vue/operator-linebreak": ["error", "before"],
1200
- "vue/prefer-template": "error",
1201
- "vue/prop-name-casing": ["error", "camelCase"],
1202
- "vue/quote-props": ["error", "consistent-as-needed"],
1203
- "vue/space-in-parens": ["error", "never"],
1204
- "vue/space-infix-ops": "error",
1205
- "vue/space-unary-ops": [
1206
- "error",
1207
- {
1208
- words: true,
1209
- nonwords: false
1210
- }
1211
- ],
1212
- "vue/template-curly-spacing": "error",
1213
- "vue/block-order": [
1214
- "error",
1215
- {
1216
- order: ["script", "template", "style"]
1217
- }
1218
- ],
1219
- "vue/attributes-order": [
1220
- "error",
1221
- {
1222
- order: [
1223
- "EVENTS",
1224
- // `@click="functionCall"`, `v-on="event"`
1225
- "TWO_WAY_BINDING",
1226
- // `v-model`
1227
- "OTHER_DIRECTIVES",
1228
- // `v-custom-directive`
1229
- "LIST_RENDERING",
1230
- // `v-for item in items`
1231
- "CONDITIONALS",
1232
- // `v-if`, `v-show`, `v-cloak`
1233
- "CONTENT",
1234
- // `v-text`, `v-html`
1235
- "SLOT",
1236
- // `v-slot`, `slot`
1237
- "UNIQUE",
1238
- // `ref`, `key`
1239
- "DEFINITION",
1240
- // `is`, `v-is`
1241
- "ATTR_DYNAMIC",
1242
- // `v-bind:prop="foo"`, `:prop="foo"`
1243
- // `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
1244
- "RENDER_MODIFIERS",
1245
- // `v-once`, `v-pre`
1246
- "GLOBAL",
1247
- // `id`
1248
- "ATTR_STATIC",
1249
- // `prop="foo", `static attributes
1250
- "ATTR_SHORTHAND_BOOL"
1251
- // `disabled`, prop shorthand
1252
- ],
1253
- alphabetical: false
1254
- }
1255
- ],
1256
- "vue/order-in-components": [
1257
- "error",
1258
- {
1259
- order: [
1260
- "el",
1261
- "name",
1262
- "key",
1263
- "parent",
1264
- "functional",
1265
- ["provide", "inject"],
1266
- ["delimiters", "comments"],
1267
- ["components", "directives", "filters"],
1268
- "extends",
1269
- "mixins",
1270
- "layout",
1271
- "middleware",
1272
- "validate",
1273
- "scrollToTop",
1274
- "transition",
1275
- "loading",
1276
- "inheritAttrs",
1277
- "model",
1278
- ["props", "propsData"],
1279
- "emits",
1280
- "setup",
1281
- "asyncData",
1282
- "computed",
1283
- "data",
1284
- "fetch",
1285
- "head",
1286
- "methods",
1287
- ["template", "render"],
1288
- "watch",
1289
- "watchQuery",
1290
- "LIFECYCLE_HOOKS",
1291
- "renderError",
1292
- "ROUTER_GUARDS"
1293
- ]
1294
- }
1295
- ],
1296
- "vue/max-attributes-per-line": [
1297
- "error",
1298
- {
1299
- singleline: 1,
1300
- multiline: 1
1301
- }
1302
- ],
1303
- // Overrides built-in rules
1304
- ...options.overrides
1003
+ ],
1004
+ "jsonc/no-octal-escape": "error",
1005
+ "jsonc/object-curly-newline": [
1006
+ "error",
1007
+ {
1008
+ multiline: true,
1009
+ consistent: true
1010
+ }
1011
+ ],
1012
+ "jsonc/object-curly-spacing": ["error", "always"],
1013
+ "jsonc/object-property-newline": [
1014
+ "error",
1015
+ {
1016
+ allowMultiplePropertiesPerLine: true
1017
+ }
1018
+ ],
1019
+ // Overrides built-in rules
1020
+ ...options.overrides
1021
+ }
1022
+ }
1023
+ ];
1024
+
1025
+ // src/configs/regexp.ts
1026
+ var regexp = (options = {}) => [
1027
+ /**
1028
+ * https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/rules/recommended.ts
1029
+ */
1030
+ {
1031
+ name: "ntnyq/regexp",
1032
+ ...pluginRegexp.configs["flat/recommended"],
1033
+ // Overrides built-in rules
1034
+ ...options.overrides
1035
+ }
1036
+ ];
1037
+
1038
+ // src/configs/unocss.ts
1039
+ var unocss = (options = {}) => [
1040
+ {
1041
+ name: "ntnyq/unocss",
1042
+ plugins: {
1043
+ unocss: import_eslint_plugin.default
1044
+ },
1045
+ rules: {
1046
+ "unocss/order": "error",
1047
+ // We don't use this
1048
+ "unocss/order-attributify": "off",
1049
+ // Overrides built-in rules
1050
+ ...options.overrides
1051
+ }
1052
+ }
1053
+ ];
1054
+
1055
+ // src/configs/vitest.ts
1056
+ var vitest = (options = {}) => [
1057
+ {
1058
+ name: "ntnyq/vitest",
1059
+ plugins: {
1060
+ vitest: import_eslint_plugin2.default
1061
+ },
1062
+ files: [GLOB_TEST],
1063
+ rules: {
1064
+ ...import_eslint_plugin2.default.configs.recommended.rules,
1065
+ // Overrides built-in rules
1066
+ ...options.overrides
1067
+ }
1068
+ }
1069
+ ];
1070
+
1071
+ // src/configs/command.ts
1072
+ var import_config = __toESM(require("eslint-plugin-command/config"), 1);
1073
+ var command = (options = {}) => [
1074
+ {
1075
+ ...(0, import_config.default)(options),
1076
+ name: "ntnyq/command"
1077
+ }
1078
+ ];
1079
+
1080
+ // src/configs/ignores.ts
1081
+ var ignores = (customIgnores = []) => [
1082
+ {
1083
+ name: "ntnyq/ignores",
1084
+ ignores: [
1085
+ ...GLOB_EXCLUDE,
1086
+ // Overrides built-in ignores
1087
+ ...customIgnores
1088
+ ]
1089
+ }
1090
+ ];
1091
+
1092
+ // src/configs/imports.ts
1093
+ var imports = (options = {}) => [
1094
+ {
1095
+ name: "ntnyq/imports",
1096
+ plugins: {
1097
+ import: import_eslint_plugin_import_x.default
1098
+ },
1099
+ settings: {
1100
+ "import/resolver": {
1101
+ node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
1305
1102
  }
1103
+ },
1104
+ rules: {
1105
+ "import/no-unresolved": "off",
1106
+ "import/no-absolute-path": "off",
1107
+ "import/no-named-as-default-member": "off",
1108
+ // 'import/no-named-default': 'error',
1109
+ "import/first": "error",
1110
+ "import/export": "error",
1111
+ "import/no-self-import": "error",
1112
+ "import/no-duplicates": "error",
1113
+ "import/no-mutable-exports": "error",
1114
+ "import/newline-after-import": "error",
1115
+ // Overrides built-in rules
1116
+ ...options.overrides
1117
+ }
1118
+ }
1119
+ ];
1120
+
1121
+ // src/configs/unicorn.ts
1122
+ var unicorn = (options = {}) => [
1123
+ {
1124
+ name: "ntnyq/unicorn",
1125
+ plugins: {
1126
+ unicorn: import_eslint_plugin_unicorn.default
1127
+ },
1128
+ rules: {
1129
+ // Disabled for now
1130
+ "unicorn/better-regex": "off",
1131
+ "unicorn/prefer-top-level-await": "off",
1132
+ "unicorn/explicit-length-check": "off",
1133
+ "unicorn/no-array-callback-reference": "off",
1134
+ "unicorn/error-message": "error",
1135
+ "unicorn/escape-case": "error",
1136
+ "unicorn/no-new-buffer": "error",
1137
+ "unicorn/number-literal-case": "error",
1138
+ "unicorn/prefer-includes": "error",
1139
+ "unicorn/prefer-type-error": "error",
1140
+ "unicorn/throw-new-error": "error",
1141
+ "unicorn/no-unnecessary-await": "error",
1142
+ "unicorn/switch-case-braces": ["error", "avoid"],
1143
+ "unicorn/no-typeof-undefined": "error",
1144
+ "unicorn/prefer-set-size": "error",
1145
+ "unicorn/prefer-regexp-test": "error",
1146
+ "unicorn/no-static-only-class": "error",
1147
+ "unicorn/no-zero-fractions": "error",
1148
+ "unicorn/custom-error-definition": "error",
1149
+ "unicorn/prefer-modern-math-apis": "error",
1150
+ "unicorn/new-for-builtins": "error",
1151
+ "unicorn/no-console-spaces": "error",
1152
+ "unicorn/no-for-loop": "error",
1153
+ "unicorn/no-hex-escape": "error",
1154
+ "unicorn/no-lonely-if": "error",
1155
+ "unicorn/prefer-keyboard-event-key": "error",
1156
+ "unicorn/prefer-math-trunc": "error",
1157
+ "unicorn/prefer-negative-index": "error",
1158
+ "unicorn/prefer-node-protocol": "error",
1159
+ "unicorn/prefer-number-properties": "error",
1160
+ "unicorn/prefer-optional-catch-binding": "error",
1161
+ "unicorn/prefer-prototype-methods": "error",
1162
+ "unicorn/prefer-reflect-apply": "error",
1163
+ "unicorn/catch-error-name": [
1164
+ "error",
1165
+ {
1166
+ name: "err",
1167
+ ignore: ["^_."]
1168
+ }
1169
+ ],
1170
+ "unicorn/prefer-date-now": "error",
1171
+ // String
1172
+ "unicorn/prefer-string-slice": "error",
1173
+ "unicorn/prefer-string-trim-start-end": "error",
1174
+ "unicorn/prefer-string-starts-ends-with": "error",
1175
+ // DOM
1176
+ "unicorn/prefer-add-event-listener": "error",
1177
+ "unicorn/no-invalid-remove-event-listener": "error",
1178
+ "unicorn/prefer-query-selector": "error",
1179
+ "unicorn/prefer-modern-dom-apis": "error",
1180
+ "unicorn/prefer-dom-node-append": "error",
1181
+ "unicorn/prefer-dom-node-dataset": "error",
1182
+ "unicorn/prefer-dom-node-remove": "error",
1183
+ "unicorn/prefer-dom-node-text-content": "error",
1184
+ // Array
1185
+ "unicorn/no-new-array": "error",
1186
+ "unicorn/no-instanceof-array": "error",
1187
+ "unicorn/no-array-push-push": "error",
1188
+ "unicorn/no-array-method-this-argument": "error",
1189
+ "unicorn/prefer-array-find": "error",
1190
+ "unicorn/prefer-array-some": "error",
1191
+ "unicorn/prefer-array-flat-map": "error",
1192
+ "unicorn/prefer-array-index-of": "error",
1193
+ // Overrides built-in rules
1194
+ ...options.overrides
1306
1195
  }
1307
- ];
1308
- };
1196
+ }
1197
+ ];
1309
1198
 
1310
- // src/configs/yml.ts
1311
- var yml = (options = {}) => [
1199
+ // src/configs/comments.ts
1200
+ var comments = (options = {}) => [
1312
1201
  {
1313
- name: "ntnyq/yaml",
1314
- files: [GLOB_YAML],
1315
- languageOptions: {
1316
- parser: parserYaml
1317
- },
1202
+ name: "ntnyq/eslint-comments",
1318
1203
  plugins: {
1319
- yml: import_eslint_plugin_yml.default
1204
+ "@eslint-community/eslint-comments": import_eslint_plugin_eslint_comments.default
1320
1205
  },
1321
1206
  rules: {
1322
- ...import_eslint_plugin_yml.default.configs.standard.rules,
1323
- ...import_eslint_plugin_yml.default.configs.prettier.rules,
1324
- "yml/no-empty-mapping-value": "off",
1325
- "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
1207
+ ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
1208
+ "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
1326
1209
  // Overrides built-in rules
1327
1210
  ...options.overrides
1328
1211
  }
1329
1212
  }
1330
1213
  ];
1331
1214
 
1332
- // src/configs/toml.ts
1333
- var toml = (options = {}) => [
1215
+ // src/configs/markdown.ts
1216
+ var markdown = (options = {}) => {
1217
+ if (!Array.isArray(import_markdown.default.configs?.processor)) return [];
1218
+ return [
1219
+ ...import_markdown.default.configs.processor.map((config) => ({
1220
+ ...config,
1221
+ name: `ntnyq/${config.name}`
1222
+ })),
1223
+ {
1224
+ name: "ntnyq/markdown/disabled/code-blocks",
1225
+ files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1226
+ rules: {
1227
+ "no-undef": "off",
1228
+ "no-alert": "off",
1229
+ "no-console": "off",
1230
+ "no-unused-vars": "off",
1231
+ "no-unused-expressions": "off",
1232
+ "no-restricted-imports": "off",
1233
+ "node/prefer-global/buffer": "off",
1234
+ "node/prefer-global/process": "off",
1235
+ "import/no-unresolved": "off",
1236
+ "unused-imports/no-unused-imports": "off",
1237
+ "unused-imports/no-unused-vars": "off",
1238
+ "@typescript-eslint/comma-dangle": "off",
1239
+ "@typescript-eslint/no-redeclare": "off",
1240
+ "@typescript-eslint/no-namespace": "off",
1241
+ "@typescript-eslint/no-unused-vars": "off",
1242
+ "@typescript-eslint/no-require-imports": "off",
1243
+ "@typescript-eslint/no-extraneous-class": "off",
1244
+ "@typescript-eslint/no-use-before-define": "off",
1245
+ "@typescript-eslint/no-unused-expressions": "off",
1246
+ "@typescript-eslint/consistent-type-imports": "off",
1247
+ // Overrides built-in rules
1248
+ ...options.overrides
1249
+ }
1250
+ }
1251
+ ];
1252
+ };
1253
+
1254
+ // src/configs/prettier.ts
1255
+ var prettier = (options = {}) => [
1334
1256
  {
1335
- name: "ntnyq/toml",
1336
- files: [GLOB_TOML],
1337
- languageOptions: {
1338
- parser: parserToml
1339
- },
1257
+ name: "ntnyq/prettier",
1340
1258
  plugins: {
1341
- toml: import_eslint_plugin_toml.default
1259
+ prettier: import_eslint_plugin_prettier.default
1342
1260
  },
1343
1261
  rules: {
1344
- "toml/comma-style": "error",
1345
- "toml/keys-order": "error",
1346
- "toml/no-space-dots": "error",
1347
- "toml/no-unreadable-number-separator": "error",
1348
- "toml/precision-of-fractional-seconds": "error",
1349
- "toml/precision-of-integer": "error",
1350
- "toml/tables-order": "error",
1351
- "toml/indent": ["error", 2],
1352
- "toml/vue-custom-block/no-parsing-error": "error",
1353
- "toml/array-bracket-newline": "error",
1354
- "toml/array-bracket-spacing": ["error", "never"],
1355
- "toml/array-element-newline": ["error", "never"],
1356
- "toml/inline-table-curly-spacing": "error",
1357
- "toml/key-spacing": "error",
1358
- "toml/padding-line-between-pairs": "error",
1359
- "toml/padding-line-between-tables": "error",
1360
- "toml/quoted-keys": "error",
1361
- "toml/spaced-comment": "error",
1362
- "toml/table-bracket-spacing": "error",
1262
+ "vue/array-bracket-newline": "off",
1263
+ "vue/array-bracket-spacing": "off",
1264
+ "vue/array-element-newline": "off",
1265
+ "vue/arrow-spacing": "off",
1266
+ "vue/block-spacing": "off",
1267
+ "vue/block-tag-newline": "off",
1268
+ "vue/brace-style": "off",
1269
+ "vue/comma-dangle": "off",
1270
+ "vue/comma-spacing": "off",
1271
+ "vue/comma-style": "off",
1272
+ "vue/dot-location": "off",
1273
+ "vue/func-call-spacing": "off",
1274
+ "vue/html-closing-bracket-newline": "off",
1275
+ "vue/html-closing-bracket-spacing": "off",
1276
+ "vue/html-end-tags": "off",
1277
+ "vue/html-indent": "off",
1278
+ "vue/html-quotes": "off",
1279
+ "vue/key-spacing": "off",
1280
+ "vue/keyword-spacing": "off",
1281
+ "vue/max-attributes-per-line": "off",
1282
+ "vue/multiline-html-element-content-newline": "off",
1283
+ "vue/multiline-ternary": "off",
1284
+ "vue/mustache-interpolation-spacing": "off",
1285
+ "vue/no-extra-parens": "off",
1286
+ "vue/no-multi-spaces": "off",
1287
+ "vue/no-spaces-around-equal-signs-in-attribute": "off",
1288
+ "vue/object-curly-newline": "off",
1289
+ "vue/object-curly-spacing": "off",
1290
+ "vue/object-property-newline": "off",
1291
+ "vue/operator-linebreak": "off",
1292
+ "vue/quote-props": "off",
1293
+ "vue/script-indent": "off",
1294
+ "vue/singleline-html-element-content-newline": "off",
1295
+ "vue/space-in-parens": "off",
1296
+ "vue/space-infix-ops": "off",
1297
+ "vue/space-unary-ops": "off",
1298
+ "vue/template-curly-spacing": "off",
1299
+ ...import_eslint_plugin_prettier.default.configs.recommended.rules,
1300
+ "prettier/prettier": options.level || "warn",
1363
1301
  // Overrides built-in rules
1364
1302
  ...options.overrides
1365
1303
  }
1366
- }
1367
- ];
1368
-
1369
- // src/configs/sort.ts
1370
- var sortPackageJson = () => [
1371
- {
1372
- name: "ntnyq/sort/package-json",
1373
- files: ["**/package.json"],
1374
- rules: {
1375
- "jsonc/sort-keys": [
1376
- "error",
1377
- {
1378
- pathPattern: "^$",
1379
- order: [
1380
- "publisher",
1381
- "name",
1382
- "displayName",
1383
- "preview",
1384
- "type",
1385
- "version",
1386
- "private",
1387
- "packageManager",
1388
- "description",
1389
- "keywords",
1390
- "license",
1391
- "author",
1392
- "homepage",
1393
- "repository",
1394
- "funding",
1395
- "exports",
1396
- "main",
1397
- "module",
1398
- "unpkg",
1399
- "jsdelivr",
1400
- // workaround for `type: "module"` with TS `moduleResolution: "node16"`
1401
- "types",
1402
- "typesVersions",
1403
- "bin",
1404
- "icon",
1405
- "files",
1406
- "sideEffects",
1407
- "scripts",
1408
- "peerDependencies",
1409
- "peerDependenciesMeta",
1410
- "dependencies",
1411
- "optionalDependencies",
1412
- "devDependencies",
1413
- "activationEvents",
1414
- "contributes",
1415
- "categories",
1416
- "engines",
1417
- "pnpm",
1418
- "overrides",
1419
- "resolutions",
1420
- "husky",
1421
- "prettier",
1422
- "nano-staged",
1423
- "lint-staged",
1424
- "eslintConfig"
1425
- ]
1426
- },
1427
- {
1428
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
1429
- order: { type: "asc" }
1430
- },
1431
- {
1432
- order: { type: "asc" },
1433
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1434
- },
1435
- {
1436
- pathPattern: "^exports.*$",
1437
- order: ["types", "import", "require", "default"]
1438
- },
1439
- {
1440
- pathPattern: "^scripts$",
1441
- order: { type: "asc" }
1442
- },
1443
- {
1444
- order: [
1445
- // client hooks only
1446
- "pre-commit",
1447
- "prepare-commit-msg",
1448
- "commit-msg",
1449
- "post-commit",
1450
- "pre-rebase",
1451
- "post-rewrite",
1452
- "post-checkout",
1453
- "post-merge",
1454
- "pre-push",
1455
- "pre-auto-gc"
1456
- ],
1457
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1458
- }
1459
- ],
1460
- "jsonc/sort-array-values": [
1461
- "error",
1462
- {
1463
- pathPattern: "^files$",
1464
- order: { type: "asc" }
1465
- }
1466
- ]
1304
+ },
1305
+ /**
1306
+ * Languages that prettier currently does not support
1307
+ */
1308
+ {
1309
+ name: "ntnyq/prettier/disabled",
1310
+ files: [GLOB_TOML],
1311
+ plugins: {
1312
+ prettier: import_eslint_plugin_prettier.default
1313
+ },
1314
+ rules: {
1315
+ "prettier/prettier": "off"
1467
1316
  }
1468
1317
  }
1469
1318
  ];
1470
- var sortTsConfig = () => [
1319
+
1320
+ // src/configs/gitignore.ts
1321
+ var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
1322
+ var gitignore = (options = {}) => [
1471
1323
  {
1472
- name: "ntnyq/sort/tsconfig",
1473
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1474
- rules: {
1475
- "jsonc/sort-keys": [
1476
- "error",
1477
- {
1478
- order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
1479
- pathPattern: "^$"
1324
+ ...(0, import_eslint_config_flat_gitignore.default)(options),
1325
+ name: "ntnyq/gitignore"
1326
+ }
1327
+ ];
1328
+
1329
+ // src/configs/javascript.ts
1330
+ var import_js = __toESM(require("@eslint/js"), 1);
1331
+ var import_globals = __toESM(require("globals"), 1);
1332
+ var javascript = (options = {}) => {
1333
+ const strictRules = {
1334
+ complexity: ["error", { max: 30 }],
1335
+ "max-params": ["error", { max: 5 }],
1336
+ "max-depth": ["error", { max: 5 }],
1337
+ "max-nested-callbacks": ["error", { max: 10 }],
1338
+ "max-lines": [
1339
+ "error",
1340
+ {
1341
+ max: 1e3,
1342
+ skipComments: true,
1343
+ skipBlankLines: true
1344
+ }
1345
+ ],
1346
+ "max-lines-per-function": [
1347
+ "error",
1348
+ {
1349
+ max: 200,
1350
+ skipComments: true,
1351
+ skipBlankLines: true
1352
+ }
1353
+ ]
1354
+ };
1355
+ return [
1356
+ {
1357
+ ...import_js.default.configs.recommended,
1358
+ name: "ntnyq/js/recommended"
1359
+ },
1360
+ {
1361
+ name: "ntnyq/js/core",
1362
+ languageOptions: {
1363
+ globals: {
1364
+ ...import_globals.default.browser,
1365
+ ...import_globals.default.es2021,
1366
+ ...import_globals.default.node
1480
1367
  },
1481
- {
1482
- order: [
1483
- /* Projects */
1484
- "incremental",
1485
- "composite",
1486
- "tsBuildInfoFile",
1487
- "disableSourceOfProjectReferenceRedirect",
1488
- "disableSolutionSearching",
1489
- "disableReferencedProjectLoad",
1490
- /* Language and Environment */
1491
- "target",
1492
- "lib",
1493
- "jsx",
1494
- "experimentalDecorators",
1495
- "emitDecoratorMetadata",
1496
- "jsxFactory",
1497
- "jsxFragmentFactory",
1498
- "jsxImportSource",
1499
- "reactNamespace",
1500
- "noLib",
1501
- "useDefineForClassFields",
1502
- "moduleDetection",
1503
- /* Modules */
1504
- "module",
1505
- "rootDir",
1506
- "moduleResolution",
1507
- "baseUrl",
1508
- "paths",
1509
- "rootDirs",
1510
- "typeRoots",
1511
- "types",
1512
- "allowUmdGlobalAccess",
1513
- "moduleSuffixes",
1514
- "allowImportingTsExtensions",
1515
- "resolvePackageJsonExports",
1516
- "resolvePackageJsonImports",
1517
- "customConditions",
1518
- "resolveJsonModule",
1519
- "allowArbitraryExtensions",
1520
- "noResolve",
1521
- /* JavaScript Support */
1522
- "allowJs",
1523
- "checkJs",
1524
- "maxNodeModuleJsDepth",
1525
- /* Emit */
1526
- "declaration",
1527
- "declarationMap",
1528
- "emitDeclarationOnly",
1529
- "sourceMap",
1530
- "inlineSourceMap",
1531
- "outFile",
1532
- "outDir",
1533
- "removeComments",
1534
- "noEmit",
1535
- "importHelpers",
1536
- "importsNotUsedAsValues",
1537
- "downlevelIteration",
1538
- "sourceRoot",
1539
- "mapRoot",
1540
- "inlineSources",
1541
- "emitBOM",
1542
- "newLine",
1543
- "stripInternal",
1544
- "noEmitHelpers",
1545
- "noEmitOnError",
1546
- "preserveConstEnums",
1547
- "declarationDir",
1548
- "preserveValueImports",
1549
- /* Interop Constraints */
1550
- "isolatedModules",
1551
- "verbatimModuleSyntax",
1552
- "allowSyntheticDefaultImports",
1553
- "esModuleInterop",
1554
- "preserveSymlinks",
1555
- "forceConsistentCasingInFileNames",
1556
- /* Type Checking */
1557
- "strict",
1558
- "strictBindCallApply",
1559
- "strictFunctionTypes",
1560
- "strictNullChecks",
1561
- "strictPropertyInitialization",
1562
- "allowUnreachableCode",
1563
- "allowUnusedLabels",
1564
- "alwaysStrict",
1565
- "exactOptionalPropertyTypes",
1566
- "noFallthroughCasesInSwitch",
1567
- "noImplicitAny",
1568
- "noImplicitOverride",
1569
- "noImplicitReturns",
1570
- "noImplicitThis",
1571
- "noPropertyAccessFromIndexSignature",
1572
- "noUncheckedIndexedAccess",
1573
- "noUnusedLocals",
1574
- "noUnusedParameters",
1575
- "useUnknownInCatchVariables",
1576
- /* Completeness */
1577
- "skipDefaultLibCheck",
1578
- "skipLibCheck"
1579
- ],
1580
- pathPattern: "^compilerOptions$"
1581
- }
1582
- ]
1368
+ sourceType: "module"
1369
+ },
1370
+ rules: {
1371
+ // standard v17.0.0
1372
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
1373
+ camelcase: [
1374
+ "error",
1375
+ {
1376
+ allow: ["^UNSAFE_"],
1377
+ properties: "never",
1378
+ ignoreGlobals: true
1379
+ }
1380
+ ],
1381
+ "constructor-super": "error",
1382
+ curly: ["error", "multi-line"],
1383
+ "default-case-last": "error",
1384
+ "dot-notation": ["error", { allowKeywords: true }],
1385
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
1386
+ "no-array-constructor": "error",
1387
+ "no-async-promise-executor": "error",
1388
+ "no-caller": "error",
1389
+ "no-class-assign": "error",
1390
+ "no-compare-neg-zero": "error",
1391
+ "no-cond-assign": "error",
1392
+ "no-const-assign": "error",
1393
+ "no-constant-condition": ["error", { checkLoops: false }],
1394
+ "no-control-regex": "error",
1395
+ "no-debugger": "error",
1396
+ "no-delete-var": "error",
1397
+ "no-dupe-args": "error",
1398
+ "no-dupe-class-members": "error",
1399
+ "no-dupe-keys": "error",
1400
+ "no-duplicate-case": "error",
1401
+ "no-useless-backreference": "error",
1402
+ "no-empty": ["error", { allowEmptyCatch: true }],
1403
+ "no-empty-character-class": "error",
1404
+ "no-empty-pattern": "error",
1405
+ "no-eval": "error",
1406
+ "no-ex-assign": "error",
1407
+ "no-extend-native": "error",
1408
+ "no-extra-bind": "error",
1409
+ "no-extra-boolean-cast": "error",
1410
+ "no-fallthrough": "error",
1411
+ "no-func-assign": "error",
1412
+ "no-global-assign": "error",
1413
+ "no-implied-eval": "error",
1414
+ "no-import-assign": "error",
1415
+ "no-invalid-regexp": "error",
1416
+ "no-irregular-whitespace": "error",
1417
+ "no-iterator": "error",
1418
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
1419
+ "no-lone-blocks": "error",
1420
+ "no-loss-of-precision": "error",
1421
+ "no-misleading-character-class": "error",
1422
+ "no-prototype-builtins": "error",
1423
+ "no-useless-catch": "error",
1424
+ "no-new": "error",
1425
+ "no-new-func": "error",
1426
+ "no-new-wrappers": "error",
1427
+ "no-obj-calls": "error",
1428
+ "no-octal": "error",
1429
+ "no-octal-escape": "error",
1430
+ "no-proto": "error",
1431
+ "no-redeclare": ["error", { builtinGlobals: false }],
1432
+ "no-regex-spaces": "error",
1433
+ "no-self-assign": ["error", { props: true }],
1434
+ "no-self-compare": "error",
1435
+ "no-sequences": "error",
1436
+ "no-shadow-restricted-names": "error",
1437
+ "no-sparse-arrays": "error",
1438
+ "no-template-curly-in-string": "error",
1439
+ "no-this-before-super": "error",
1440
+ "no-throw-literal": "error",
1441
+ "no-undef": "error",
1442
+ "no-undef-init": "error",
1443
+ "no-unexpected-multiline": "error",
1444
+ "no-unmodified-loop-condition": "error",
1445
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1446
+ "no-unreachable": "error",
1447
+ "no-unreachable-loop": "error",
1448
+ "no-unsafe-finally": "error",
1449
+ "no-unsafe-negation": "error",
1450
+ "no-unused-expressions": [
1451
+ "error",
1452
+ {
1453
+ allowShortCircuit: true,
1454
+ allowTernary: true,
1455
+ allowTaggedTemplates: true
1456
+ }
1457
+ ],
1458
+ "no-unused-vars": [
1459
+ "error",
1460
+ {
1461
+ args: "none",
1462
+ caughtErrors: "none",
1463
+ ignoreRestSiblings: true,
1464
+ vars: "all"
1465
+ }
1466
+ ],
1467
+ "no-useless-call": "error",
1468
+ "no-useless-computed-key": "error",
1469
+ "no-useless-constructor": "error",
1470
+ "no-useless-rename": "error",
1471
+ "no-useless-return": "error",
1472
+ "prefer-promise-reject-errors": "error",
1473
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
1474
+ "symbol-description": "error",
1475
+ "unicode-bom": ["error", "never"],
1476
+ "use-isnan": [
1477
+ "error",
1478
+ {
1479
+ enforceForSwitchCase: true,
1480
+ enforceForIndexOf: true
1481
+ }
1482
+ ],
1483
+ "valid-typeof": ["error", { requireStringLiterals: true }],
1484
+ yoda: ["error", "never"],
1485
+ // es6+
1486
+ "no-var": "error",
1487
+ "prefer-rest-params": "error",
1488
+ "prefer-spread": "error",
1489
+ "prefer-template": "error",
1490
+ "no-empty-static-block": "error",
1491
+ "no-new-native-nonconstructor": "error",
1492
+ "prefer-const": [
1493
+ "error",
1494
+ {
1495
+ destructuring: "all",
1496
+ ignoreReadBeforeAssign: true
1497
+ }
1498
+ ],
1499
+ "prefer-arrow-callback": [
1500
+ "error",
1501
+ {
1502
+ allowNamedFunctions: false,
1503
+ allowUnboundThis: true
1504
+ }
1505
+ ],
1506
+ "object-shorthand": [
1507
+ "error",
1508
+ "always",
1509
+ {
1510
+ ignoreConstructors: false,
1511
+ avoidQuotes: true
1512
+ }
1513
+ ],
1514
+ // best-practice
1515
+ eqeqeq: ["error", "smart"],
1516
+ "array-callback-return": "error",
1517
+ "block-scoped-var": "error",
1518
+ "consistent-return": "off",
1519
+ "no-alert": "error",
1520
+ "no-case-declarations": "error",
1521
+ "no-multi-str": "error",
1522
+ "no-with": "error",
1523
+ "no-void": "error",
1524
+ "no-useless-escape": "off",
1525
+ "vars-on-top": "error",
1526
+ "require-await": "off",
1527
+ "no-return-assign": "off",
1528
+ "one-var": ["error", "never"],
1529
+ "no-use-before-define": [
1530
+ "error",
1531
+ {
1532
+ functions: false,
1533
+ classes: false,
1534
+ variables: true
1535
+ }
1536
+ ],
1537
+ "sort-imports": [
1538
+ "error",
1539
+ {
1540
+ ignoreCase: false,
1541
+ ignoreDeclarationSort: true,
1542
+ ignoreMemberSort: false,
1543
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
1544
+ allowSeparatedGroups: false
1545
+ }
1546
+ ],
1547
+ // Strict rules
1548
+ ...options.strict ? strictRules : {},
1549
+ // Overrides built-in rules
1550
+ ...options.overrides
1551
+ }
1552
+ },
1553
+ {
1554
+ name: "ntnyq/js/scripts",
1555
+ files: ["**/scripts/*", "**/cli.*"],
1556
+ rules: {
1557
+ "no-console": "off"
1558
+ }
1559
+ },
1560
+ {
1561
+ name: "ntnyq/js/test",
1562
+ files: ["**/*.{test,spec}.js?(x)"],
1563
+ rules: {
1564
+ "no-unused-expressions": "off",
1565
+ "max-lines-per-function": "off"
1566
+ }
1583
1567
  }
1584
- }
1585
- ];
1586
- var sortI18nLocale = () => [
1568
+ ];
1569
+ };
1570
+ var jsx = () => [
1587
1571
  {
1588
- name: "ntnyq/sort/i18n-locale",
1589
- files: ["**/{locales,i18n}/*.json", "**/{locales,i18n}/*.y?(a)ml"],
1590
- rules: {
1591
- "jsonc/sort-keys": [
1592
- "error",
1593
- {
1594
- pathPattern: ".*",
1595
- order: { type: "asc" }
1572
+ name: "ntnyq/jsx",
1573
+ files: ["**/*.jsx"],
1574
+ languageOptions: {
1575
+ parserOptions: {
1576
+ ecmaFeatures: {
1577
+ jsx: true
1596
1578
  }
1597
- ]
1579
+ }
1598
1580
  }
1599
1581
  }
1600
1582
  ];
1601
1583
 
1602
- // src/configs/jsonc.ts
1603
- var jsonc = (options = {}) => [
1584
+ // src/configs/perfectionist.ts
1585
+ var perfectionist = (options = {}) => [
1604
1586
  {
1605
- name: "ntnyq/jsonc",
1606
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1587
+ name: "ntnyq/perfectionist",
1607
1588
  plugins: {
1608
- jsonc: import_eslint_plugin_jsonc.default
1609
- },
1610
- languageOptions: {
1611
- parser: parserJsonc
1589
+ perfectionist: import_eslint_plugin_perfectionist.default
1612
1590
  },
1613
1591
  rules: {
1614
- ...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
1615
- "jsonc/array-bracket-spacing": ["error", "never"],
1616
- "jsonc/comma-dangle": ["error", "never"],
1617
- "jsonc/comma-style": ["error", "last"],
1618
- "jsonc/indent": ["error", 2],
1619
- "jsonc/key-spacing": [
1620
- "error",
1621
- {
1622
- beforeColon: false,
1623
- afterColon: true
1624
- }
1625
- ],
1626
- "jsonc/no-octal-escape": "error",
1627
- "jsonc/object-curly-newline": [
1592
+ "perfectionist/sort-imports": [
1628
1593
  "error",
1629
1594
  {
1630
- multiline: true,
1631
- consistent: true
1595
+ groups: [
1596
+ // Side effect style imports (e.g. 'normalize.css')
1597
+ "side-effect-style",
1598
+ // Styles (e.g. *.{css,scss,less})
1599
+ "style",
1600
+ // Node.js built-in modules. (e.g. fs, path)
1601
+ "builtin",
1602
+ // External modules installed in the project (e.g. vue, lodash)
1603
+ "external",
1604
+ // Internal modules (e.g. @/utils, @/components)
1605
+ "internal",
1606
+ // Modules from parent directory (e.g. ../utils)
1607
+ "parent",
1608
+ // Modules from the same directory (e.g. ./utils)
1609
+ "sibling",
1610
+ // Main file from the current directory (e.g. ./index)
1611
+ "index",
1612
+ // TypeScript object-imports (e.g. import log = console.log)
1613
+ "object",
1614
+ // Side effect imports (e.g. import 'babel-polyfill')
1615
+ "side-effect",
1616
+ /**
1617
+ * Type import at the end
1618
+ */
1619
+ "builtin-type",
1620
+ "external-type",
1621
+ "internal-type",
1622
+ "parent-type",
1623
+ "sibling-type",
1624
+ "index-type",
1625
+ "type",
1626
+ /**
1627
+ * Imports that don’t fit into any other group
1628
+ */
1629
+ "unknown"
1630
+ ],
1631
+ order: "asc",
1632
+ type: "natural",
1633
+ ignoreCase: true,
1634
+ internalPattern: ["~/**", "@/**", "#**"],
1635
+ newlinesBetween: "ignore"
1632
1636
  }
1633
1637
  ],
1634
- "jsonc/object-curly-spacing": ["error", "always"],
1635
- "jsonc/object-property-newline": [
1638
+ "perfectionist/sort-exports": [
1636
1639
  "error",
1637
1640
  {
1638
- allowMultiplePropertiesPerLine: true
1641
+ order: "asc",
1642
+ type: "line-length"
1639
1643
  }
1640
1644
  ],
1645
+ "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
1646
+ "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }],
1641
1647
  // Overrides built-in rules
1642
1648
  ...options.overrides
1643
1649
  }
1644
1650
  }
1645
1651
  ];
1646
1652
 
1647
- // src/configs/markdown.ts
1648
- var markdown = (options = {}) => [
1649
- ...import_eslint_plugin_markdown.default.configs.recommended,
1653
+ // src/configs/unusedImports.ts
1654
+ var unusedImports = (options = {}) => [
1650
1655
  {
1651
- name: "ntnyq/markdown/extensions",
1652
- files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1656
+ name: "ntnyq/unused-imports",
1657
+ plugins: {
1658
+ "unused-imports": import_eslint_plugin_unused_imports.default
1659
+ },
1653
1660
  rules: {
1654
- "no-undef": "off",
1655
- "no-alert": "off",
1656
- "no-console": "off",
1657
- "no-unused-vars": "off",
1658
- "no-unused-expressions": "off",
1659
- "no-restricted-imports": "off",
1660
- "node/prefer-global/buffer": "off",
1661
- "node/prefer-global/process": "off",
1662
- "import/no-unresolved": "off",
1663
- "unused-imports/no-unused-imports": "off",
1664
- "unused-imports/no-unused-vars": "off",
1665
- "@typescript-eslint/comma-dangle": "off",
1666
- "@typescript-eslint/no-redeclare": "off",
1667
- "@typescript-eslint/no-namespace": "off",
1668
1661
  "@typescript-eslint/no-unused-vars": "off",
1669
- "@typescript-eslint/no-extraneous-class": "off",
1670
- "@typescript-eslint/no-use-before-define": "off",
1662
+ "unused-imports/no-unused-imports": "error",
1663
+ "unused-imports/no-unused-vars": [
1664
+ "warn",
1665
+ {
1666
+ vars: "all",
1667
+ varsIgnorePattern: "^_",
1668
+ args: "after-used",
1669
+ argsIgnorePattern: "^_"
1670
+ }
1671
+ ],
1671
1672
  // Overrides built-in rules
1672
1673
  ...options.overrides
1673
1674
  }
1674
1675
  }
1675
1676
  ];
1676
1677
 
1678
+ // src/utils/env.ts
1679
+ var import_node_path = require("path");
1680
+ var import_node_process2 = __toESM(require("process"), 1);
1681
+ var import_local_pkg = require("local-pkg");
1682
+ var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
1683
+ var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
1684
+ var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli") || (0, import_local_pkg.isPackageExists)("vue", {
1685
+ paths: [(0, import_node_path.resolve)(import_node_process2.default.cwd(), "playground")]
1686
+ });
1687
+ var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
1688
+
1689
+ // src/utils/toArray.ts
1690
+ function toArray(val) {
1691
+ val = val ?? [];
1692
+ return Array.isArray(val) ? val : [val];
1693
+ }
1694
+
1695
+ // src/utils/interopDefault.ts
1696
+ async function interopDefault(mod) {
1697
+ const resolved = await mod;
1698
+ return resolved.default || resolved;
1699
+ }
1700
+
1701
+ // src/utils/loadPlugin.ts
1702
+ async function loadPlugin(name) {
1703
+ const mod = await import(name).catch((err) => {
1704
+ console.error(err);
1705
+ throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
1706
+ });
1707
+ return interopDefault(mod);
1708
+ }
1709
+
1710
+ // src/utils/resolveSubOptions.ts
1711
+ function resolveSubOptions(options, key) {
1712
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
1713
+ }
1714
+
1715
+ // src/utils/getOverrides.ts
1716
+ function getOverrides(options, key) {
1717
+ const sub = resolveSubOptions(options, key);
1718
+ return "overrides" in sub && sub.overrides ? sub.overrides : {};
1719
+ }
1720
+
1677
1721
  // src/core.ts
1678
- function ntnyq(options = {}, customConfig = []) {
1722
+ function ntnyq(options = {}, userConfigs = []) {
1679
1723
  const configs = [];
1680
1724
  if (options.gitignore ?? true) {
1681
1725
  configs.push(
@@ -1698,6 +1742,13 @@ function ntnyq(options = {}, customConfig = []) {
1698
1742
  overrides: getOverrides(options, "javascript")
1699
1743
  })
1700
1744
  );
1745
+ if (options.perfectionist ?? true) {
1746
+ configs.push(
1747
+ ...perfectionist({
1748
+ overrides: getOverrides(options, "perfectionist")
1749
+ })
1750
+ );
1751
+ }
1701
1752
  if (options.unicorn ?? true) {
1702
1753
  configs.push(
1703
1754
  ...unicorn({
@@ -1800,16 +1851,17 @@ function ntnyq(options = {}, customConfig = []) {
1800
1851
  })
1801
1852
  );
1802
1853
  }
1803
- configs.push(...toArray(customConfig));
1804
- if (options.prettier ?? true) {
1805
- configs.push(
1806
- ...prettier({
1807
- ...resolveSubOptions(options, "prettier"),
1808
- overrides: getOverrides(options, "prettier")
1809
- })
1810
- );
1811
- }
1812
- return configs;
1854
+ const configPrettier = options.prettier ?? true ? prettier({
1855
+ ...resolveSubOptions(options, "prettier"),
1856
+ overrides: getOverrides(options, "prettier")
1857
+ }) : [];
1858
+ const composer = new import_eslint_flat_config_utils.FlatConfigComposer();
1859
+ composer.append(
1860
+ ...configs,
1861
+ ...toArray(userConfigs),
1862
+ ...configPrettier
1863
+ );
1864
+ return composer;
1813
1865
  }
1814
1866
  // Annotate the CommonJS export names for ESM import in node:
1815
1867
  0 && (module.exports = {
@@ -1840,6 +1892,7 @@ function ntnyq(options = {}, customConfig = []) {
1840
1892
  GLOB_TSX,
1841
1893
  GLOB_VUE,
1842
1894
  GLOB_YAML,
1895
+ antfu,
1843
1896
  command,
1844
1897
  comments,
1845
1898
  getOverrides,
@@ -1864,6 +1917,7 @@ function ntnyq(options = {}, customConfig = []) {
1864
1917
  parserVue,
1865
1918
  parserYaml,
1866
1919
  perfectionist,
1920
+ pluginAntfu,
1867
1921
  pluginComments,
1868
1922
  pluginImport,
1869
1923
  pluginJsdoc,