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