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