@ntnyq/eslint-config 3.0.0-beta.2 → 3.0.0-beta.20

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