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

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