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

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