@ntnyq/eslint-config 3.0.0-beta.1 → 3.0.0-beta.10

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