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

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