@whoj/eslint-config 2.0.0 → 2.2.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.
package/dist/index.js CHANGED
@@ -7,96 +7,51 @@ init_esm_shims();
7
7
 
8
8
  // src/factory.ts
9
9
  init_esm_shims();
10
- import { FlatConfigComposer } from "eslint-flat-config-utils";
11
10
  import { isPackageExists as isPackageExists4 } from "local-pkg";
11
+ import { FlatConfigComposer } from "eslint-flat-config-utils";
12
12
 
13
- // src/configs/index.ts
13
+ // src/configs/regexp.ts
14
14
  init_esm_shims();
15
+ import { configs } from "eslint-plugin-regexp";
16
+ async function regexp(options = {}) {
17
+ const config = configs["flat/recommended"];
18
+ const rules = {
19
+ ...config.rules
20
+ };
21
+ if (options.level === "warn") {
22
+ for (const key in rules) {
23
+ if (rules[key] === "error")
24
+ rules[key] = "warn";
25
+ }
26
+ }
27
+ return [
28
+ {
29
+ ...config,
30
+ name: "whoj/regexp/rules",
31
+ rules: {
32
+ ...rules,
33
+ ...options.overrides
34
+ }
35
+ }
36
+ ];
37
+ }
15
38
 
16
- // src/configs/astro.ts
39
+ // src/configs/formatters.ts
17
40
  init_esm_shims();
41
+ import { isPackageExists as isPackageExists2 } from "local-pkg";
18
42
 
19
- // src/globs.ts
43
+ // src/configs/stylistic.ts
20
44
  init_esm_shims();
21
- var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
22
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
23
- var GLOB_JS = "**/*.?([cm])js";
24
- var GLOB_JSX = "**/*.?([cm])jsx";
25
- var GLOB_TS = "**/*.?([cm])ts";
26
- var GLOB_TSX = "**/*.?([cm])tsx";
27
- var GLOB_STYLE = "**/*.{c,le,sc}ss";
28
- var GLOB_CSS = "**/*.css";
29
- var GLOB_POSTCSS = "**/*.{p,post}css";
30
- var GLOB_LESS = "**/*.less";
31
- var GLOB_SCSS = "**/*.scss";
32
- var GLOB_JSON = "**/*.json";
33
- var GLOB_JSON5 = "**/*.json5";
34
- var GLOB_JSONC = "**/*.jsonc";
35
- var GLOB_MARKDOWN = "**/*.md";
36
- var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
37
- var GLOB_SVELTE = "**/*.svelte";
38
- var GLOB_VUE = "**/*.vue";
39
- var GLOB_YAML = "**/*.y?(a)ml";
40
- var GLOB_TOML = "**/*.toml";
41
- var GLOB_XML = "**/*.xml";
42
- var GLOB_SVG = "**/*.svg";
43
- var GLOB_HTML = "**/*.htm?(l)";
44
- var GLOB_ASTRO = "**/*.astro";
45
- var GLOB_ASTRO_TS = "**/*.astro/*.ts";
46
- var GLOB_GRAPHQL = "**/*.{g,graph}ql";
47
- var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
48
- var GLOB_TESTS = [
49
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
50
- `**/*.spec.${GLOB_SRC_EXT}`,
51
- `**/*.test.${GLOB_SRC_EXT}`,
52
- `**/*.bench.${GLOB_SRC_EXT}`,
53
- `**/*.benchmark.${GLOB_SRC_EXT}`
54
- ];
55
- var GLOB_ALL_SRC = [
56
- GLOB_SRC,
57
- GLOB_STYLE,
58
- GLOB_JSON,
59
- GLOB_JSON5,
60
- GLOB_MARKDOWN,
61
- GLOB_SVELTE,
62
- GLOB_VUE,
63
- GLOB_YAML,
64
- GLOB_XML,
65
- GLOB_HTML
66
- ];
67
- var GLOB_EXCLUDE = [
68
- "**/node_modules",
69
- "**/dist",
70
- "**/package-lock.json",
71
- "**/yarn.lock",
72
- "**/pnpm-lock.yaml",
73
- "**/bun.lockb",
74
- "**/output",
75
- "**/coverage",
76
- "**/temp",
77
- "**/.temp",
78
- "**/tmp",
79
- "**/.tmp",
80
- "**/.history",
81
- "**/.vitepress/cache",
82
- "**/.nuxt",
83
- "**/.next",
84
- "**/.svelte-kit",
85
- "**/.vercel",
86
- "**/.changeset",
87
- "**/.idea",
88
- "**/.cache",
89
- "**/.output",
90
- "**/.vite-inspect",
91
- "**/.yarn",
92
- "**/vite.config.*.timestamp-*",
93
- "**/CHANGELOG*.md",
94
- "**/*.min.*",
95
- "**/LICENSE*",
96
- "**/__snapshots__",
97
- "**/auto-import?(s).d.ts",
98
- "**/components.d.ts"
99
- ];
45
+
46
+ // src/plugins.ts
47
+ init_esm_shims();
48
+ import * as pluginImport from "eslint-plugin-import-x";
49
+ import { default as default2 } from "eslint-plugin-n";
50
+ import { default as default3 } from "eslint-plugin-antfu";
51
+ import { default as default4 } from "eslint-plugin-unicorn";
52
+ import { default as default5 } from "eslint-plugin-perfectionist";
53
+ import { default as default6 } from "eslint-plugin-unused-imports";
54
+ import { default as default7 } from "@eslint-community/eslint-plugin-eslint-comments";
100
55
 
101
56
  // src/utils.ts
102
57
  init_esm_shims();
@@ -191,226 +146,142 @@ function isInGitHooksOrLintStaged() {
191
146
  return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
192
147
  }
193
148
 
194
- // src/configs/astro.ts
195
- async function astro(options = {}) {
149
+ // src/configs/stylistic.ts
150
+ var StylisticConfigDefaults = {
151
+ commaDangle: "never",
152
+ indent: 2,
153
+ jsx: true,
154
+ quotes: "single",
155
+ semi: true
156
+ };
157
+ async function stylistic(options = {}) {
196
158
  const {
197
- files = [GLOB_ASTRO],
159
+ commaDangle,
160
+ indent,
161
+ jsx: jsx2,
162
+ lessOpinionated = false,
198
163
  overrides = {},
199
- stylistic: stylistic2 = true
200
- } = options;
201
- const [
202
- pluginAstro,
203
- parserAstro,
204
- parserTs
205
- ] = await Promise.all([
206
- interopDefault(import("./lib-FENTQ4WJ.js")),
207
- interopDefault(import("./lib-WKUBBNE4.js")),
208
- interopDefault(import("@typescript-eslint/parser"))
209
- ]);
164
+ quotes,
165
+ semi
166
+ } = {
167
+ ...StylisticConfigDefaults,
168
+ ...options
169
+ };
170
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
171
+ const config = pluginStylistic.configs.customize({
172
+ commaDangle,
173
+ flat: true,
174
+ indent,
175
+ jsx: jsx2,
176
+ pluginName: "style",
177
+ quotes,
178
+ semi
179
+ });
210
180
  return [
211
181
  {
212
- name: "antfu/astro/setup",
182
+ name: "whoj/stylistic/rules",
213
183
  plugins: {
214
- astro: pluginAstro
215
- }
216
- },
217
- {
218
- files,
219
- languageOptions: {
220
- globals: pluginAstro.environments.astro.globals,
221
- parser: parserAstro,
222
- parserOptions: {
223
- extraFileExtensions: [".astro"],
224
- parser: parserTs
225
- },
226
- sourceType: "module"
184
+ style: pluginStylistic,
185
+ whoj: default3
227
186
  },
228
- name: "antfu/astro/rules",
229
- processor: "astro/client-side-ts",
230
187
  rules: {
231
- // Astro uses top level await for e.g. data fetching
232
- // https://docs.astro.build/en/guides/data-fetching/#fetch-in-astro
233
- "antfu/no-top-level-await": "off",
234
- // use recommended rules
235
- "astro/missing-client-only-directive-value": "error",
236
- "astro/no-conflict-set-directives": "error",
237
- "astro/no-deprecated-astro-canonicalurl": "error",
238
- "astro/no-deprecated-astro-fetchcontent": "error",
239
- "astro/no-deprecated-astro-resolve": "error",
240
- "astro/no-deprecated-getentrybyslug": "error",
241
- "astro/no-set-html-directive": "off",
242
- "astro/no-unused-define-vars-in-style": "error",
243
- "astro/semi": "off",
244
- "astro/valid-compile": "error",
245
- ...stylistic2 ? {
246
- "style/indent": "off",
247
- "style/jsx-closing-tag-location": "off",
248
- "style/jsx-one-expression-per-line": "off",
249
- "style/no-multiple-empty-lines": "off"
250
- } : {},
188
+ ...config.rules,
189
+ "whoj/consistent-chaining": "error",
190
+ "whoj/consistent-list-newline": "error",
191
+ ...lessOpinionated ? {
192
+ curly: ["error", "all"]
193
+ } : {
194
+ "whoj/curly": "error",
195
+ "whoj/if-newline": "error",
196
+ "whoj/top-level-function": "error"
197
+ },
251
198
  ...overrides
252
199
  }
253
200
  }
254
201
  ];
255
202
  }
256
203
 
257
- // src/configs/command.ts
258
- init_esm_shims();
259
- import createCommand from "eslint-plugin-command/config";
260
- async function command() {
261
- return [
262
- {
263
- ...createCommand(),
264
- name: "antfu/command/rules"
265
- }
266
- ];
267
- }
268
-
269
- // src/configs/comments.ts
270
- init_esm_shims();
271
-
272
- // src/plugins.ts
273
- init_esm_shims();
274
- import { default as default2 } from "@eslint-community/eslint-plugin-eslint-comments";
275
- import { default as default3 } from "eslint-plugin-antfu";
276
- import * as pluginImport from "eslint-plugin-import-x";
277
- import { default as default4 } from "eslint-plugin-n";
278
- import { default as default5 } from "eslint-plugin-perfectionist";
279
- import { default as default6 } from "eslint-plugin-unicorn";
280
- import { default as default7 } from "eslint-plugin-unused-imports";
281
-
282
- // src/configs/comments.ts
283
- async function comments() {
284
- return [
285
- {
286
- name: "antfu/eslint-comments/rules",
287
- plugins: {
288
- "eslint-comments": default2
289
- },
290
- rules: {
291
- "eslint-comments/no-aggregating-enable": "error",
292
- "eslint-comments/no-duplicate-disable": "error",
293
- "eslint-comments/no-unlimited-disable": "error",
294
- "eslint-comments/no-unused-enable": "error"
295
- }
296
- }
297
- ];
298
- }
299
-
300
- // src/configs/disables.ts
204
+ // src/globs.ts
301
205
  init_esm_shims();
302
- async function disables() {
303
- return [
304
- {
305
- files: [`**/scripts/${GLOB_SRC}`],
306
- name: "antfu/disables/scripts",
307
- rules: {
308
- "antfu/no-top-level-await": "off",
309
- "no-console": "off",
310
- "ts/explicit-function-return-type": "off"
311
- }
312
- },
313
- {
314
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
315
- name: "antfu/disables/cli",
316
- rules: {
317
- "antfu/no-top-level-await": "off",
318
- "no-console": "off"
319
- }
320
- },
321
- {
322
- files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
323
- name: "antfu/disables/bin",
324
- rules: {
325
- "antfu/no-import-dist": "off",
326
- "antfu/no-import-node-modules-by-path": "off"
327
- }
328
- },
329
- {
330
- files: ["**/*.d.?([cm])ts"],
331
- name: "antfu/disables/dts",
332
- rules: {
333
- "eslint-comments/no-unlimited-disable": "off",
334
- "import/no-duplicates": "off",
335
- "no-restricted-syntax": "off",
336
- "unused-imports/no-unused-vars": "off"
337
- }
338
- },
339
- {
340
- files: ["**/*.js", "**/*.cjs"],
341
- name: "antfu/disables/cjs",
342
- rules: {
343
- "ts/no-require-imports": "off"
344
- }
345
- },
346
- {
347
- files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
348
- name: "antfu/disables/config-files",
349
- rules: {
350
- "antfu/no-top-level-await": "off",
351
- "no-console": "off",
352
- "ts/explicit-function-return-type": "off"
353
- }
354
- }
355
- ];
356
- }
357
-
358
- // src/configs/formatters.ts
359
- init_esm_shims();
360
- import { isPackageExists as isPackageExists2 } from "local-pkg";
361
-
362
- // src/configs/stylistic.ts
363
- init_esm_shims();
364
- var StylisticConfigDefaults = {
365
- indent: 2,
366
- jsx: true,
367
- quotes: "single",
368
- semi: false
369
- };
370
- async function stylistic(options = {}) {
371
- const {
372
- indent,
373
- jsx: jsx2,
374
- lessOpinionated = false,
375
- overrides = {},
376
- quotes,
377
- semi
378
- } = {
379
- ...StylisticConfigDefaults,
380
- ...options
381
- };
382
- const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
383
- const config = pluginStylistic.configs.customize({
384
- flat: true,
385
- indent,
386
- jsx: jsx2,
387
- pluginName: "style",
388
- quotes,
389
- semi
390
- });
391
- return [
392
- {
393
- name: "antfu/stylistic/rules",
394
- plugins: {
395
- antfu: default3,
396
- style: pluginStylistic
397
- },
398
- rules: {
399
- ...config.rules,
400
- "antfu/consistent-chaining": "error",
401
- "antfu/consistent-list-newline": "error",
402
- ...lessOpinionated ? {
403
- curly: ["error", "all"]
404
- } : {
405
- "antfu/curly": "error",
406
- "antfu/if-newline": "error",
407
- "antfu/top-level-function": "error"
408
- },
409
- ...overrides
410
- }
411
- }
412
- ];
413
- }
206
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
207
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
208
+ var GLOB_JS = "**/*.?([cm])js";
209
+ var GLOB_JSX = "**/*.?([cm])jsx";
210
+ var GLOB_TS = "**/*.?([cm])ts";
211
+ var GLOB_TSX = "**/*.?([cm])tsx";
212
+ var GLOB_STYLE = "**/*.{c,le,sc}ss";
213
+ var GLOB_CSS = "**/*.css";
214
+ var GLOB_POSTCSS = "**/*.{p,post}css";
215
+ var GLOB_LESS = "**/*.less";
216
+ var GLOB_SCSS = "**/*.scss";
217
+ var GLOB_JSON = "**/*.json";
218
+ var GLOB_JSON5 = "**/*.json5";
219
+ var GLOB_JSONC = "**/*.jsonc";
220
+ var GLOB_MARKDOWN = "**/*.md";
221
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
222
+ var GLOB_SVELTE = "**/*.svelte";
223
+ var GLOB_VUE = "**/*.vue";
224
+ var GLOB_YAML = "**/*.y?(a)ml";
225
+ var GLOB_TOML = "**/*.toml";
226
+ var GLOB_XML = "**/*.xml";
227
+ var GLOB_SVG = "**/*.svg";
228
+ var GLOB_HTML = "**/*.htm?(l)";
229
+ var GLOB_ASTRO = "**/*.astro";
230
+ var GLOB_ASTRO_TS = "**/*.astro/*.ts";
231
+ var GLOB_GRAPHQL = "**/*.{g,graph}ql";
232
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
233
+ var GLOB_TESTS = [
234
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
235
+ `**/*.spec.${GLOB_SRC_EXT}`,
236
+ `**/*.test.${GLOB_SRC_EXT}`,
237
+ `**/*.bench.${GLOB_SRC_EXT}`,
238
+ `**/*.benchmark.${GLOB_SRC_EXT}`
239
+ ];
240
+ var GLOB_ALL_SRC = [
241
+ GLOB_SRC,
242
+ GLOB_STYLE,
243
+ GLOB_JSON,
244
+ GLOB_JSON5,
245
+ GLOB_MARKDOWN,
246
+ GLOB_SVELTE,
247
+ GLOB_VUE,
248
+ GLOB_YAML,
249
+ GLOB_XML,
250
+ GLOB_HTML
251
+ ];
252
+ var GLOB_EXCLUDE = [
253
+ "**/node_modules",
254
+ "**/dist",
255
+ "**/package-lock.json",
256
+ "**/yarn.lock",
257
+ "**/pnpm-lock.yaml",
258
+ "**/bun.lockb",
259
+ "**/output",
260
+ "**/coverage",
261
+ "**/temp",
262
+ "**/.temp",
263
+ "**/tmp",
264
+ "**/.tmp",
265
+ "**/.history",
266
+ "**/.vitepress/cache",
267
+ "**/.nuxt",
268
+ "**/.next",
269
+ "**/.svelte-kit",
270
+ "**/.vercel",
271
+ "**/.changeset",
272
+ "**/.idea",
273
+ "**/.cache",
274
+ "**/.output",
275
+ "**/.vite-inspect",
276
+ "**/.yarn",
277
+ "**/vite.config.*.timestamp-*",
278
+ "**/CHANGELOG*.md",
279
+ "**/*.min.*",
280
+ "**/LICENSE*",
281
+ "**/__snapshots__",
282
+ "**/auto-import?(s).d.ts",
283
+ "**/components.d.ts"
284
+ ];
414
285
 
415
286
  // src/configs/formatters.ts
416
287
  function mergePrettierOptions(options, overrides = {}) {
@@ -482,7 +353,7 @@ async function formatters(options = {}, stylistic2 = {}) {
482
353
  const pluginFormat = await interopDefault(import("eslint-plugin-format"));
483
354
  const configs2 = [
484
355
  {
485
- name: "antfu/formatter/setup",
356
+ name: "whoj/formatter/setup",
486
357
  plugins: {
487
358
  format: pluginFormat
488
359
  }
@@ -495,7 +366,7 @@ async function formatters(options = {}, stylistic2 = {}) {
495
366
  languageOptions: {
496
367
  parser: parserPlain
497
368
  },
498
- name: "antfu/formatter/css",
369
+ name: "whoj/formatter/css",
499
370
  rules: {
500
371
  "format/prettier": [
501
372
  "error",
@@ -510,7 +381,7 @@ async function formatters(options = {}, stylistic2 = {}) {
510
381
  languageOptions: {
511
382
  parser: parserPlain
512
383
  },
513
- name: "antfu/formatter/scss",
384
+ name: "whoj/formatter/scss",
514
385
  rules: {
515
386
  "format/prettier": [
516
387
  "error",
@@ -525,7 +396,7 @@ async function formatters(options = {}, stylistic2 = {}) {
525
396
  languageOptions: {
526
397
  parser: parserPlain
527
398
  },
528
- name: "antfu/formatter/less",
399
+ name: "whoj/formatter/less",
529
400
  rules: {
530
401
  "format/prettier": [
531
402
  "error",
@@ -543,7 +414,7 @@ async function formatters(options = {}, stylistic2 = {}) {
543
414
  languageOptions: {
544
415
  parser: parserPlain
545
416
  },
546
- name: "antfu/formatter/html",
417
+ name: "whoj/formatter/html",
547
418
  rules: {
548
419
  "format/prettier": [
549
420
  "error",
@@ -560,7 +431,7 @@ async function formatters(options = {}, stylistic2 = {}) {
560
431
  languageOptions: {
561
432
  parser: parserPlain
562
433
  },
563
- name: "antfu/formatter/xml",
434
+ name: "whoj/formatter/xml",
564
435
  rules: {
565
436
  "format/prettier": [
566
437
  "error",
@@ -580,7 +451,7 @@ async function formatters(options = {}, stylistic2 = {}) {
580
451
  languageOptions: {
581
452
  parser: parserPlain
582
453
  },
583
- name: "antfu/formatter/svg",
454
+ name: "whoj/formatter/svg",
584
455
  rules: {
585
456
  "format/prettier": [
586
457
  "error",
@@ -603,7 +474,7 @@ async function formatters(options = {}, stylistic2 = {}) {
603
474
  languageOptions: {
604
475
  parser: parserPlain
605
476
  },
606
- name: "antfu/formatter/markdown",
477
+ name: "whoj/formatter/markdown",
607
478
  rules: {
608
479
  [`format/${formater}`]: [
609
480
  "error",
@@ -623,7 +494,7 @@ async function formatters(options = {}, stylistic2 = {}) {
623
494
  languageOptions: {
624
495
  parser: parserPlain
625
496
  },
626
- name: "antfu/formatter/slidev",
497
+ name: "whoj/formatter/slidev",
627
498
  rules: {
628
499
  "format/prettier": [
629
500
  "error",
@@ -645,7 +516,7 @@ async function formatters(options = {}, stylistic2 = {}) {
645
516
  languageOptions: {
646
517
  parser: parserPlain
647
518
  },
648
- name: "antfu/formatter/astro",
519
+ name: "whoj/formatter/astro",
649
520
  rules: {
650
521
  "format/prettier": [
651
522
  "error",
@@ -660,7 +531,7 @@ async function formatters(options = {}, stylistic2 = {}) {
660
531
  });
661
532
  configs2.push({
662
533
  files: [GLOB_ASTRO, GLOB_ASTRO_TS],
663
- name: "antfu/formatter/astro/disables",
534
+ name: "whoj/formatter/astro/disables",
664
535
  rules: {
665
536
  "style/arrow-parens": "off",
666
537
  "style/block-spacing": "off",
@@ -678,7 +549,7 @@ async function formatters(options = {}, stylistic2 = {}) {
678
549
  languageOptions: {
679
550
  parser: parserPlain
680
551
  },
681
- name: "antfu/formatter/graphql",
552
+ name: "whoj/formatter/graphql",
682
553
  rules: {
683
554
  "format/prettier": [
684
555
  "error",
@@ -692,208 +563,149 @@ async function formatters(options = {}, stylistic2 = {}) {
692
563
  return configs2;
693
564
  }
694
565
 
695
- // src/configs/ignores.ts
566
+ // src/configs/index.ts
696
567
  init_esm_shims();
697
- async function ignores(userIgnores = []) {
698
- return [
699
- {
700
- ignores: [
701
- ...GLOB_EXCLUDE,
702
- ...userIgnores
703
- ],
704
- name: "antfu/ignores"
705
- }
706
- ];
707
- }
708
568
 
709
- // src/configs/imports.ts
569
+ // src/configs/jsx.ts
710
570
  init_esm_shims();
711
- async function imports(options = {}) {
712
- const {
713
- stylistic: stylistic2 = true
714
- } = options;
571
+ async function jsx() {
715
572
  return [
716
573
  {
717
- name: "antfu/imports/rules",
718
- plugins: {
719
- antfu: default3,
720
- import: pluginImport
574
+ files: [GLOB_JSX, GLOB_TSX],
575
+ languageOptions: {
576
+ parserOptions: {
577
+ ecmaFeatures: {
578
+ jsx: true
579
+ }
580
+ }
721
581
  },
722
- rules: {
723
- "antfu/import-dedupe": "error",
724
- "antfu/no-import-dist": "error",
725
- "antfu/no-import-node-modules-by-path": "error",
726
- "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
727
- "import/first": "error",
728
- "import/no-duplicates": "error",
729
- "import/no-mutable-exports": "error",
730
- "import/no-named-default": "error",
731
- "import/no-self-import": "error",
732
- "import/no-webpack-loader-syntax": "error",
733
- ...stylistic2 ? {
734
- "import/newline-after-import": ["error", { count: 1 }]
735
- } : {}
736
- }
582
+ name: "whoj/jsx/setup"
737
583
  }
738
584
  ];
739
585
  }
740
586
 
741
- // src/configs/javascript.ts
587
+ // src/configs/vue.ts
742
588
  init_esm_shims();
743
- import globals from "globals";
744
- async function javascript(options = {}) {
589
+ import { mergeProcessors } from "eslint-merge-processors";
590
+ async function vue(options = {}) {
745
591
  const {
746
- isInEditor = false,
747
- overrides = {}
592
+ files = [GLOB_VUE],
593
+ overrides = {},
594
+ stylistic: stylistic2 = true,
595
+ vueVersion = 3
748
596
  } = options;
597
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
598
+ const {
599
+ indent = 2
600
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
601
+ const [
602
+ pluginVue,
603
+ parserVue,
604
+ processorVueBlocks
605
+ ] = await Promise.all([
606
+ interopDefault(import("eslint-plugin-vue")),
607
+ interopDefault(import("vue-eslint-parser")),
608
+ interopDefault(import("eslint-processor-vue-blocks"))
609
+ ]);
749
610
  return [
750
611
  {
612
+ // This allows Vue plugin to work with auto imports
613
+ // https://github.com/vuejs/eslint-plugin-vue/pull/2422
751
614
  languageOptions: {
752
- ecmaVersion: 2022,
753
615
  globals: {
754
- ...globals.browser,
755
- ...globals.es2021,
756
- ...globals.node,
757
- document: "readonly",
758
- navigator: "readonly",
759
- window: "readonly"
760
- },
616
+ computed: "readonly",
617
+ defineEmits: "readonly",
618
+ defineExpose: "readonly",
619
+ defineProps: "readonly",
620
+ onMounted: "readonly",
621
+ onUnmounted: "readonly",
622
+ reactive: "readonly",
623
+ ref: "readonly",
624
+ shallowReactive: "readonly",
625
+ shallowRef: "readonly",
626
+ toRef: "readonly",
627
+ toRefs: "readonly",
628
+ watch: "readonly",
629
+ watchEffect: "readonly"
630
+ }
631
+ },
632
+ name: "whoj/vue/setup",
633
+ plugins: {
634
+ vue: pluginVue
635
+ }
636
+ },
637
+ {
638
+ files,
639
+ languageOptions: {
640
+ parser: parserVue,
761
641
  parserOptions: {
762
642
  ecmaFeatures: {
763
643
  jsx: true
764
644
  },
765
- ecmaVersion: 2022,
645
+ extraFileExtensions: [".vue"],
646
+ parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
766
647
  sourceType: "module"
767
- },
768
- sourceType: "module"
769
- },
770
- linterOptions: {
771
- reportUnusedDisableDirectives: true
772
- },
773
- name: "antfu/javascript/setup"
774
- },
775
- {
776
- name: "antfu/javascript/rules",
777
- plugins: {
778
- "antfu": default3,
779
- "unused-imports": default7
648
+ }
780
649
  },
781
- rules: {
782
- "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
783
- "antfu/no-top-level-await": "error",
784
- "array-callback-return": "error",
785
- "block-scoped-var": "error",
786
- "constructor-super": "error",
787
- "default-case-last": "error",
788
- "dot-notation": ["error", { allowKeywords: true }],
789
- "eqeqeq": ["error", "smart"],
790
- "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
791
- "no-alert": "error",
792
- "no-array-constructor": "error",
793
- "no-async-promise-executor": "error",
794
- "no-caller": "error",
795
- "no-case-declarations": "error",
796
- "no-class-assign": "error",
797
- "no-compare-neg-zero": "error",
798
- "no-cond-assign": ["error", "always"],
799
- "no-console": ["error", { allow: ["warn", "error"] }],
800
- "no-const-assign": "error",
801
- "no-control-regex": "error",
802
- "no-debugger": "error",
803
- "no-delete-var": "error",
804
- "no-dupe-args": "error",
805
- "no-dupe-class-members": "error",
806
- "no-dupe-keys": "error",
807
- "no-duplicate-case": "error",
808
- "no-empty": ["error", { allowEmptyCatch: true }],
809
- "no-empty-character-class": "error",
810
- "no-empty-pattern": "error",
811
- "no-eval": "error",
812
- "no-ex-assign": "error",
813
- "no-extend-native": "error",
814
- "no-extra-bind": "error",
815
- "no-extra-boolean-cast": "error",
816
- "no-fallthrough": "error",
817
- "no-func-assign": "error",
818
- "no-global-assign": "error",
819
- "no-implied-eval": "error",
820
- "no-import-assign": "error",
821
- "no-invalid-regexp": "error",
822
- "no-irregular-whitespace": "error",
823
- "no-iterator": "error",
824
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
825
- "no-lone-blocks": "error",
826
- "no-loss-of-precision": "error",
827
- "no-misleading-character-class": "error",
828
- "no-multi-str": "error",
829
- "no-new": "error",
830
- "no-new-func": "error",
831
- "no-new-native-nonconstructor": "error",
832
- "no-new-wrappers": "error",
833
- "no-obj-calls": "error",
834
- "no-octal": "error",
835
- "no-octal-escape": "error",
836
- "no-proto": "error",
837
- "no-prototype-builtins": "error",
838
- "no-redeclare": ["error", { builtinGlobals: false }],
839
- "no-regex-spaces": "error",
840
- "no-restricted-globals": [
841
- "error",
842
- { message: "Use `globalThis` instead.", name: "global" },
843
- { message: "Use `globalThis` instead.", name: "self" }
844
- ],
845
- "no-restricted-properties": [
846
- "error",
847
- { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
848
- { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
849
- { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
850
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
851
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
852
- ],
853
- "no-restricted-syntax": [
854
- "error",
855
- "TSEnumDeclaration[const=true]",
856
- "TSExportAssignment"
857
- ],
858
- "no-self-assign": ["error", { props: true }],
859
- "no-self-compare": "error",
860
- "no-sequences": "error",
861
- "no-shadow-restricted-names": "error",
862
- "no-sparse-arrays": "error",
863
- "no-template-curly-in-string": "error",
864
- "no-this-before-super": "error",
865
- "no-throw-literal": "error",
866
- "no-undef": "error",
867
- "no-undef-init": "error",
868
- "no-unexpected-multiline": "error",
869
- "no-unmodified-loop-condition": "error",
870
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
871
- "no-unreachable": "error",
872
- "no-unreachable-loop": "error",
873
- "no-unsafe-finally": "error",
874
- "no-unsafe-negation": "error",
875
- "no-unused-expressions": ["error", {
876
- allowShortCircuit: true,
877
- allowTaggedTemplates: true,
878
- allowTernary: true
650
+ name: "whoj/vue/rules",
651
+ processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors([
652
+ pluginVue.processors[".vue"],
653
+ processorVueBlocks({
654
+ ...sfcBlocks,
655
+ blocks: {
656
+ styles: true,
657
+ ...sfcBlocks.blocks
658
+ }
659
+ })
660
+ ]),
661
+ rules: {
662
+ ...pluginVue.configs.base.rules,
663
+ ...vueVersion === 2 ? {
664
+ ...pluginVue.configs.essential.rules,
665
+ ...pluginVue.configs["strongly-recommended"].rules,
666
+ ...pluginVue.configs.recommended.rules
667
+ } : {
668
+ ...pluginVue.configs["vue3-essential"].rules,
669
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
670
+ ...pluginVue.configs["vue3-recommended"].rules
671
+ },
672
+ "node/prefer-global/process": "off",
673
+ "ts/explicit-function-return-type": "off",
674
+ "vue/block-order": ["error", {
675
+ order: ["script", "template", "style"]
879
676
  }],
880
- "no-unused-vars": ["error", {
881
- args: "none",
882
- caughtErrors: "none",
883
- ignoreRestSiblings: true,
884
- vars: "all"
677
+ "vue/component-name-in-template-casing": ["error", "PascalCase"],
678
+ "vue/component-options-name-casing": ["error", "PascalCase"],
679
+ // this is deprecated
680
+ "vue/component-tags-order": "off",
681
+ "vue/custom-event-name-casing": ["error", "camelCase"],
682
+ "vue/define-macros-order": ["error", {
683
+ order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
885
684
  }],
886
- "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
887
- "no-useless-backreference": "error",
888
- "no-useless-call": "error",
889
- "no-useless-catch": "error",
890
- "no-useless-computed-key": "error",
891
- "no-useless-constructor": "error",
892
- "no-useless-rename": "error",
893
- "no-useless-return": "error",
894
- "no-var": "error",
895
- "no-with": "error",
896
- "object-shorthand": [
685
+ "vue/dot-location": ["error", "property"],
686
+ "vue/dot-notation": ["error", { allowKeywords: true }],
687
+ "vue/eqeqeq": ["error", "smart"],
688
+ "vue/html-indent": ["error", indent],
689
+ "vue/html-quotes": ["error", "double"],
690
+ "vue/max-attributes-per-line": "off",
691
+ "vue/multi-word-component-names": "off",
692
+ "vue/no-dupe-keys": "off",
693
+ "vue/no-empty-pattern": "error",
694
+ "vue/no-irregular-whitespace": "error",
695
+ "vue/no-loss-of-precision": "error",
696
+ "vue/no-restricted-syntax": [
697
+ "error",
698
+ "DebuggerStatement",
699
+ "LabeledStatement",
700
+ "WithStatement"
701
+ ],
702
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
703
+ "vue/no-setup-props-reactivity-loss": "off",
704
+ "vue/no-sparse-arrays": "error",
705
+ "vue/no-unused-refs": "error",
706
+ "vue/no-useless-v-bind": "error",
707
+ "vue/no-v-html": "off",
708
+ "vue/object-shorthand": [
897
709
  "error",
898
710
  "always",
899
711
  {
@@ -901,835 +713,927 @@ async function javascript(options = {}) {
901
713
  ignoreConstructors: false
902
714
  }
903
715
  ],
904
- "one-var": ["error", { initialized: "never" }],
905
- "prefer-arrow-callback": [
906
- "error",
907
- {
908
- allowNamedFunctions: false,
909
- allowUnboundThis: true
910
- }
911
- ],
912
- "prefer-const": [
913
- isInEditor ? "warn" : "error",
914
- {
915
- destructuring: "all",
916
- ignoreReadBeforeAssign: true
917
- }
918
- ],
919
- "prefer-exponentiation-operator": "error",
920
- "prefer-promise-reject-errors": "error",
921
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
922
- "prefer-rest-params": "error",
923
- "prefer-spread": "error",
924
- "prefer-template": "error",
925
- "symbol-description": "error",
926
- "unicode-bom": ["error", "never"],
927
- "unused-imports/no-unused-imports": isInEditor ? "warn" : "error",
928
- "unused-imports/no-unused-vars": [
929
- "error",
930
- {
931
- args: "after-used",
932
- argsIgnorePattern: "^_",
933
- ignoreRestSiblings: true,
934
- vars: "all",
935
- varsIgnorePattern: "^_"
936
- }
937
- ],
938
- "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
939
- "valid-typeof": ["error", { requireStringLiterals: true }],
940
- "vars-on-top": "error",
941
- "yoda": ["error", "never"],
716
+ "vue/prefer-separate-static-class": "error",
717
+ "vue/prefer-template": "error",
718
+ "vue/prop-name-casing": ["error", "camelCase"],
719
+ "vue/require-default-prop": "off",
720
+ "vue/require-prop-types": "off",
721
+ "vue/space-infix-ops": "error",
722
+ "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
723
+ "whoj/no-top-level-await": "off",
724
+ ...stylistic2 ? {
725
+ "vue/array-bracket-spacing": ["error", "never"],
726
+ "vue/arrow-spacing": ["error", { after: true, before: true }],
727
+ "vue/block-spacing": ["error", "always"],
728
+ "vue/block-tag-newline": ["error", {
729
+ multiline: "always",
730
+ singleline: "always"
731
+ }],
732
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
733
+ "vue/comma-dangle": ["error", "always-multiline"],
734
+ "vue/comma-spacing": ["error", { after: true, before: false }],
735
+ "vue/comma-style": ["error", "last"],
736
+ "vue/html-comment-content-spacing": ["error", "always", {
737
+ exceptions: ["-"]
738
+ }],
739
+ "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
740
+ "vue/keyword-spacing": ["error", { after: true, before: true }],
741
+ "vue/object-curly-newline": "off",
742
+ "vue/object-curly-spacing": ["error", "always"],
743
+ "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
744
+ "vue/operator-linebreak": ["error", "before"],
745
+ "vue/padding-line-between-blocks": ["error", "always"],
746
+ "vue/quote-props": ["error", "consistent-as-needed"],
747
+ "vue/space-in-parens": ["error", "never"],
748
+ "vue/template-curly-spacing": "error"
749
+ } : {},
942
750
  ...overrides
943
751
  }
944
752
  }
945
753
  ];
946
754
  }
947
755
 
948
- // src/configs/jsdoc.ts
756
+ // src/configs/node.ts
949
757
  init_esm_shims();
950
- async function jsdoc(options = {}) {
951
- const {
952
- stylistic: stylistic2 = true
953
- } = options;
758
+ async function node() {
954
759
  return [
955
760
  {
956
- name: "antfu/jsdoc/rules",
761
+ name: "whoj/node/rules",
957
762
  plugins: {
958
- jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
763
+ node: default2
959
764
  },
960
765
  rules: {
961
- "jsdoc/check-access": "warn",
962
- "jsdoc/check-param-names": "warn",
963
- "jsdoc/check-property-names": "warn",
964
- "jsdoc/check-types": "warn",
965
- "jsdoc/empty-tags": "warn",
966
- "jsdoc/implements-on-classes": "warn",
967
- "jsdoc/no-defaults": "warn",
968
- "jsdoc/no-multi-asterisks": "warn",
969
- "jsdoc/require-param-name": "warn",
970
- "jsdoc/require-property": "warn",
971
- "jsdoc/require-property-description": "warn",
972
- "jsdoc/require-property-name": "warn",
973
- "jsdoc/require-returns-check": "warn",
974
- "jsdoc/require-returns-description": "warn",
975
- "jsdoc/require-yields-check": "warn",
976
- ...stylistic2 ? {
977
- "jsdoc/check-alignment": "warn",
978
- "jsdoc/multiline-blocks": "warn"
979
- } : {}
766
+ "node/handle-callback-err": ["error", "^(err|error)$"],
767
+ "node/no-deprecated-api": "error",
768
+ "node/no-exports-assign": "error",
769
+ "node/no-new-require": "error",
770
+ "node/no-path-concat": "error",
771
+ "node/prefer-global/buffer": ["off"],
772
+ "node/prefer-global/process": ["off"],
773
+ "node/process-exit-as-throw": "error"
980
774
  }
981
775
  }
982
776
  ];
983
777
  }
984
778
 
985
- // src/configs/jsonc.ts
779
+ // src/configs/nuxt.ts
986
780
  init_esm_shims();
987
- async function jsonc(options = {}) {
988
- const {
989
- files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
990
- overrides = {},
991
- stylistic: stylistic2 = true
992
- } = options;
993
- const {
994
- indent = 2
995
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
996
- const [
997
- pluginJsonc,
998
- parserJsonc
999
- ] = await Promise.all([
1000
- interopDefault(import("eslint-plugin-jsonc")),
1001
- interopDefault(import("jsonc-eslint-parser"))
1002
- ]);
1003
- return [
1004
- {
1005
- name: "antfu/jsonc/setup",
1006
- plugins: {
1007
- jsonc: pluginJsonc
1008
- }
1009
- },
1010
- {
1011
- files,
1012
- languageOptions: {
1013
- parser: parserJsonc
1014
- },
1015
- name: "antfu/jsonc/rules",
1016
- rules: {
1017
- "jsonc/no-bigint-literals": "error",
1018
- "jsonc/no-binary-expression": "error",
1019
- "jsonc/no-binary-numeric-literals": "error",
1020
- "jsonc/no-dupe-keys": "error",
1021
- "jsonc/no-escape-sequence-in-identifier": "error",
1022
- "jsonc/no-floating-decimal": "error",
1023
- "jsonc/no-hexadecimal-numeric-literals": "error",
1024
- "jsonc/no-infinity": "error",
1025
- "jsonc/no-multi-str": "error",
1026
- "jsonc/no-nan": "error",
1027
- "jsonc/no-number-props": "error",
1028
- "jsonc/no-numeric-separators": "error",
1029
- "jsonc/no-octal": "error",
1030
- "jsonc/no-octal-escape": "error",
1031
- "jsonc/no-octal-numeric-literals": "error",
1032
- "jsonc/no-parenthesized": "error",
1033
- "jsonc/no-plus-sign": "error",
1034
- "jsonc/no-regexp-literals": "error",
1035
- "jsonc/no-sparse-arrays": "error",
1036
- "jsonc/no-template-literals": "error",
1037
- "jsonc/no-undefined-value": "error",
1038
- "jsonc/no-unicode-codepoint-escapes": "error",
1039
- "jsonc/no-useless-escape": "error",
1040
- "jsonc/space-unary-ops": "error",
1041
- "jsonc/valid-json-number": "error",
1042
- "jsonc/vue-custom-block/no-parsing-error": "error",
1043
- ...stylistic2 ? {
1044
- "jsonc/array-bracket-spacing": ["error", "never"],
1045
- "jsonc/comma-dangle": ["error", "never"],
1046
- "jsonc/comma-style": ["error", "last"],
1047
- "jsonc/indent": ["error", indent],
1048
- "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1049
- "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
1050
- "jsonc/object-curly-spacing": ["error", "always"],
1051
- "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1052
- "jsonc/quote-props": "error",
1053
- "jsonc/quotes": "error"
1054
- } : {},
1055
- ...overrides
1056
- }
781
+ import { createConfigForNuxt } from "@nuxt/eslint-config/flat";
782
+ function nuxt({ dirs, features = {} } = {}) {
783
+ return createConfigForNuxt({
784
+ dirs,
785
+ features: {
786
+ ...features,
787
+ standalone: false
1057
788
  }
1058
- ];
789
+ }).append({
790
+ name: "whoj/nuxt/rules",
791
+ rules: {}
792
+ }).toConfigs();
1059
793
  }
1060
794
 
1061
- // src/configs/jsx.ts
795
+ // src/configs/sort.ts
1062
796
  init_esm_shims();
1063
- async function jsx() {
797
+ async function sortPackageJson() {
1064
798
  return [
1065
799
  {
1066
- files: [GLOB_JSX, GLOB_TSX],
1067
- languageOptions: {
1068
- parserOptions: {
1069
- ecmaFeatures: {
1070
- jsx: true
800
+ files: ["**/package.json"],
801
+ name: "whoj/sort/package-json",
802
+ rules: {
803
+ "jsonc/sort-array-values": [
804
+ "error",
805
+ {
806
+ order: { type: "asc" },
807
+ pathPattern: "^files$"
1071
808
  }
1072
- }
1073
- },
1074
- name: "antfu/jsx/setup"
809
+ ],
810
+ "jsonc/sort-keys": [
811
+ "error",
812
+ {
813
+ order: [
814
+ "publisher",
815
+ "name",
816
+ "displayName",
817
+ "type",
818
+ "version",
819
+ "private",
820
+ "packageManager",
821
+ "description",
822
+ "author",
823
+ "contributors",
824
+ "license",
825
+ "funding",
826
+ "homepage",
827
+ "repository",
828
+ "bugs",
829
+ "keywords",
830
+ "categories",
831
+ "sideEffects",
832
+ "exports",
833
+ "main",
834
+ "module",
835
+ "unpkg",
836
+ "jsdelivr",
837
+ "types",
838
+ "typesVersions",
839
+ "bin",
840
+ "icon",
841
+ "files",
842
+ "engines",
843
+ "activationEvents",
844
+ "contributes",
845
+ "scripts",
846
+ "peerDependencies",
847
+ "peerDependenciesMeta",
848
+ "dependencies",
849
+ "optionalDependencies",
850
+ "devDependencies",
851
+ "pnpm",
852
+ "overrides",
853
+ "resolutions",
854
+ "husky",
855
+ "simple-git-hooks",
856
+ "lint-staged",
857
+ "eslintConfig"
858
+ ],
859
+ pathPattern: "^$"
860
+ },
861
+ {
862
+ order: { type: "asc" },
863
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
864
+ },
865
+ {
866
+ order: { type: "asc" },
867
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
868
+ },
869
+ {
870
+ order: [
871
+ "types",
872
+ "import",
873
+ "require",
874
+ "default"
875
+ ],
876
+ pathPattern: "^exports.*$"
877
+ },
878
+ {
879
+ order: [
880
+ // client hooks only
881
+ "pre-commit",
882
+ "prepare-commit-msg",
883
+ "commit-msg",
884
+ "post-commit",
885
+ "pre-rebase",
886
+ "post-rewrite",
887
+ "post-checkout",
888
+ "post-merge",
889
+ "pre-push",
890
+ "pre-auto-gc"
891
+ ],
892
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
893
+ }
894
+ ]
895
+ }
1075
896
  }
1076
897
  ];
1077
898
  }
1078
-
1079
- // src/configs/markdown.ts
1080
- init_esm_shims();
1081
- import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
1082
- async function markdown(options = {}) {
1083
- const {
1084
- componentExts = [],
1085
- files = [GLOB_MARKDOWN],
1086
- overrides = {}
1087
- } = options;
1088
- const markdown2 = await interopDefault(import("@eslint/markdown"));
899
+ function sortTsconfig() {
1089
900
  return [
1090
901
  {
1091
- name: "antfu/markdown/setup",
1092
- plugins: {
1093
- markdown: markdown2
1094
- }
1095
- },
1096
- {
1097
- files,
1098
- ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1099
- name: "antfu/markdown/processor",
1100
- // `eslint-plugin-markdown` only creates virtual files for code blocks,
1101
- // but not the markdown file itself. We use `eslint-merge-processors` to
1102
- // add a pass-through processor for the markdown file itself.
1103
- processor: mergeProcessors([
1104
- markdown2.processors.markdown,
1105
- processorPassThrough
1106
- ])
1107
- },
1108
- {
1109
- files,
1110
- languageOptions: {
1111
- parser: parserPlain
1112
- },
1113
- name: "antfu/markdown/parser"
1114
- },
1115
- {
1116
- files: [
1117
- GLOB_MARKDOWN_CODE,
1118
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
1119
- ],
1120
- languageOptions: {
1121
- parserOptions: {
1122
- ecmaFeatures: {
1123
- impliedStrict: true
1124
- }
1125
- }
1126
- },
1127
- name: "antfu/markdown/disables",
902
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
903
+ name: "whoj/sort/tsconfig-json",
1128
904
  rules: {
1129
- "antfu/no-top-level-await": "off",
1130
- "import/newline-after-import": "off",
1131
- "no-alert": "off",
1132
- "no-console": "off",
1133
- "no-labels": "off",
1134
- "no-lone-blocks": "off",
1135
- "no-restricted-syntax": "off",
1136
- "no-undef": "off",
1137
- "no-unused-expressions": "off",
1138
- "no-unused-labels": "off",
1139
- "no-unused-vars": "off",
1140
- "node/prefer-global/process": "off",
1141
- "style/comma-dangle": "off",
1142
- "style/eol-last": "off",
1143
- "ts/consistent-type-imports": "off",
1144
- "ts/explicit-function-return-type": "off",
1145
- "ts/no-namespace": "off",
1146
- "ts/no-redeclare": "off",
1147
- "ts/no-require-imports": "off",
1148
- "ts/no-unused-expressions": "off",
1149
- "ts/no-unused-vars": "off",
1150
- "ts/no-use-before-define": "off",
1151
- "unicode-bom": "off",
1152
- "unused-imports/no-unused-imports": "off",
1153
- "unused-imports/no-unused-vars": "off",
1154
- ...overrides
905
+ "jsonc/sort-keys": [
906
+ "error",
907
+ {
908
+ order: [
909
+ "extends",
910
+ "compilerOptions",
911
+ "references",
912
+ "files",
913
+ "include",
914
+ "exclude"
915
+ ],
916
+ pathPattern: "^$"
917
+ },
918
+ {
919
+ order: [
920
+ /* Projects */
921
+ "incremental",
922
+ "composite",
923
+ "tsBuildInfoFile",
924
+ "disableSourceOfProjectReferenceRedirect",
925
+ "disableSolutionSearching",
926
+ "disableReferencedProjectLoad",
927
+ /* Language and Environment */
928
+ "target",
929
+ "jsx",
930
+ "jsxFactory",
931
+ "jsxFragmentFactory",
932
+ "jsxImportSource",
933
+ "lib",
934
+ "moduleDetection",
935
+ "noLib",
936
+ "reactNamespace",
937
+ "useDefineForClassFields",
938
+ "emitDecoratorMetadata",
939
+ "experimentalDecorators",
940
+ /* Modules */
941
+ "baseUrl",
942
+ "rootDir",
943
+ "rootDirs",
944
+ "customConditions",
945
+ "module",
946
+ "moduleResolution",
947
+ "moduleSuffixes",
948
+ "noResolve",
949
+ "paths",
950
+ "resolveJsonModule",
951
+ "resolvePackageJsonExports",
952
+ "resolvePackageJsonImports",
953
+ "typeRoots",
954
+ "types",
955
+ "allowArbitraryExtensions",
956
+ "allowImportingTsExtensions",
957
+ "allowUmdGlobalAccess",
958
+ /* JavaScript Support */
959
+ "allowJs",
960
+ "checkJs",
961
+ "maxNodeModuleJsDepth",
962
+ /* Type Checking */
963
+ "strict",
964
+ "strictBindCallApply",
965
+ "strictFunctionTypes",
966
+ "strictNullChecks",
967
+ "strictPropertyInitialization",
968
+ "allowUnreachableCode",
969
+ "allowUnusedLabels",
970
+ "alwaysStrict",
971
+ "exactOptionalPropertyTypes",
972
+ "noFallthroughCasesInSwitch",
973
+ "noImplicitAny",
974
+ "noImplicitOverride",
975
+ "noImplicitReturns",
976
+ "noImplicitThis",
977
+ "noPropertyAccessFromIndexSignature",
978
+ "noUncheckedIndexedAccess",
979
+ "noUnusedLocals",
980
+ "noUnusedParameters",
981
+ "useUnknownInCatchVariables",
982
+ /* Emit */
983
+ "declaration",
984
+ "declarationDir",
985
+ "declarationMap",
986
+ "downlevelIteration",
987
+ "emitBOM",
988
+ "emitDeclarationOnly",
989
+ "importHelpers",
990
+ "importsNotUsedAsValues",
991
+ "inlineSourceMap",
992
+ "inlineSources",
993
+ "mapRoot",
994
+ "newLine",
995
+ "noEmit",
996
+ "noEmitHelpers",
997
+ "noEmitOnError",
998
+ "outDir",
999
+ "outFile",
1000
+ "preserveConstEnums",
1001
+ "preserveValueImports",
1002
+ "removeComments",
1003
+ "sourceMap",
1004
+ "sourceRoot",
1005
+ "stripInternal",
1006
+ /* Interop Constraints */
1007
+ "allowSyntheticDefaultImports",
1008
+ "esModuleInterop",
1009
+ "forceConsistentCasingInFileNames",
1010
+ "isolatedDeclarations",
1011
+ "isolatedModules",
1012
+ "preserveSymlinks",
1013
+ "verbatimModuleSyntax",
1014
+ /* Completeness */
1015
+ "skipDefaultLibCheck",
1016
+ "skipLibCheck"
1017
+ ],
1018
+ pathPattern: "^compilerOptions$"
1019
+ }
1020
+ ]
1155
1021
  }
1156
1022
  }
1157
1023
  ];
1158
1024
  }
1159
1025
 
1160
- // src/configs/node.ts
1026
+ // src/configs/test.ts
1161
1027
  init_esm_shims();
1162
- async function node() {
1028
+ var _pluginTest;
1029
+ async function test(options = {}) {
1030
+ const {
1031
+ files = GLOB_TESTS,
1032
+ isInEditor = false,
1033
+ overrides = {}
1034
+ } = options;
1035
+ const [
1036
+ pluginVitest,
1037
+ pluginNoOnlyTests
1038
+ ] = await Promise.all([
1039
+ interopDefault(import("@vitest/eslint-plugin")),
1040
+ // @ts-expect-error missing types
1041
+ interopDefault(import("eslint-plugin-no-only-tests"))
1042
+ ]);
1043
+ _pluginTest = _pluginTest || {
1044
+ ...pluginVitest,
1045
+ rules: {
1046
+ ...pluginVitest.rules,
1047
+ // extend `test/no-only-tests` rule
1048
+ ...pluginNoOnlyTests.rules
1049
+ }
1050
+ };
1163
1051
  return [
1164
1052
  {
1165
- name: "antfu/node/rules",
1053
+ name: "whoj/test/setup",
1166
1054
  plugins: {
1167
- node: default4
1168
- },
1169
- rules: {
1170
- "node/handle-callback-err": ["error", "^(err|error)$"],
1171
- "node/no-deprecated-api": "error",
1172
- "node/no-exports-assign": "error",
1173
- "node/no-new-require": "error",
1174
- "node/no-path-concat": "error",
1175
- "node/prefer-global/buffer": ["error", "never"],
1176
- "node/prefer-global/process": ["error", "never"],
1177
- "node/process-exit-as-throw": "error"
1055
+ test: _pluginTest
1178
1056
  }
1179
- }
1180
- ];
1181
- }
1182
-
1183
- // src/configs/perfectionist.ts
1184
- init_esm_shims();
1185
- async function perfectionist() {
1186
- return [
1057
+ },
1187
1058
  {
1188
- name: "antfu/perfectionist/setup",
1189
- plugins: {
1190
- perfectionist: default5
1191
- },
1059
+ files,
1060
+ name: "whoj/test/rules",
1192
1061
  rules: {
1193
- "perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
1194
- "perfectionist/sort-imports": ["error", {
1195
- groups: [
1196
- "type",
1197
- ["parent-type", "sibling-type", "index-type", "internal-type"],
1198
- "builtin",
1199
- "external",
1200
- "internal",
1201
- ["parent", "sibling", "index"],
1202
- "side-effect",
1203
- "object",
1204
- "unknown"
1205
- ],
1206
- newlinesBetween: "ignore",
1207
- order: "asc",
1208
- type: "natural"
1209
- }],
1210
- "perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
1211
- "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
1062
+ "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1063
+ "test/no-identical-title": "error",
1064
+ "test/no-import-node-test": "error",
1065
+ "test/no-only-tests": isInEditor ? "warn" : "error",
1066
+ "test/prefer-hooks-in-order": "error",
1067
+ "test/prefer-lowercase-title": "error",
1068
+ // Disables
1069
+ ...{
1070
+ "no-unused-expressions": "off",
1071
+ "node/prefer-global/process": "off",
1072
+ "ts/explicit-function-return-type": "off",
1073
+ "whoj/no-top-level-await": "off"
1074
+ },
1075
+ ...overrides
1212
1076
  }
1213
1077
  }
1214
1078
  ];
1215
1079
  }
1216
1080
 
1217
- // src/configs/react.ts
1081
+ // src/configs/toml.ts
1218
1082
  init_esm_shims();
1219
- import { isPackageExists as isPackageExists3 } from "local-pkg";
1220
- var ReactRefreshAllowConstantExportPackages = [
1221
- "vite"
1222
- ];
1223
- var RemixPackages = [
1224
- "@remix-run/node",
1225
- "@remix-run/react",
1226
- "@remix-run/serve",
1227
- "@remix-run/dev"
1228
- ];
1229
- var ReactRouterPackages = [
1230
- "@react-router/node",
1231
- "@react-router/react",
1232
- "@react-router/serve",
1233
- "@react-router/dev"
1234
- ];
1235
- var NextJsPackages = [
1236
- "next"
1237
- ];
1238
- async function react(options = {}) {
1083
+ async function toml(options = {}) {
1239
1084
  const {
1240
- files = [GLOB_SRC],
1241
- filesTypeAware = [GLOB_TS, GLOB_TSX],
1242
- ignoresTypeAware = [
1243
- `${GLOB_MARKDOWN}/**`,
1244
- GLOB_ASTRO_TS
1245
- ],
1085
+ files = [GLOB_TOML],
1246
1086
  overrides = {},
1247
- tsconfigPath
1087
+ stylistic: stylistic2 = true
1248
1088
  } = options;
1249
- await ensurePackages([
1250
- "@eslint-react/eslint-plugin",
1251
- "eslint-plugin-react-hooks",
1252
- "eslint-plugin-react-refresh"
1253
- ]);
1254
- const isTypeAware = !!tsconfigPath;
1255
- const typeAwareRules = {
1256
- "react/no-leaked-conditional-rendering": "warn"
1257
- };
1089
+ const {
1090
+ indent = 2
1091
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1258
1092
  const [
1259
- pluginReact,
1260
- pluginReactHooks,
1261
- pluginReactRefresh
1093
+ pluginToml,
1094
+ parserToml
1262
1095
  ] = await Promise.all([
1263
- interopDefault(import("./dist-BE4MFJS4.js")),
1264
- interopDefault(import("./eslint-plugin-react-hooks-BV2CYKDG.js")),
1265
- interopDefault(import("./eslint-plugin-react-refresh-N5P3A37Z.js"))
1096
+ interopDefault(import("eslint-plugin-toml")),
1097
+ interopDefault(import("toml-eslint-parser"))
1266
1098
  ]);
1267
- const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists3(i));
1268
- const isUsingRemix = RemixPackages.some((i) => isPackageExists3(i));
1269
- const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists3(i));
1270
- const isUsingNext = NextJsPackages.some((i) => isPackageExists3(i));
1271
- const plugins = pluginReact.configs.all.plugins;
1272
1099
  return [
1273
1100
  {
1274
- name: "antfu/react/setup",
1101
+ name: "whoj/toml/setup",
1275
1102
  plugins: {
1276
- "react": plugins["@eslint-react"],
1277
- "react-dom": plugins["@eslint-react/dom"],
1278
- "react-hooks": pluginReactHooks,
1279
- "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1280
- "react-naming-convention": plugins["@eslint-react/naming-convention"],
1281
- "react-refresh": pluginReactRefresh,
1282
- "react-web-api": plugins["@eslint-react/web-api"]
1103
+ toml: pluginToml
1283
1104
  }
1284
1105
  },
1285
1106
  {
1286
1107
  files,
1287
1108
  languageOptions: {
1288
- parserOptions: {
1289
- ecmaFeatures: {
1290
- jsx: true
1291
- }
1292
- },
1293
- sourceType: "module"
1109
+ parser: parserToml
1294
1110
  },
1295
- name: "antfu/react/rules",
1111
+ name: "whoj/toml/rules",
1296
1112
  rules: {
1297
- // recommended rules from @eslint-react/dom
1298
- "react-dom/no-children-in-void-dom-elements": "warn",
1299
- "react-dom/no-dangerously-set-innerhtml": "warn",
1300
- "react-dom/no-dangerously-set-innerhtml-with-children": "error",
1301
- "react-dom/no-find-dom-node": "error",
1302
- "react-dom/no-missing-button-type": "warn",
1303
- "react-dom/no-missing-iframe-sandbox": "warn",
1304
- "react-dom/no-namespace": "error",
1305
- "react-dom/no-render-return-value": "error",
1306
- "react-dom/no-script-url": "warn",
1307
- "react-dom/no-unsafe-iframe-sandbox": "warn",
1308
- "react-dom/no-unsafe-target-blank": "warn",
1309
- // recommended rules react-hooks
1310
- "react-hooks/exhaustive-deps": "warn",
1311
- "react-hooks/rules-of-hooks": "error",
1312
- // react refresh
1313
- "react-refresh/only-export-components": [
1314
- "warn",
1315
- {
1316
- allowConstantExport: isAllowConstantExport,
1317
- allowExportNames: [
1318
- ...isUsingNext ? [
1319
- "dynamic",
1320
- "dynamicParams",
1321
- "revalidate",
1322
- "fetchCache",
1323
- "runtime",
1324
- "preferredRegion",
1325
- "maxDuration",
1326
- "config",
1327
- "generateStaticParams",
1328
- "metadata",
1329
- "generateMetadata",
1330
- "viewport",
1331
- "generateViewport"
1332
- ] : [],
1333
- ...isUsingRemix || isUsingReactRouter ? [
1334
- "meta",
1335
- "links",
1336
- "headers",
1337
- "loader",
1338
- "action"
1339
- ] : []
1340
- ]
1341
- }
1342
- ],
1343
- // recommended rules from @eslint-react/web-api
1344
- "react-web-api/no-leaked-event-listener": "warn",
1345
- "react-web-api/no-leaked-interval": "warn",
1346
- "react-web-api/no-leaked-resize-observer": "warn",
1347
- "react-web-api/no-leaked-timeout": "warn",
1348
- // recommended rules from @eslint-react
1349
- "react/ensure-forward-ref-using-ref": "warn",
1350
- "react/jsx-no-duplicate-props": "warn",
1351
- "react/jsx-uses-vars": "warn",
1352
- "react/no-access-state-in-setstate": "error",
1353
- "react/no-array-index-key": "warn",
1354
- "react/no-children-count": "warn",
1355
- "react/no-children-for-each": "warn",
1356
- "react/no-children-map": "warn",
1357
- "react/no-children-only": "warn",
1358
- "react/no-children-to-array": "warn",
1359
- "react/no-clone-element": "warn",
1360
- "react/no-comment-textnodes": "warn",
1361
- "react/no-component-will-mount": "error",
1362
- "react/no-component-will-receive-props": "error",
1363
- "react/no-component-will-update": "error",
1364
- "react/no-context-provider": "warn",
1365
- "react/no-create-ref": "error",
1366
- "react/no-default-props": "error",
1367
- "react/no-direct-mutation-state": "error",
1368
- "react/no-duplicate-key": "error",
1369
- "react/no-forward-ref": "warn",
1370
- "react/no-implicit-key": "warn",
1371
- "react/no-missing-key": "error",
1372
- "react/no-nested-components": "error",
1373
- "react/no-prop-types": "error",
1374
- "react/no-redundant-should-component-update": "error",
1375
- "react/no-set-state-in-component-did-mount": "warn",
1376
- "react/no-set-state-in-component-did-update": "warn",
1377
- "react/no-set-state-in-component-will-update": "warn",
1378
- "react/no-string-refs": "error",
1379
- "react/no-unsafe-component-will-mount": "warn",
1380
- "react/no-unsafe-component-will-receive-props": "warn",
1381
- "react/no-unsafe-component-will-update": "warn",
1382
- "react/no-unstable-context-value": "warn",
1383
- "react/no-unstable-default-props": "warn",
1384
- "react/no-unused-class-component-members": "warn",
1385
- "react/no-unused-state": "warn",
1386
- "react/prefer-destructuring-assignment": "warn",
1387
- "react/prefer-shorthand-boolean": "warn",
1388
- "react/prefer-shorthand-fragment": "warn",
1389
- // overrides
1113
+ "style/spaced-comment": "off",
1114
+ "toml/comma-style": "error",
1115
+ "toml/keys-order": "error",
1116
+ "toml/no-space-dots": "error",
1117
+ "toml/no-unreadable-number-separator": "error",
1118
+ "toml/precision-of-fractional-seconds": "error",
1119
+ "toml/precision-of-integer": "error",
1120
+ "toml/tables-order": "error",
1121
+ "toml/vue-custom-block/no-parsing-error": "error",
1122
+ ...stylistic2 ? {
1123
+ "toml/array-bracket-newline": "error",
1124
+ "toml/array-bracket-spacing": "error",
1125
+ "toml/array-element-newline": "error",
1126
+ "toml/indent": ["error", indent === "tab" ? 2 : indent],
1127
+ "toml/inline-table-curly-spacing": "error",
1128
+ "toml/key-spacing": "error",
1129
+ "toml/padding-line-between-pairs": "error",
1130
+ "toml/padding-line-between-tables": "error",
1131
+ "toml/quoted-keys": "error",
1132
+ "toml/spaced-comment": "error",
1133
+ "toml/table-bracket-spacing": "error"
1134
+ } : {},
1390
1135
  ...overrides
1391
1136
  }
1392
- },
1393
- ...isTypeAware ? [{
1394
- files: filesTypeAware,
1395
- ignores: ignoresTypeAware,
1396
- name: "antfu/react/type-aware-rules",
1397
- rules: {
1398
- ...typeAwareRules
1399
- }
1400
- }] : []
1137
+ }
1401
1138
  ];
1402
1139
  }
1403
1140
 
1404
- // src/configs/regexp.ts
1141
+ // src/configs/yaml.ts
1405
1142
  init_esm_shims();
1406
- import { configs } from "eslint-plugin-regexp";
1407
- async function regexp(options = {}) {
1408
- const config = configs["flat/recommended"];
1409
- const rules = {
1410
- ...config.rules
1411
- };
1412
- if (options.level === "warn") {
1413
- for (const key in rules) {
1414
- if (rules[key] === "error")
1415
- rules[key] = "warn";
1416
- }
1417
- }
1143
+ async function yaml(options = {}) {
1144
+ const {
1145
+ files = [GLOB_YAML],
1146
+ overrides = {},
1147
+ stylistic: stylistic2 = true
1148
+ } = options;
1149
+ const {
1150
+ indent = 2,
1151
+ quotes = "single"
1152
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1153
+ const [
1154
+ pluginYaml,
1155
+ parserYaml
1156
+ ] = await Promise.all([
1157
+ interopDefault(import("eslint-plugin-yml")),
1158
+ interopDefault(import("yaml-eslint-parser"))
1159
+ ]);
1418
1160
  return [
1419
1161
  {
1420
- ...config,
1421
- name: "antfu/regexp/rules",
1162
+ name: "whoj/yaml/setup",
1163
+ plugins: {
1164
+ yaml: pluginYaml
1165
+ }
1166
+ },
1167
+ {
1168
+ files,
1169
+ languageOptions: {
1170
+ parser: parserYaml
1171
+ },
1172
+ name: "whoj/yaml/rules",
1422
1173
  rules: {
1423
- ...rules,
1424
- ...options.overrides
1174
+ "style/spaced-comment": "off",
1175
+ "yaml/block-mapping": "error",
1176
+ "yaml/block-sequence": "error",
1177
+ "yaml/no-empty-key": "error",
1178
+ "yaml/no-empty-sequence-entry": "error",
1179
+ "yaml/no-irregular-whitespace": "error",
1180
+ "yaml/plain-scalar": "error",
1181
+ "yaml/vue-custom-block/no-parsing-error": "error",
1182
+ ...stylistic2 ? {
1183
+ "yaml/block-mapping-question-indicator-newline": "error",
1184
+ "yaml/block-sequence-hyphen-indicator-newline": "error",
1185
+ "yaml/flow-mapping-curly-newline": "error",
1186
+ "yaml/flow-mapping-curly-spacing": "error",
1187
+ "yaml/flow-sequence-bracket-newline": "error",
1188
+ "yaml/flow-sequence-bracket-spacing": "error",
1189
+ "yaml/indent": ["error", indent === "tab" ? 2 : indent],
1190
+ "yaml/key-spacing": "error",
1191
+ "yaml/no-tab-indent": "error",
1192
+ "yaml/quotes": ["error", { avoidEscape: true, prefer: quotes === "backtick" ? "single" : quotes }],
1193
+ "yaml/spaced-comment": "error"
1194
+ } : {},
1195
+ ...overrides
1425
1196
  }
1426
1197
  }
1427
1198
  ];
1428
1199
  }
1429
1200
 
1430
- // src/configs/solid.ts
1201
+ // src/configs/astro.ts
1431
1202
  init_esm_shims();
1432
- async function solid(options = {}) {
1203
+ async function astro(options = {}) {
1433
1204
  const {
1434
- files = [GLOB_JSX, GLOB_TSX],
1205
+ files = [GLOB_ASTRO],
1435
1206
  overrides = {},
1436
- typescript: typescript2 = true
1207
+ stylistic: stylistic2 = true
1437
1208
  } = options;
1438
- await ensurePackages([
1439
- "eslint-plugin-solid"
1440
- ]);
1441
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1442
- const isTypeAware = !!tsconfigPath;
1443
1209
  const [
1444
- pluginSolid,
1210
+ pluginAstro,
1211
+ parserAstro,
1445
1212
  parserTs
1446
1213
  ] = await Promise.all([
1447
- interopDefault(import("./dist-MYXPM6TG.js")),
1214
+ interopDefault(import("./lib-FENTQ4WJ.js")),
1215
+ interopDefault(import("./lib-WKUBBNE4.js")),
1448
1216
  interopDefault(import("@typescript-eslint/parser"))
1449
1217
  ]);
1450
1218
  return [
1451
1219
  {
1452
- name: "antfu/solid/setup",
1220
+ name: "whoj/astro/setup",
1453
1221
  plugins: {
1454
- solid: pluginSolid
1222
+ astro: pluginAstro
1455
1223
  }
1456
1224
  },
1457
1225
  {
1458
1226
  files,
1459
1227
  languageOptions: {
1460
- parser: parserTs,
1228
+ globals: pluginAstro.environments.astro.globals,
1229
+ parser: parserAstro,
1461
1230
  parserOptions: {
1462
- ecmaFeatures: {
1463
- jsx: true
1464
- },
1465
- ...isTypeAware ? { project: tsconfigPath } : {}
1231
+ extraFileExtensions: [".astro"],
1232
+ parser: parserTs
1466
1233
  },
1467
1234
  sourceType: "module"
1468
1235
  },
1469
- name: "antfu/solid/rules",
1236
+ name: "whoj/astro/rules",
1237
+ processor: "astro/client-side-ts",
1470
1238
  rules: {
1471
- // reactivity
1472
- "solid/components-return-once": "warn",
1473
- "solid/event-handlers": ["error", {
1474
- // if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
1475
- ignoreCase: false,
1476
- // if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
1477
- warnOnSpread: false
1478
- }],
1479
- // these rules are mostly style suggestions
1480
- "solid/imports": "error",
1481
- // identifier usage is important
1482
- "solid/jsx-no-duplicate-props": "error",
1483
- "solid/jsx-no-script-url": "error",
1484
- "solid/jsx-no-undef": "error",
1485
- "solid/jsx-uses-vars": "error",
1486
- "solid/no-destructure": "error",
1487
- // security problems
1488
- "solid/no-innerhtml": ["error", { allowStatic: true }],
1489
- "solid/no-react-deps": "error",
1490
- "solid/no-react-specific-props": "error",
1491
- "solid/no-unknown-namespaces": "error",
1492
- "solid/prefer-for": "error",
1493
- "solid/reactivity": "warn",
1494
- "solid/self-closing-comp": "error",
1495
- "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
1496
- ...typescript2 ? {
1497
- "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
1498
- "solid/no-unknown-namespaces": "off"
1499
- } : {},
1500
- // overrides
1501
- ...overrides
1502
- }
1503
- }
1504
- ];
1505
- }
1506
-
1507
- // src/configs/sort.ts
1508
- init_esm_shims();
1509
- async function sortPackageJson() {
1510
- return [
1239
+ // use recommended rules
1240
+ "astro/missing-client-only-directive-value": "error",
1241
+ "astro/no-conflict-set-directives": "error",
1242
+ "astro/no-deprecated-astro-canonicalurl": "error",
1243
+ "astro/no-deprecated-astro-fetchcontent": "error",
1244
+ "astro/no-deprecated-astro-resolve": "error",
1245
+ "astro/no-deprecated-getentrybyslug": "error",
1246
+ "astro/no-set-html-directive": "off",
1247
+ "astro/no-unused-define-vars-in-style": "error",
1248
+ "astro/semi": "off",
1249
+ "astro/valid-compile": "error",
1250
+ // Astro uses top level await for e.g. data fetching
1251
+ // https://docs.astro.build/en/guides/data-fetching/#fetch-in-astro
1252
+ "whoj/no-top-level-await": "off",
1253
+ ...stylistic2 ? {
1254
+ "style/indent": "off",
1255
+ "style/jsx-closing-tag-location": "off",
1256
+ "style/jsx-one-expression-per-line": "off",
1257
+ "style/no-multiple-empty-lines": "off"
1258
+ } : {},
1259
+ ...overrides
1260
+ }
1261
+ }
1262
+ ];
1263
+ }
1264
+
1265
+ // src/configs/jsdoc.ts
1266
+ init_esm_shims();
1267
+ async function jsdoc(options = {}) {
1268
+ const {
1269
+ stylistic: stylistic2 = true
1270
+ } = options;
1271
+ return [
1511
1272
  {
1512
- files: ["**/package.json"],
1513
- name: "antfu/sort/package-json",
1273
+ name: "whoj/jsdoc/rules",
1274
+ plugins: {
1275
+ jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
1276
+ },
1514
1277
  rules: {
1515
- "jsonc/sort-array-values": [
1516
- "error",
1517
- {
1518
- order: { type: "asc" },
1519
- pathPattern: "^files$"
1520
- }
1521
- ],
1522
- "jsonc/sort-keys": [
1523
- "error",
1524
- {
1525
- order: [
1526
- "publisher",
1527
- "name",
1528
- "displayName",
1529
- "type",
1530
- "version",
1531
- "private",
1532
- "packageManager",
1533
- "description",
1534
- "author",
1535
- "contributors",
1536
- "license",
1537
- "funding",
1538
- "homepage",
1539
- "repository",
1540
- "bugs",
1541
- "keywords",
1542
- "categories",
1543
- "sideEffects",
1544
- "exports",
1545
- "main",
1546
- "module",
1547
- "unpkg",
1548
- "jsdelivr",
1549
- "types",
1550
- "typesVersions",
1551
- "bin",
1552
- "icon",
1553
- "files",
1554
- "engines",
1555
- "activationEvents",
1556
- "contributes",
1557
- "scripts",
1558
- "peerDependencies",
1559
- "peerDependenciesMeta",
1560
- "dependencies",
1561
- "optionalDependencies",
1562
- "devDependencies",
1563
- "pnpm",
1564
- "overrides",
1565
- "resolutions",
1566
- "husky",
1567
- "simple-git-hooks",
1568
- "lint-staged",
1569
- "eslintConfig"
1570
- ],
1571
- pathPattern: "^$"
1572
- },
1573
- {
1574
- order: { type: "asc" },
1575
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
1576
- },
1577
- {
1578
- order: { type: "asc" },
1579
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1580
- },
1581
- {
1582
- order: [
1583
- "types",
1584
- "import",
1585
- "require",
1586
- "default"
1587
- ],
1588
- pathPattern: "^exports.*$"
1589
- },
1590
- {
1591
- order: [
1592
- // client hooks only
1593
- "pre-commit",
1594
- "prepare-commit-msg",
1595
- "commit-msg",
1596
- "post-commit",
1597
- "pre-rebase",
1598
- "post-rewrite",
1599
- "post-checkout",
1600
- "post-merge",
1601
- "pre-push",
1602
- "pre-auto-gc"
1603
- ],
1604
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1605
- }
1606
- ]
1278
+ "jsdoc/check-access": "warn",
1279
+ "jsdoc/check-param-names": "warn",
1280
+ "jsdoc/check-property-names": "warn",
1281
+ "jsdoc/check-types": "warn",
1282
+ "jsdoc/empty-tags": "warn",
1283
+ "jsdoc/implements-on-classes": "warn",
1284
+ "jsdoc/no-defaults": "warn",
1285
+ "jsdoc/no-multi-asterisks": "warn",
1286
+ "jsdoc/require-param-name": "warn",
1287
+ "jsdoc/require-property": "warn",
1288
+ "jsdoc/require-property-description": "warn",
1289
+ "jsdoc/require-property-name": "warn",
1290
+ "jsdoc/require-returns-check": "warn",
1291
+ "jsdoc/require-returns-description": "off",
1292
+ "jsdoc/require-yields-check": "warn",
1293
+ ...stylistic2 ? {
1294
+ "jsdoc/check-alignment": "warn",
1295
+ "jsdoc/multiline-blocks": "warn"
1296
+ } : {}
1607
1297
  }
1608
1298
  }
1609
1299
  ];
1610
1300
  }
1611
- function sortTsconfig() {
1301
+
1302
+ // src/configs/jsonc.ts
1303
+ init_esm_shims();
1304
+ async function jsonc(options = {}) {
1305
+ const {
1306
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1307
+ overrides = {},
1308
+ stylistic: stylistic2 = true
1309
+ } = options;
1310
+ const {
1311
+ indent = 2
1312
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1313
+ const [
1314
+ pluginJsonc,
1315
+ parserJsonc
1316
+ ] = await Promise.all([
1317
+ interopDefault(import("eslint-plugin-jsonc")),
1318
+ interopDefault(import("jsonc-eslint-parser"))
1319
+ ]);
1612
1320
  return [
1613
1321
  {
1614
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1615
- name: "antfu/sort/tsconfig-json",
1322
+ name: "whoj/jsonc/setup",
1323
+ plugins: {
1324
+ jsonc: pluginJsonc
1325
+ }
1326
+ },
1327
+ {
1328
+ files,
1329
+ languageOptions: {
1330
+ parser: parserJsonc
1331
+ },
1332
+ name: "whoj/jsonc/rules",
1616
1333
  rules: {
1617
- "jsonc/sort-keys": [
1618
- "error",
1619
- {
1620
- order: [
1621
- "extends",
1622
- "compilerOptions",
1623
- "references",
1624
- "files",
1625
- "include",
1626
- "exclude"
1627
- ],
1628
- pathPattern: "^$"
1629
- },
1630
- {
1631
- order: [
1632
- /* Projects */
1633
- "incremental",
1634
- "composite",
1635
- "tsBuildInfoFile",
1636
- "disableSourceOfProjectReferenceRedirect",
1637
- "disableSolutionSearching",
1638
- "disableReferencedProjectLoad",
1639
- /* Language and Environment */
1640
- "target",
1641
- "jsx",
1642
- "jsxFactory",
1643
- "jsxFragmentFactory",
1644
- "jsxImportSource",
1645
- "lib",
1646
- "moduleDetection",
1647
- "noLib",
1648
- "reactNamespace",
1649
- "useDefineForClassFields",
1650
- "emitDecoratorMetadata",
1651
- "experimentalDecorators",
1652
- /* Modules */
1653
- "baseUrl",
1654
- "rootDir",
1655
- "rootDirs",
1656
- "customConditions",
1657
- "module",
1658
- "moduleResolution",
1659
- "moduleSuffixes",
1660
- "noResolve",
1661
- "paths",
1662
- "resolveJsonModule",
1663
- "resolvePackageJsonExports",
1664
- "resolvePackageJsonImports",
1665
- "typeRoots",
1666
- "types",
1667
- "allowArbitraryExtensions",
1668
- "allowImportingTsExtensions",
1669
- "allowUmdGlobalAccess",
1670
- /* JavaScript Support */
1671
- "allowJs",
1672
- "checkJs",
1673
- "maxNodeModuleJsDepth",
1674
- /* Type Checking */
1675
- "strict",
1676
- "strictBindCallApply",
1677
- "strictFunctionTypes",
1678
- "strictNullChecks",
1679
- "strictPropertyInitialization",
1680
- "allowUnreachableCode",
1681
- "allowUnusedLabels",
1682
- "alwaysStrict",
1683
- "exactOptionalPropertyTypes",
1684
- "noFallthroughCasesInSwitch",
1685
- "noImplicitAny",
1686
- "noImplicitOverride",
1687
- "noImplicitReturns",
1688
- "noImplicitThis",
1689
- "noPropertyAccessFromIndexSignature",
1690
- "noUncheckedIndexedAccess",
1691
- "noUnusedLocals",
1692
- "noUnusedParameters",
1693
- "useUnknownInCatchVariables",
1694
- /* Emit */
1695
- "declaration",
1696
- "declarationDir",
1697
- "declarationMap",
1698
- "downlevelIteration",
1699
- "emitBOM",
1700
- "emitDeclarationOnly",
1701
- "importHelpers",
1702
- "importsNotUsedAsValues",
1703
- "inlineSourceMap",
1704
- "inlineSources",
1705
- "mapRoot",
1706
- "newLine",
1707
- "noEmit",
1708
- "noEmitHelpers",
1709
- "noEmitOnError",
1710
- "outDir",
1711
- "outFile",
1712
- "preserveConstEnums",
1713
- "preserveValueImports",
1714
- "removeComments",
1715
- "sourceMap",
1716
- "sourceRoot",
1717
- "stripInternal",
1718
- /* Interop Constraints */
1719
- "allowSyntheticDefaultImports",
1720
- "esModuleInterop",
1721
- "forceConsistentCasingInFileNames",
1722
- "isolatedDeclarations",
1723
- "isolatedModules",
1724
- "preserveSymlinks",
1725
- "verbatimModuleSyntax",
1726
- /* Completeness */
1727
- "skipDefaultLibCheck",
1728
- "skipLibCheck"
1729
- ],
1730
- pathPattern: "^compilerOptions$"
1334
+ "jsonc/no-bigint-literals": "error",
1335
+ "jsonc/no-binary-expression": "error",
1336
+ "jsonc/no-binary-numeric-literals": "error",
1337
+ "jsonc/no-dupe-keys": "error",
1338
+ "jsonc/no-escape-sequence-in-identifier": "error",
1339
+ "jsonc/no-floating-decimal": "error",
1340
+ "jsonc/no-hexadecimal-numeric-literals": "error",
1341
+ "jsonc/no-infinity": "error",
1342
+ "jsonc/no-multi-str": "error",
1343
+ "jsonc/no-nan": "error",
1344
+ "jsonc/no-number-props": "error",
1345
+ "jsonc/no-numeric-separators": "error",
1346
+ "jsonc/no-octal": "error",
1347
+ "jsonc/no-octal-escape": "error",
1348
+ "jsonc/no-octal-numeric-literals": "error",
1349
+ "jsonc/no-parenthesized": "error",
1350
+ "jsonc/no-plus-sign": "error",
1351
+ "jsonc/no-regexp-literals": "error",
1352
+ "jsonc/no-sparse-arrays": "error",
1353
+ "jsonc/no-template-literals": "error",
1354
+ "jsonc/no-undefined-value": "error",
1355
+ "jsonc/no-unicode-codepoint-escapes": "error",
1356
+ "jsonc/no-useless-escape": "error",
1357
+ "jsonc/space-unary-ops": "error",
1358
+ "jsonc/valid-json-number": "error",
1359
+ "jsonc/vue-custom-block/no-parsing-error": "error",
1360
+ ...stylistic2 ? {
1361
+ "jsonc/array-bracket-spacing": ["error", "never"],
1362
+ "jsonc/comma-dangle": ["error", "never"],
1363
+ "jsonc/comma-style": ["error", "last"],
1364
+ "jsonc/indent": ["error", indent],
1365
+ "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1366
+ "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
1367
+ "jsonc/object-curly-spacing": ["error", "always"],
1368
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1369
+ "jsonc/quote-props": "error",
1370
+ "jsonc/quotes": "error"
1371
+ } : {},
1372
+ ...overrides
1373
+ }
1374
+ }
1375
+ ];
1376
+ }
1377
+
1378
+ // src/configs/react.ts
1379
+ init_esm_shims();
1380
+ import { isPackageExists as isPackageExists3 } from "local-pkg";
1381
+ var ReactRefreshAllowConstantExportPackages = [
1382
+ "vite"
1383
+ ];
1384
+ var RemixPackages = [
1385
+ "@remix-run/node",
1386
+ "@remix-run/react",
1387
+ "@remix-run/serve",
1388
+ "@remix-run/dev"
1389
+ ];
1390
+ var ReactRouterPackages = [
1391
+ "@react-router/node",
1392
+ "@react-router/react",
1393
+ "@react-router/serve",
1394
+ "@react-router/dev"
1395
+ ];
1396
+ var NextJsPackages = [
1397
+ "next"
1398
+ ];
1399
+ async function react(options = {}) {
1400
+ const {
1401
+ files = [GLOB_SRC],
1402
+ filesTypeAware = [GLOB_TS, GLOB_TSX],
1403
+ ignoresTypeAware = [
1404
+ `${GLOB_MARKDOWN}/**`,
1405
+ GLOB_ASTRO_TS
1406
+ ],
1407
+ overrides = {},
1408
+ tsconfigPath
1409
+ } = options;
1410
+ await ensurePackages([
1411
+ "@eslint-react/eslint-plugin",
1412
+ "eslint-plugin-react-hooks",
1413
+ "eslint-plugin-react-refresh"
1414
+ ]);
1415
+ const isTypeAware = !!tsconfigPath;
1416
+ const typeAwareRules = {
1417
+ "react/no-leaked-conditional-rendering": "warn"
1418
+ };
1419
+ const [
1420
+ pluginReact,
1421
+ pluginReactHooks,
1422
+ pluginReactRefresh
1423
+ ] = await Promise.all([
1424
+ interopDefault(import("./dist-ZJ2E2ITJ.js")),
1425
+ interopDefault(import("./eslint-plugin-react-hooks-BV2CYKDG.js")),
1426
+ interopDefault(import("./eslint-plugin-react-refresh-N5P3A37Z.js"))
1427
+ ]);
1428
+ const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists3(i));
1429
+ const isUsingRemix = RemixPackages.some((i) => isPackageExists3(i));
1430
+ const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists3(i));
1431
+ const isUsingNext = NextJsPackages.some((i) => isPackageExists3(i));
1432
+ const plugins = pluginReact.configs.all.plugins;
1433
+ return [
1434
+ {
1435
+ name: "whoj/react/setup",
1436
+ plugins: {
1437
+ "react": plugins["@eslint-react"],
1438
+ "react-dom": plugins["@eslint-react/dom"],
1439
+ "react-hooks": pluginReactHooks,
1440
+ "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1441
+ "react-naming-convention": plugins["@eslint-react/naming-convention"],
1442
+ "react-refresh": pluginReactRefresh,
1443
+ "react-web-api": plugins["@eslint-react/web-api"]
1444
+ }
1445
+ },
1446
+ {
1447
+ files,
1448
+ languageOptions: {
1449
+ parserOptions: {
1450
+ ecmaFeatures: {
1451
+ jsx: true
1731
1452
  }
1732
- ]
1453
+ },
1454
+ sourceType: "module"
1455
+ },
1456
+ name: "whoj/react/rules",
1457
+ rules: {
1458
+ // recommended rules from @eslint-react/dom
1459
+ "react-dom/no-children-in-void-dom-elements": "warn",
1460
+ "react-dom/no-dangerously-set-innerhtml": "warn",
1461
+ "react-dom/no-dangerously-set-innerhtml-with-children": "error",
1462
+ "react-dom/no-find-dom-node": "error",
1463
+ "react-dom/no-missing-button-type": "warn",
1464
+ "react-dom/no-missing-iframe-sandbox": "warn",
1465
+ "react-dom/no-namespace": "error",
1466
+ "react-dom/no-render-return-value": "error",
1467
+ "react-dom/no-script-url": "warn",
1468
+ "react-dom/no-unsafe-iframe-sandbox": "warn",
1469
+ "react-dom/no-unsafe-target-blank": "warn",
1470
+ // recommended rules react-hooks
1471
+ "react-hooks/exhaustive-deps": "warn",
1472
+ "react-hooks/rules-of-hooks": "error",
1473
+ // react refresh
1474
+ "react-refresh/only-export-components": [
1475
+ "warn",
1476
+ {
1477
+ allowConstantExport: isAllowConstantExport,
1478
+ allowExportNames: [
1479
+ ...isUsingNext ? [
1480
+ "dynamic",
1481
+ "dynamicParams",
1482
+ "revalidate",
1483
+ "fetchCache",
1484
+ "runtime",
1485
+ "preferredRegion",
1486
+ "maxDuration",
1487
+ "config",
1488
+ "generateStaticParams",
1489
+ "metadata",
1490
+ "generateMetadata",
1491
+ "viewport",
1492
+ "generateViewport"
1493
+ ] : [],
1494
+ ...isUsingRemix || isUsingReactRouter ? [
1495
+ "meta",
1496
+ "links",
1497
+ "headers",
1498
+ "loader",
1499
+ "action"
1500
+ ] : []
1501
+ ]
1502
+ }
1503
+ ],
1504
+ // recommended rules from @eslint-react/web-api
1505
+ "react-web-api/no-leaked-event-listener": "warn",
1506
+ "react-web-api/no-leaked-interval": "warn",
1507
+ "react-web-api/no-leaked-resize-observer": "warn",
1508
+ "react-web-api/no-leaked-timeout": "warn",
1509
+ // recommended rules from @eslint-react
1510
+ "react/ensure-forward-ref-using-ref": "warn",
1511
+ "react/jsx-no-duplicate-props": "warn",
1512
+ "react/jsx-uses-vars": "warn",
1513
+ "react/no-access-state-in-setstate": "error",
1514
+ "react/no-array-index-key": "warn",
1515
+ "react/no-children-count": "warn",
1516
+ "react/no-children-for-each": "warn",
1517
+ "react/no-children-map": "warn",
1518
+ "react/no-children-only": "warn",
1519
+ "react/no-children-to-array": "warn",
1520
+ "react/no-clone-element": "warn",
1521
+ "react/no-comment-textnodes": "warn",
1522
+ "react/no-component-will-mount": "error",
1523
+ "react/no-component-will-receive-props": "error",
1524
+ "react/no-component-will-update": "error",
1525
+ "react/no-context-provider": "warn",
1526
+ "react/no-create-ref": "error",
1527
+ "react/no-default-props": "error",
1528
+ "react/no-direct-mutation-state": "error",
1529
+ "react/no-duplicate-key": "error",
1530
+ "react/no-forward-ref": "warn",
1531
+ "react/no-implicit-key": "warn",
1532
+ "react/no-missing-key": "error",
1533
+ "react/no-nested-components": "error",
1534
+ "react/no-prop-types": "error",
1535
+ "react/no-redundant-should-component-update": "error",
1536
+ "react/no-set-state-in-component-did-mount": "warn",
1537
+ "react/no-set-state-in-component-did-update": "warn",
1538
+ "react/no-set-state-in-component-will-update": "warn",
1539
+ "react/no-string-refs": "error",
1540
+ "react/no-unsafe-component-will-mount": "warn",
1541
+ "react/no-unsafe-component-will-receive-props": "warn",
1542
+ "react/no-unsafe-component-will-update": "warn",
1543
+ "react/no-unstable-context-value": "warn",
1544
+ "react/no-unstable-default-props": "warn",
1545
+ "react/no-unused-class-component-members": "warn",
1546
+ "react/no-unused-state": "warn",
1547
+ "react/prefer-destructuring-assignment": "warn",
1548
+ "react/prefer-shorthand-boolean": "warn",
1549
+ "react/prefer-shorthand-fragment": "warn",
1550
+ // overrides
1551
+ ...overrides
1552
+ }
1553
+ },
1554
+ ...isTypeAware ? [{
1555
+ files: filesTypeAware,
1556
+ ignores: ignoresTypeAware,
1557
+ name: "whoj/react/type-aware-rules",
1558
+ rules: {
1559
+ ...typeAwareRules
1560
+ }
1561
+ }] : []
1562
+ ];
1563
+ }
1564
+
1565
+ // src/configs/solid.ts
1566
+ init_esm_shims();
1567
+ async function solid(options = {}) {
1568
+ const {
1569
+ files = [GLOB_JSX, GLOB_TSX],
1570
+ overrides = {},
1571
+ typescript: typescript2 = true
1572
+ } = options;
1573
+ await ensurePackages([
1574
+ "eslint-plugin-solid"
1575
+ ]);
1576
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1577
+ const isTypeAware = !!tsconfigPath;
1578
+ const [
1579
+ pluginSolid,
1580
+ parserTs
1581
+ ] = await Promise.all([
1582
+ interopDefault(import("./dist-MYXPM6TG.js")),
1583
+ interopDefault(import("@typescript-eslint/parser"))
1584
+ ]);
1585
+ return [
1586
+ {
1587
+ name: "whoj/solid/setup",
1588
+ plugins: {
1589
+ solid: pluginSolid
1590
+ }
1591
+ },
1592
+ {
1593
+ files,
1594
+ languageOptions: {
1595
+ parser: parserTs,
1596
+ parserOptions: {
1597
+ ecmaFeatures: {
1598
+ jsx: true
1599
+ },
1600
+ ...isTypeAware ? { project: tsconfigPath } : {}
1601
+ },
1602
+ sourceType: "module"
1603
+ },
1604
+ name: "whoj/solid/rules",
1605
+ rules: {
1606
+ // reactivity
1607
+ "solid/components-return-once": "warn",
1608
+ "solid/event-handlers": ["error", {
1609
+ // if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
1610
+ ignoreCase: false,
1611
+ // if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
1612
+ warnOnSpread: false
1613
+ }],
1614
+ // these rules are mostly style suggestions
1615
+ "solid/imports": "error",
1616
+ // identifier usage is important
1617
+ "solid/jsx-no-duplicate-props": "error",
1618
+ "solid/jsx-no-script-url": "error",
1619
+ "solid/jsx-no-undef": "error",
1620
+ "solid/jsx-uses-vars": "error",
1621
+ "solid/no-destructure": "error",
1622
+ // security problems
1623
+ "solid/no-innerhtml": ["error", { allowStatic: true }],
1624
+ "solid/no-react-deps": "error",
1625
+ "solid/no-react-specific-props": "error",
1626
+ "solid/no-unknown-namespaces": "error",
1627
+ "solid/prefer-for": "error",
1628
+ "solid/reactivity": "warn",
1629
+ "solid/self-closing-comp": "error",
1630
+ "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
1631
+ ...typescript2 ? {
1632
+ "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
1633
+ "solid/no-unknown-namespaces": "off"
1634
+ } : {},
1635
+ // overrides
1636
+ ...overrides
1733
1637
  }
1734
1638
  }
1735
1639
  ];
@@ -1754,12 +1658,12 @@ async function svelte(options = {}) {
1754
1658
  pluginSvelte,
1755
1659
  parserSvelte
1756
1660
  ] = await Promise.all([
1757
- interopDefault(import("./lib-7QWIUEWR.js")),
1758
- interopDefault(import("./lib-47EDT2ZH.js"))
1661
+ interopDefault(import("./lib-C6BFP32Q.js")),
1662
+ interopDefault(import("./lib-XQB7MXK6.js"))
1759
1663
  ]);
1760
1664
  return [
1761
1665
  {
1762
- name: "antfu/svelte/setup",
1666
+ name: "whoj/svelte/setup",
1763
1667
  plugins: {
1764
1668
  svelte: pluginSvelte
1765
1669
  }
@@ -1773,7 +1677,7 @@ async function svelte(options = {}) {
1773
1677
  parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null
1774
1678
  }
1775
1679
  },
1776
- name: "antfu/svelte/rules",
1680
+ name: "whoj/svelte/rules",
1777
1681
  processor: pluginSvelte.processors[".svelte"],
1778
1682
  rules: {
1779
1683
  "import/no-mutable-exports": "off",
@@ -1835,277 +1739,95 @@ async function svelte(options = {}) {
1835
1739
  ];
1836
1740
  }
1837
1741
 
1838
- // src/configs/test.ts
1839
- init_esm_shims();
1840
- var _pluginTest;
1841
- async function test(options = {}) {
1842
- const {
1843
- files = GLOB_TESTS,
1844
- isInEditor = false,
1845
- overrides = {}
1846
- } = options;
1847
- const [
1848
- pluginVitest,
1849
- pluginNoOnlyTests
1850
- ] = await Promise.all([
1851
- interopDefault(import("@vitest/eslint-plugin")),
1852
- // @ts-expect-error missing types
1853
- interopDefault(import("eslint-plugin-no-only-tests"))
1854
- ]);
1855
- _pluginTest = _pluginTest || {
1856
- ...pluginVitest,
1857
- rules: {
1858
- ...pluginVitest.rules,
1859
- // extend `test/no-only-tests` rule
1860
- ...pluginNoOnlyTests.rules
1861
- }
1862
- };
1863
- return [
1864
- {
1865
- name: "antfu/test/setup",
1866
- plugins: {
1867
- test: _pluginTest
1868
- }
1869
- },
1870
- {
1871
- files,
1872
- name: "antfu/test/rules",
1873
- rules: {
1874
- "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1875
- "test/no-identical-title": "error",
1876
- "test/no-import-node-test": "error",
1877
- "test/no-only-tests": isInEditor ? "warn" : "error",
1878
- "test/prefer-hooks-in-order": "error",
1879
- "test/prefer-lowercase-title": "error",
1880
- // Disables
1881
- ...{
1882
- "antfu/no-top-level-await": "off",
1883
- "no-unused-expressions": "off",
1884
- "node/prefer-global/process": "off",
1885
- "ts/explicit-function-return-type": "off"
1886
- },
1887
- ...overrides
1888
- }
1889
- }
1890
- ];
1891
- }
1892
-
1893
- // src/configs/toml.ts
1742
+ // src/configs/unocss.ts
1894
1743
  init_esm_shims();
1895
- async function toml(options = {}) {
1744
+ async function unocss(options = {}) {
1896
1745
  const {
1897
- files = [GLOB_TOML],
1898
- overrides = {},
1899
- stylistic: stylistic2 = true
1746
+ attributify = true,
1747
+ strict = false
1900
1748
  } = options;
1901
- const {
1902
- indent = 2
1903
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1904
- const [
1905
- pluginToml,
1906
- parserToml
1907
- ] = await Promise.all([
1908
- interopDefault(import("eslint-plugin-toml")),
1909
- interopDefault(import("toml-eslint-parser"))
1749
+ await ensurePackages([
1750
+ "@unocss/eslint-plugin"
1910
1751
  ]);
1911
- return [
1912
- {
1913
- name: "antfu/toml/setup",
1914
- plugins: {
1915
- toml: pluginToml
1916
- }
1917
- },
1918
- {
1919
- files,
1920
- languageOptions: {
1921
- parser: parserToml
1922
- },
1923
- name: "antfu/toml/rules",
1924
- rules: {
1925
- "style/spaced-comment": "off",
1926
- "toml/comma-style": "error",
1927
- "toml/keys-order": "error",
1928
- "toml/no-space-dots": "error",
1929
- "toml/no-unreadable-number-separator": "error",
1930
- "toml/precision-of-fractional-seconds": "error",
1931
- "toml/precision-of-integer": "error",
1932
- "toml/tables-order": "error",
1933
- "toml/vue-custom-block/no-parsing-error": "error",
1934
- ...stylistic2 ? {
1935
- "toml/array-bracket-newline": "error",
1936
- "toml/array-bracket-spacing": "error",
1937
- "toml/array-element-newline": "error",
1938
- "toml/indent": ["error", indent === "tab" ? 2 : indent],
1939
- "toml/inline-table-curly-spacing": "error",
1940
- "toml/key-spacing": "error",
1941
- "toml/padding-line-between-pairs": "error",
1942
- "toml/padding-line-between-tables": "error",
1943
- "toml/quoted-keys": "error",
1944
- "toml/spaced-comment": "error",
1945
- "toml/table-bracket-spacing": "error"
1946
- } : {},
1947
- ...overrides
1948
- }
1949
- }
1950
- ];
1951
- }
1952
-
1953
- // src/configs/typescript.ts
1954
- init_esm_shims();
1955
- import process2 from "node:process";
1956
- async function typescript(options = {}) {
1957
- const {
1958
- componentExts = [],
1959
- overrides = {},
1960
- overridesTypeAware = {},
1961
- parserOptions = {},
1962
- type = "app"
1963
- } = options;
1964
- const files = options.files ?? [
1965
- GLOB_TS,
1966
- GLOB_TSX,
1967
- ...componentExts.map((ext) => `**/*.${ext}`)
1968
- ];
1969
- const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1970
- const ignoresTypeAware = options.ignoresTypeAware ?? [
1971
- `${GLOB_MARKDOWN}/**`,
1972
- GLOB_ASTRO_TS
1973
- ];
1974
- const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
1975
- const isTypeAware = !!tsconfigPath;
1976
- const typeAwareRules = {
1977
- "dot-notation": "off",
1978
- "no-implied-eval": "off",
1979
- "ts/await-thenable": "error",
1980
- "ts/dot-notation": ["error", { allowKeywords: true }],
1981
- "ts/no-floating-promises": "error",
1982
- "ts/no-for-in-array": "error",
1983
- "ts/no-implied-eval": "error",
1984
- "ts/no-misused-promises": "error",
1985
- "ts/no-unnecessary-type-assertion": "error",
1986
- "ts/no-unsafe-argument": "error",
1987
- "ts/no-unsafe-assignment": "error",
1988
- "ts/no-unsafe-call": "error",
1989
- "ts/no-unsafe-member-access": "error",
1990
- "ts/no-unsafe-return": "error",
1991
- "ts/promise-function-async": "error",
1992
- "ts/restrict-plus-operands": "error",
1993
- "ts/restrict-template-expressions": "error",
1994
- "ts/return-await": ["error", "in-try-catch"],
1995
- "ts/strict-boolean-expressions": ["error", { allowNullableBoolean: true, allowNullableObject: true }],
1996
- "ts/switch-exhaustiveness-check": "error",
1997
- "ts/unbound-method": "error"
1998
- };
1999
1752
  const [
2000
- pluginTs,
2001
- parserTs
1753
+ pluginUnoCSS
2002
1754
  ] = await Promise.all([
2003
- interopDefault(import("@typescript-eslint/eslint-plugin")),
2004
- interopDefault(import("@typescript-eslint/parser"))
2005
- ]);
2006
- function makeParser(typeAware, files2, ignores2) {
2007
- return {
2008
- files: files2,
2009
- ...ignores2 ? { ignores: ignores2 } : {},
2010
- languageOptions: {
2011
- parser: parserTs,
2012
- parserOptions: {
2013
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
2014
- sourceType: "module",
2015
- ...typeAware ? {
2016
- projectService: {
2017
- allowDefaultProject: ["./*.js"],
2018
- defaultProject: tsconfigPath
2019
- },
2020
- tsconfigRootDir: process2.cwd()
2021
- } : {},
2022
- ...parserOptions
2023
- }
2024
- },
2025
- name: `antfu/typescript/${typeAware ? "type-aware-parser" : "parser"}`
2026
- };
2027
- }
1755
+ interopDefault(import("@unocss/eslint-plugin"))
1756
+ ]);
2028
1757
  return [
2029
1758
  {
2030
- // Install the plugins without globs, so they can be configured separately.
2031
- name: "antfu/typescript/setup",
1759
+ name: "whoj/unocss",
2032
1760
  plugins: {
2033
- antfu: default3,
2034
- ts: pluginTs
2035
- }
2036
- },
2037
- // assign type-aware parser for type-aware files and type-unaware parser for the rest
2038
- ...isTypeAware ? [
2039
- makeParser(false, files),
2040
- makeParser(true, filesTypeAware, ignoresTypeAware)
2041
- ] : [
2042
- makeParser(false, files)
2043
- ],
2044
- {
2045
- files,
2046
- name: "antfu/typescript/rules",
1761
+ unocss: pluginUnoCSS
1762
+ },
2047
1763
  rules: {
2048
- ...renameRules(
2049
- pluginTs.configs["eslint-recommended"].overrides[0].rules,
2050
- { "@typescript-eslint": "ts" }
2051
- ),
2052
- ...renameRules(
2053
- pluginTs.configs.strict.rules,
2054
- { "@typescript-eslint": "ts" }
2055
- ),
2056
- "no-dupe-class-members": "off",
2057
- "no-redeclare": "off",
2058
- "no-use-before-define": "off",
2059
- "no-useless-constructor": "off",
2060
- "ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
2061
- "ts/consistent-type-definitions": ["error", "interface"],
2062
- "ts/consistent-type-imports": ["error", {
2063
- disallowTypeAnnotations: false,
2064
- fixStyle: "separate-type-imports",
2065
- prefer: "type-imports"
2066
- }],
2067
- "ts/method-signature-style": ["error", "property"],
2068
- // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
2069
- "ts/no-dupe-class-members": "error",
2070
- "ts/no-dynamic-delete": "off",
2071
- "ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
2072
- "ts/no-explicit-any": "off",
2073
- "ts/no-extraneous-class": "off",
2074
- "ts/no-import-type-side-effects": "error",
2075
- "ts/no-invalid-void-type": "off",
2076
- "ts/no-non-null-assertion": "off",
2077
- "ts/no-redeclare": ["error", { builtinGlobals: false }],
2078
- "ts/no-require-imports": "error",
2079
- "ts/no-unused-expressions": ["error", {
2080
- allowShortCircuit: true,
2081
- allowTaggedTemplates: true,
2082
- allowTernary: true
2083
- }],
2084
- "ts/no-unused-vars": "off",
2085
- "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
2086
- "ts/no-useless-constructor": "off",
2087
- "ts/no-wrapper-object-types": "error",
2088
- "ts/triple-slash-reference": "off",
2089
- "ts/unified-signatures": "off",
2090
- ...type === "lib" ? {
2091
- "ts/explicit-function-return-type": ["error", {
2092
- allowExpressions: true,
2093
- allowHigherOrderFunctions: true,
2094
- allowIIFEs: true
2095
- }]
1764
+ "unocss/order": "warn",
1765
+ ...attributify ? {
1766
+ "unocss/order-attributify": "warn"
2096
1767
  } : {},
2097
- ...overrides
1768
+ ...strict ? {
1769
+ "unocss/blocklist": "error"
1770
+ } : {}
2098
1771
  }
2099
- },
2100
- ...isTypeAware ? [{
2101
- files: filesTypeAware,
2102
- ignores: ignoresTypeAware,
2103
- name: "antfu/typescript/rules-type-aware",
1772
+ }
1773
+ ];
1774
+ }
1775
+
1776
+ // src/configs/command.ts
1777
+ init_esm_shims();
1778
+ import createCommand from "eslint-plugin-command/config";
1779
+ async function command() {
1780
+ return [
1781
+ {
1782
+ ...createCommand(),
1783
+ name: "whoj/command/rules"
1784
+ }
1785
+ ];
1786
+ }
1787
+
1788
+ // src/configs/ignores.ts
1789
+ init_esm_shims();
1790
+ async function ignores(userIgnores = []) {
1791
+ return [
1792
+ {
1793
+ ignores: [
1794
+ ...GLOB_EXCLUDE,
1795
+ ...userIgnores
1796
+ ],
1797
+ name: "whoj/ignores"
1798
+ }
1799
+ ];
1800
+ }
1801
+
1802
+ // src/configs/imports.ts
1803
+ init_esm_shims();
1804
+ async function imports(options = {}) {
1805
+ const {
1806
+ stylistic: stylistic2 = true
1807
+ } = options;
1808
+ return [
1809
+ {
1810
+ name: "whoj/imports/rules",
1811
+ plugins: {
1812
+ import: pluginImport,
1813
+ whoj: default3
1814
+ },
2104
1815
  rules: {
2105
- ...typeAwareRules,
2106
- ...overridesTypeAware
1816
+ "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
1817
+ "import/first": "error",
1818
+ "import/no-duplicates": "error",
1819
+ "import/no-mutable-exports": "error",
1820
+ "import/no-named-default": "error",
1821
+ "import/no-self-import": "error",
1822
+ "import/no-webpack-loader-syntax": "error",
1823
+ "whoj/import-dedupe": "error",
1824
+ "whoj/no-import-dist": "error",
1825
+ "whoj/no-import-node-modules-by-path": "error",
1826
+ ...stylistic2 ? {
1827
+ "import/newline-after-import": ["error", { count: 1 }]
1828
+ } : {}
2107
1829
  }
2108
- }] : []
1830
+ }
2109
1831
  ];
2110
1832
  }
2111
1833
 
@@ -2114,12 +1836,12 @@ init_esm_shims();
2114
1836
  async function unicorn(options = {}) {
2115
1837
  return [
2116
1838
  {
2117
- name: "antfu/unicorn/rules",
1839
+ name: "whoj/unicorn/rules",
2118
1840
  plugins: {
2119
- unicorn: default6
1841
+ unicorn: default4
2120
1842
  },
2121
1843
  rules: {
2122
- ...options.allRecommended ? default6.configs["flat/recommended"].rules : {
1844
+ ...options.allRecommended ? default4.configs["flat/recommended"].rules : {
2123
1845
  "unicorn/consistent-empty-array-spread": "error",
2124
1846
  "unicorn/error-message": "error",
2125
1847
  "unicorn/escape-case": "error",
@@ -2141,265 +1863,565 @@ async function unicorn(options = {}) {
2141
1863
  ];
2142
1864
  }
2143
1865
 
2144
- // src/configs/unocss.ts
1866
+ // src/configs/comments.ts
2145
1867
  init_esm_shims();
2146
- async function unocss(options = {}) {
1868
+ async function comments() {
1869
+ return [
1870
+ {
1871
+ name: "whoj/eslint-comments/rules",
1872
+ plugins: {
1873
+ "eslint-comments": default7
1874
+ },
1875
+ rules: {
1876
+ "eslint-comments/no-aggregating-enable": "error",
1877
+ "eslint-comments/no-duplicate-disable": "error",
1878
+ "eslint-comments/no-unlimited-disable": "error",
1879
+ "eslint-comments/no-unused-enable": "error"
1880
+ }
1881
+ }
1882
+ ];
1883
+ }
1884
+
1885
+ // src/configs/disables.ts
1886
+ init_esm_shims();
1887
+ async function disables() {
1888
+ return [
1889
+ {
1890
+ files: [`**/scripts/${GLOB_SRC}`],
1891
+ name: "whoj/disables/scripts",
1892
+ rules: {
1893
+ "no-console": "off",
1894
+ "ts/explicit-function-return-type": "off",
1895
+ "whoj/no-top-level-await": "off"
1896
+ }
1897
+ },
1898
+ {
1899
+ files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1900
+ name: "whoj/disables/cli",
1901
+ rules: {
1902
+ "no-console": "off",
1903
+ "whoj/no-top-level-await": "off"
1904
+ }
1905
+ },
1906
+ {
1907
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
1908
+ name: "whoj/disables/bin",
1909
+ rules: {
1910
+ "whoj/no-import-dist": "off",
1911
+ "whoj/no-import-node-modules-by-path": "off"
1912
+ }
1913
+ },
1914
+ {
1915
+ files: ["**/*.d.?([cm])ts"],
1916
+ name: "whoj/disables/dts",
1917
+ rules: {
1918
+ "eslint-comments/no-unlimited-disable": "off",
1919
+ "import/no-duplicates": "off",
1920
+ "no-restricted-syntax": "off",
1921
+ "unused-imports/no-unused-vars": "off"
1922
+ }
1923
+ },
1924
+ {
1925
+ files: ["**/*.js", "**/*.cjs"],
1926
+ name: "whoj/disables/cjs",
1927
+ rules: {
1928
+ "ts/no-require-imports": "off"
1929
+ }
1930
+ },
1931
+ {
1932
+ files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
1933
+ name: "whoj/disables/config-files",
1934
+ rules: {
1935
+ "no-console": "off",
1936
+ "ts/explicit-function-return-type": "off",
1937
+ "whoj/no-top-level-await": "off"
1938
+ }
1939
+ }
1940
+ ];
1941
+ }
1942
+
1943
+ // src/configs/markdown.ts
1944
+ init_esm_shims();
1945
+ import { mergeProcessors as mergeProcessors2, processorPassThrough } from "eslint-merge-processors";
1946
+ async function markdown(options = {}) {
2147
1947
  const {
2148
- attributify = true,
2149
- strict = false
1948
+ componentExts = [],
1949
+ files = [GLOB_MARKDOWN],
1950
+ overrides = {}
2150
1951
  } = options;
2151
- await ensurePackages([
2152
- "@unocss/eslint-plugin"
2153
- ]);
2154
- const [
2155
- pluginUnoCSS
2156
- ] = await Promise.all([
2157
- interopDefault(import("@unocss/eslint-plugin"))
2158
- ]);
1952
+ const markdown2 = await interopDefault(import("@eslint/markdown"));
2159
1953
  return [
2160
1954
  {
2161
- name: "antfu/unocss",
1955
+ name: "whoj/markdown/setup",
2162
1956
  plugins: {
2163
- unocss: pluginUnoCSS
1957
+ markdown: markdown2
1958
+ }
1959
+ },
1960
+ {
1961
+ files,
1962
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1963
+ name: "whoj/markdown/processor",
1964
+ // `eslint-plugin-markdown` only creates virtual files for code blocks,
1965
+ // but not the markdown file itself. We use `eslint-merge-processors` to
1966
+ // add a pass-through processor for the markdown file itself.
1967
+ processor: mergeProcessors2([
1968
+ markdown2.processors.markdown,
1969
+ processorPassThrough
1970
+ ])
1971
+ },
1972
+ {
1973
+ files,
1974
+ languageOptions: {
1975
+ parser: parserPlain
1976
+ },
1977
+ name: "whoj/markdown/parser"
1978
+ },
1979
+ {
1980
+ files: [
1981
+ GLOB_MARKDOWN_CODE,
1982
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
1983
+ ],
1984
+ languageOptions: {
1985
+ parserOptions: {
1986
+ ecmaFeatures: {
1987
+ impliedStrict: true
1988
+ }
1989
+ }
2164
1990
  },
1991
+ name: "whoj/markdown/disables",
2165
1992
  rules: {
2166
- "unocss/order": "warn",
2167
- ...attributify ? {
2168
- "unocss/order-attributify": "warn"
2169
- } : {},
2170
- ...strict ? {
2171
- "unocss/blocklist": "error"
2172
- } : {}
1993
+ "import/newline-after-import": "off",
1994
+ "no-alert": "off",
1995
+ "no-console": "off",
1996
+ "no-labels": "off",
1997
+ "no-lone-blocks": "off",
1998
+ "no-restricted-syntax": "off",
1999
+ "no-undef": "off",
2000
+ "no-unused-expressions": "off",
2001
+ "no-unused-labels": "off",
2002
+ "no-unused-vars": "off",
2003
+ "node/prefer-global/process": "off",
2004
+ "style/comma-dangle": "off",
2005
+ "style/eol-last": "off",
2006
+ "ts/consistent-type-imports": "off",
2007
+ "ts/explicit-function-return-type": "off",
2008
+ "ts/no-namespace": "off",
2009
+ "ts/no-redeclare": "off",
2010
+ "ts/no-require-imports": "off",
2011
+ "ts/no-unused-expressions": "off",
2012
+ "ts/no-unused-vars": "off",
2013
+ "ts/no-use-before-define": "off",
2014
+ "unicode-bom": "off",
2015
+ "unused-imports/no-unused-imports": "off",
2016
+ "unused-imports/no-unused-vars": "off",
2017
+ "whoj/no-top-level-await": "off",
2018
+ ...overrides
2173
2019
  }
2174
2020
  }
2175
2021
  ];
2176
2022
  }
2177
2023
 
2178
- // src/configs/vue.ts
2024
+ // src/configs/javascript.ts
2179
2025
  init_esm_shims();
2180
- import { mergeProcessors as mergeProcessors2 } from "eslint-merge-processors";
2181
- async function vue(options = {}) {
2026
+ import globals from "globals";
2027
+ async function javascript(options = {}) {
2182
2028
  const {
2183
- files = [GLOB_VUE],
2184
- overrides = {},
2185
- stylistic: stylistic2 = true,
2186
- vueVersion = 3
2029
+ isInEditor = false,
2030
+ overrides = {}
2187
2031
  } = options;
2188
- const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
2189
- const {
2190
- indent = 2
2191
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2192
- const [
2193
- pluginVue,
2194
- parserVue,
2195
- processorVueBlocks
2196
- ] = await Promise.all([
2197
- interopDefault(import("eslint-plugin-vue")),
2198
- interopDefault(import("vue-eslint-parser")),
2199
- interopDefault(import("eslint-processor-vue-blocks"))
2200
- ]);
2201
2032
  return [
2202
2033
  {
2203
- // This allows Vue plugin to work with auto imports
2204
- // https://github.com/vuejs/eslint-plugin-vue/pull/2422
2205
2034
  languageOptions: {
2035
+ ecmaVersion: 2022,
2206
2036
  globals: {
2207
- computed: "readonly",
2208
- defineEmits: "readonly",
2209
- defineExpose: "readonly",
2210
- defineProps: "readonly",
2211
- onMounted: "readonly",
2212
- onUnmounted: "readonly",
2213
- reactive: "readonly",
2214
- ref: "readonly",
2215
- shallowReactive: "readonly",
2216
- shallowRef: "readonly",
2217
- toRef: "readonly",
2218
- toRefs: "readonly",
2219
- watch: "readonly",
2220
- watchEffect: "readonly"
2221
- }
2222
- },
2223
- name: "antfu/vue/setup",
2224
- plugins: {
2225
- vue: pluginVue
2226
- }
2227
- },
2228
- {
2229
- files,
2230
- languageOptions: {
2231
- parser: parserVue,
2037
+ ...globals.browser,
2038
+ ...globals.es2021,
2039
+ ...globals.node,
2040
+ document: "readonly",
2041
+ navigator: "readonly",
2042
+ window: "readonly"
2043
+ },
2232
2044
  parserOptions: {
2233
2045
  ecmaFeatures: {
2234
2046
  jsx: true
2235
2047
  },
2236
- extraFileExtensions: [".vue"],
2237
- parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
2048
+ ecmaVersion: 2022,
2238
2049
  sourceType: "module"
2239
- }
2050
+ },
2051
+ sourceType: "module"
2052
+ },
2053
+ linterOptions: {
2054
+ reportUnusedDisableDirectives: true
2055
+ },
2056
+ name: "whoj/javascript/setup"
2057
+ },
2058
+ {
2059
+ name: "whoj/javascript/rules",
2060
+ plugins: {
2061
+ "unused-imports": default6,
2062
+ "whoj": default3
2240
2063
  },
2241
- name: "antfu/vue/rules",
2242
- processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors2([
2243
- pluginVue.processors[".vue"],
2244
- processorVueBlocks({
2245
- ...sfcBlocks,
2246
- blocks: {
2247
- styles: true,
2248
- ...sfcBlocks.blocks
2249
- }
2250
- })
2251
- ]),
2252
2064
  rules: {
2253
- ...pluginVue.configs.base.rules,
2254
- ...vueVersion === 2 ? {
2255
- ...pluginVue.configs.essential.rules,
2256
- ...pluginVue.configs["strongly-recommended"].rules,
2257
- ...pluginVue.configs.recommended.rules
2258
- } : {
2259
- ...pluginVue.configs["vue3-essential"].rules,
2260
- ...pluginVue.configs["vue3-strongly-recommended"].rules,
2261
- ...pluginVue.configs["vue3-recommended"].rules
2262
- },
2263
- "antfu/no-top-level-await": "off",
2264
- "node/prefer-global/process": "off",
2265
- "ts/explicit-function-return-type": "off",
2266
- "vue/block-order": ["error", {
2267
- order: ["script", "template", "style"]
2065
+ "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
2066
+ "array-callback-return": "error",
2067
+ "block-scoped-var": "error",
2068
+ "constructor-super": "error",
2069
+ "default-case-last": "error",
2070
+ "dot-notation": ["error", { allowKeywords: true }],
2071
+ "eqeqeq": ["error", "smart"],
2072
+ "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
2073
+ "no-alert": "error",
2074
+ "no-array-constructor": "error",
2075
+ "no-async-promise-executor": "error",
2076
+ "no-caller": "error",
2077
+ "no-case-declarations": "error",
2078
+ "no-class-assign": "error",
2079
+ "no-compare-neg-zero": "error",
2080
+ "no-cond-assign": ["error", "always"],
2081
+ "no-console": ["error", { allow: ["warn", "error"] }],
2082
+ "no-const-assign": "error",
2083
+ "no-control-regex": "error",
2084
+ "no-debugger": "error",
2085
+ "no-delete-var": "error",
2086
+ "no-dupe-args": "error",
2087
+ "no-dupe-class-members": "error",
2088
+ "no-dupe-keys": "error",
2089
+ "no-duplicate-case": "error",
2090
+ "no-empty": ["error", { allowEmptyCatch: true }],
2091
+ "no-empty-character-class": "error",
2092
+ "no-empty-pattern": "error",
2093
+ "no-eval": "error",
2094
+ "no-ex-assign": "error",
2095
+ "no-extend-native": "error",
2096
+ "no-extra-bind": "error",
2097
+ "no-extra-boolean-cast": "error",
2098
+ "no-fallthrough": "error",
2099
+ "no-func-assign": "error",
2100
+ "no-global-assign": "error",
2101
+ "no-implied-eval": "error",
2102
+ "no-import-assign": "error",
2103
+ "no-invalid-regexp": "error",
2104
+ "no-irregular-whitespace": "error",
2105
+ "no-iterator": "error",
2106
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
2107
+ "no-lone-blocks": "error",
2108
+ "no-loss-of-precision": "error",
2109
+ "no-misleading-character-class": "error",
2110
+ "no-multi-str": "error",
2111
+ "no-new": "error",
2112
+ "no-new-func": "error",
2113
+ "no-new-native-nonconstructor": "error",
2114
+ "no-new-wrappers": "error",
2115
+ "no-obj-calls": "error",
2116
+ "no-octal": "error",
2117
+ "no-octal-escape": "error",
2118
+ "no-proto": "error",
2119
+ "no-prototype-builtins": "error",
2120
+ "no-redeclare": ["error", { builtinGlobals: false }],
2121
+ "no-regex-spaces": "error",
2122
+ "no-restricted-globals": [
2123
+ "error",
2124
+ { message: "Use `globalThis` instead.", name: "global" },
2125
+ { message: "Use `globalThis` instead.", name: "self" }
2126
+ ],
2127
+ "no-restricted-properties": [
2128
+ "error",
2129
+ { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
2130
+ { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
2131
+ { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
2132
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
2133
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
2134
+ ],
2135
+ "no-restricted-syntax": [
2136
+ "error",
2137
+ "TSEnumDeclaration[const=true]",
2138
+ "TSExportAssignment"
2139
+ ],
2140
+ "no-self-assign": ["error", { props: true }],
2141
+ "no-self-compare": "error",
2142
+ "no-sequences": "error",
2143
+ "no-shadow-restricted-names": "error",
2144
+ "no-sparse-arrays": "error",
2145
+ "no-template-curly-in-string": "error",
2146
+ "no-this-before-super": "error",
2147
+ "no-throw-literal": "error",
2148
+ "no-undef": "error",
2149
+ "no-undef-init": "error",
2150
+ "no-unexpected-multiline": "error",
2151
+ "no-unmodified-loop-condition": "error",
2152
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
2153
+ "no-unreachable": "error",
2154
+ "no-unreachable-loop": "error",
2155
+ "no-unsafe-finally": "error",
2156
+ "no-unsafe-negation": "error",
2157
+ "no-unused-expressions": ["error", {
2158
+ allowShortCircuit: true,
2159
+ allowTaggedTemplates: true,
2160
+ allowTernary: true
2268
2161
  }],
2269
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
2270
- "vue/component-options-name-casing": ["error", "PascalCase"],
2271
- // this is deprecated
2272
- "vue/component-tags-order": "off",
2273
- "vue/custom-event-name-casing": ["error", "camelCase"],
2274
- "vue/define-macros-order": ["error", {
2275
- order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
2162
+ "no-unused-vars": ["error", {
2163
+ args: "none",
2164
+ caughtErrors: "none",
2165
+ ignoreRestSiblings: true,
2166
+ vars: "all"
2276
2167
  }],
2277
- "vue/dot-location": ["error", "property"],
2278
- "vue/dot-notation": ["error", { allowKeywords: true }],
2279
- "vue/eqeqeq": ["error", "smart"],
2280
- "vue/html-indent": ["error", indent],
2281
- "vue/html-quotes": ["error", "double"],
2282
- "vue/max-attributes-per-line": "off",
2283
- "vue/multi-word-component-names": "off",
2284
- "vue/no-dupe-keys": "off",
2285
- "vue/no-empty-pattern": "error",
2286
- "vue/no-irregular-whitespace": "error",
2287
- "vue/no-loss-of-precision": "error",
2288
- "vue/no-restricted-syntax": [
2168
+ "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
2169
+ "no-useless-backreference": "error",
2170
+ "no-useless-call": "error",
2171
+ "no-useless-catch": "error",
2172
+ "no-useless-computed-key": "error",
2173
+ "no-useless-constructor": "error",
2174
+ "no-useless-rename": "error",
2175
+ "no-useless-return": "error",
2176
+ "no-var": "error",
2177
+ "no-with": "error",
2178
+ "object-shorthand": [
2289
2179
  "error",
2290
- "DebuggerStatement",
2291
- "LabeledStatement",
2292
- "WithStatement"
2180
+ "always",
2181
+ {
2182
+ avoidQuotes: true,
2183
+ ignoreConstructors: false
2184
+ }
2185
+ ],
2186
+ "one-var": ["error", { initialized: "never" }],
2187
+ "prefer-arrow-callback": [
2188
+ "error",
2189
+ {
2190
+ allowNamedFunctions: false,
2191
+ allowUnboundThis: true
2192
+ }
2193
+ ],
2194
+ "prefer-const": [
2195
+ isInEditor ? "warn" : "error",
2196
+ {
2197
+ destructuring: "all",
2198
+ ignoreReadBeforeAssign: true
2199
+ }
2293
2200
  ],
2294
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
2295
- "vue/no-setup-props-reactivity-loss": "off",
2296
- "vue/no-sparse-arrays": "error",
2297
- "vue/no-unused-refs": "error",
2298
- "vue/no-useless-v-bind": "error",
2299
- "vue/no-v-html": "off",
2300
- "vue/object-shorthand": [
2201
+ "prefer-exponentiation-operator": "error",
2202
+ "prefer-promise-reject-errors": "error",
2203
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
2204
+ "prefer-rest-params": "error",
2205
+ "prefer-spread": "error",
2206
+ "prefer-template": "error",
2207
+ "symbol-description": "error",
2208
+ "unicode-bom": ["error", "never"],
2209
+ "unused-imports/no-unused-imports": isInEditor ? "warn" : "error",
2210
+ "unused-imports/no-unused-vars": [
2301
2211
  "error",
2302
- "always",
2303
2212
  {
2304
- avoidQuotes: true,
2305
- ignoreConstructors: false
2213
+ args: "after-used",
2214
+ argsIgnorePattern: "^_",
2215
+ ignoreRestSiblings: true,
2216
+ vars: "all",
2217
+ varsIgnorePattern: "^_"
2306
2218
  }
2307
2219
  ],
2308
- "vue/prefer-separate-static-class": "error",
2309
- "vue/prefer-template": "error",
2310
- "vue/prop-name-casing": ["error", "camelCase"],
2311
- "vue/require-default-prop": "off",
2312
- "vue/require-prop-types": "off",
2313
- "vue/space-infix-ops": "error",
2314
- "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
2315
- ...stylistic2 ? {
2316
- "vue/array-bracket-spacing": ["error", "never"],
2317
- "vue/arrow-spacing": ["error", { after: true, before: true }],
2318
- "vue/block-spacing": ["error", "always"],
2319
- "vue/block-tag-newline": ["error", {
2320
- multiline: "always",
2321
- singleline: "always"
2322
- }],
2323
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
2324
- "vue/comma-dangle": ["error", "always-multiline"],
2325
- "vue/comma-spacing": ["error", { after: true, before: false }],
2326
- "vue/comma-style": ["error", "last"],
2327
- "vue/html-comment-content-spacing": ["error", "always", {
2328
- exceptions: ["-"]
2329
- }],
2330
- "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
2331
- "vue/keyword-spacing": ["error", { after: true, before: true }],
2332
- "vue/object-curly-newline": "off",
2333
- "vue/object-curly-spacing": ["error", "always"],
2334
- "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
2335
- "vue/operator-linebreak": ["error", "before"],
2336
- "vue/padding-line-between-blocks": ["error", "always"],
2337
- "vue/quote-props": ["error", "consistent-as-needed"],
2338
- "vue/space-in-parens": ["error", "never"],
2339
- "vue/template-curly-spacing": "error"
2340
- } : {},
2220
+ "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
2221
+ "valid-typeof": ["error", { requireStringLiterals: true }],
2222
+ "vars-on-top": "error",
2223
+ "whoj/no-top-level-await": "error",
2224
+ "yoda": ["error", "never"],
2341
2225
  ...overrides
2342
2226
  }
2343
2227
  }
2344
2228
  ];
2345
2229
  }
2346
2230
 
2347
- // src/configs/yaml.ts
2231
+ // src/configs/typescript.ts
2348
2232
  init_esm_shims();
2349
- async function yaml(options = {}) {
2233
+ import process2 from "node:process";
2234
+ async function typescript(options = {}) {
2350
2235
  const {
2351
- files = [GLOB_YAML],
2236
+ componentExts = [],
2352
2237
  overrides = {},
2353
- stylistic: stylistic2 = true
2238
+ overridesTypeAware = {},
2239
+ parserOptions = {},
2240
+ type = "app"
2354
2241
  } = options;
2355
- const {
2356
- indent = 2,
2357
- quotes = "single"
2358
- } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2242
+ const files = options.files ?? [
2243
+ GLOB_TS,
2244
+ GLOB_TSX,
2245
+ ...componentExts.map((ext) => `**/*.${ext}`)
2246
+ ];
2247
+ const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
2248
+ const ignoresTypeAware = options.ignoresTypeAware ?? [
2249
+ `${GLOB_MARKDOWN}/**`,
2250
+ GLOB_ASTRO_TS
2251
+ ];
2252
+ const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
2253
+ const isTypeAware = !!tsconfigPath;
2254
+ const typeAwareRules = {
2255
+ "dot-notation": "off",
2256
+ "no-implied-eval": "off",
2257
+ "ts/await-thenable": "error",
2258
+ "ts/dot-notation": ["error", { allowKeywords: true }],
2259
+ "ts/no-floating-promises": "error",
2260
+ "ts/no-for-in-array": "error",
2261
+ "ts/no-implied-eval": "error",
2262
+ "ts/no-misused-promises": "error",
2263
+ "ts/no-unnecessary-type-assertion": "error",
2264
+ "ts/no-unsafe-argument": "error",
2265
+ "ts/no-unsafe-assignment": "error",
2266
+ "ts/no-unsafe-call": "error",
2267
+ "ts/no-unsafe-member-access": "error",
2268
+ "ts/no-unsafe-return": "error",
2269
+ "ts/promise-function-async": "error",
2270
+ "ts/restrict-plus-operands": "error",
2271
+ "ts/restrict-template-expressions": "error",
2272
+ "ts/return-await": ["error", "in-try-catch"],
2273
+ "ts/strict-boolean-expressions": ["error", { allowNullableBoolean: true, allowNullableObject: true }],
2274
+ "ts/switch-exhaustiveness-check": "error",
2275
+ "ts/unbound-method": "error"
2276
+ };
2359
2277
  const [
2360
- pluginYaml,
2361
- parserYaml
2278
+ pluginTs,
2279
+ parserTs
2362
2280
  ] = await Promise.all([
2363
- interopDefault(import("eslint-plugin-yml")),
2364
- interopDefault(import("yaml-eslint-parser"))
2281
+ interopDefault(import("@typescript-eslint/eslint-plugin")),
2282
+ interopDefault(import("@typescript-eslint/parser"))
2365
2283
  ]);
2284
+ function makeParser(typeAware, files2, ignores2) {
2285
+ return {
2286
+ files: files2,
2287
+ ...ignores2 ? { ignores: ignores2 } : {},
2288
+ languageOptions: {
2289
+ parser: parserTs,
2290
+ parserOptions: {
2291
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
2292
+ sourceType: "module",
2293
+ ...typeAware ? {
2294
+ projectService: {
2295
+ allowDefaultProject: ["./*.js"],
2296
+ defaultProject: tsconfigPath
2297
+ },
2298
+ tsconfigRootDir: process2.cwd()
2299
+ } : {},
2300
+ ...parserOptions
2301
+ }
2302
+ },
2303
+ name: `whoj/typescript/${typeAware ? "type-aware-parser" : "parser"}`
2304
+ };
2305
+ }
2366
2306
  return [
2367
2307
  {
2368
- name: "antfu/yaml/setup",
2308
+ // Install the plugins without globs, so they can be configured separately.
2309
+ name: "whoj/typescript/setup",
2369
2310
  plugins: {
2370
- yaml: pluginYaml
2311
+ ts: pluginTs,
2312
+ whoj: default3
2371
2313
  }
2372
2314
  },
2315
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
2316
+ ...isTypeAware ? [
2317
+ makeParser(false, files),
2318
+ makeParser(true, filesTypeAware, ignoresTypeAware)
2319
+ ] : [
2320
+ makeParser(false, files)
2321
+ ],
2373
2322
  {
2374
2323
  files,
2375
- languageOptions: {
2376
- parser: parserYaml
2377
- },
2378
- name: "antfu/yaml/rules",
2324
+ name: "whoj/typescript/rules",
2379
2325
  rules: {
2380
- "style/spaced-comment": "off",
2381
- "yaml/block-mapping": "error",
2382
- "yaml/block-sequence": "error",
2383
- "yaml/no-empty-key": "error",
2384
- "yaml/no-empty-sequence-entry": "error",
2385
- "yaml/no-irregular-whitespace": "error",
2386
- "yaml/plain-scalar": "error",
2387
- "yaml/vue-custom-block/no-parsing-error": "error",
2388
- ...stylistic2 ? {
2389
- "yaml/block-mapping-question-indicator-newline": "error",
2390
- "yaml/block-sequence-hyphen-indicator-newline": "error",
2391
- "yaml/flow-mapping-curly-newline": "error",
2392
- "yaml/flow-mapping-curly-spacing": "error",
2393
- "yaml/flow-sequence-bracket-newline": "error",
2394
- "yaml/flow-sequence-bracket-spacing": "error",
2395
- "yaml/indent": ["error", indent === "tab" ? 2 : indent],
2396
- "yaml/key-spacing": "error",
2397
- "yaml/no-tab-indent": "error",
2398
- "yaml/quotes": ["error", { avoidEscape: true, prefer: quotes === "backtick" ? "single" : quotes }],
2399
- "yaml/spaced-comment": "error"
2326
+ ...renameRules(
2327
+ pluginTs.configs["eslint-recommended"].overrides[0].rules,
2328
+ { "@typescript-eslint": "ts" }
2329
+ ),
2330
+ ...renameRules(
2331
+ pluginTs.configs.strict.rules,
2332
+ { "@typescript-eslint": "ts" }
2333
+ ),
2334
+ "no-dupe-class-members": "off",
2335
+ "no-redeclare": "off",
2336
+ "no-use-before-define": "off",
2337
+ "no-useless-constructor": "off",
2338
+ "ts/ban-ts-comment": "off",
2339
+ "ts/consistent-type-definitions": ["error", "interface"],
2340
+ "ts/consistent-type-imports": ["error", {
2341
+ disallowTypeAnnotations: false,
2342
+ fixStyle: "separate-type-imports",
2343
+ prefer: "type-imports"
2344
+ }],
2345
+ "ts/explicit-function-return-type": ["off"],
2346
+ "ts/method-signature-style": ["warn", "property"],
2347
+ // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
2348
+ "ts/no-dupe-class-members": "error",
2349
+ "ts/no-dynamic-delete": "off",
2350
+ "ts/no-empty-object-type": ["warn", { allowInterfaces: "always" }],
2351
+ "ts/no-explicit-any": "off",
2352
+ "ts/no-extraneous-class": "off",
2353
+ "ts/no-import-type-side-effects": "error",
2354
+ "ts/no-invalid-void-type": "off",
2355
+ "ts/no-non-null-assertion": "off",
2356
+ "ts/no-redeclare": ["error", { builtinGlobals: false }],
2357
+ "ts/no-require-imports": "error",
2358
+ "ts/no-unsafe-function-type": ["off"],
2359
+ "ts/no-unused-expressions": ["warn", {
2360
+ allowShortCircuit: true,
2361
+ allowTaggedTemplates: true,
2362
+ allowTernary: true
2363
+ }],
2364
+ "ts/no-unused-vars": "off",
2365
+ "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
2366
+ "ts/no-useless-constructor": "off",
2367
+ "ts/no-wrapper-object-types": "error",
2368
+ "ts/triple-slash-reference": "off",
2369
+ "ts/unified-signatures": "off",
2370
+ ...type === "lib" ? {
2371
+ "ts/explicit-function-return-type": ["error", {
2372
+ allowExpressions: true,
2373
+ allowHigherOrderFunctions: true,
2374
+ allowIIFEs: true
2375
+ }]
2400
2376
  } : {},
2401
2377
  ...overrides
2402
2378
  }
2379
+ },
2380
+ ...isTypeAware ? [{
2381
+ files: filesTypeAware,
2382
+ ignores: ignoresTypeAware,
2383
+ name: "whoj/typescript/rules-type-aware",
2384
+ rules: {
2385
+ ...typeAwareRules,
2386
+ ...overridesTypeAware
2387
+ }
2388
+ }] : []
2389
+ ];
2390
+ }
2391
+
2392
+ // src/configs/perfectionist.ts
2393
+ init_esm_shims();
2394
+ function perfectionist() {
2395
+ return [
2396
+ {
2397
+ name: "whoj/perfectionist/setup",
2398
+ plugins: {
2399
+ perfectionist: default5
2400
+ },
2401
+ rules: {
2402
+ "perfectionist/sort-exports": ["error", { order: "asc", type: "line-length" }],
2403
+ "perfectionist/sort-imports": ["error", {
2404
+ // groups: [
2405
+ // 'type',
2406
+ // ['parent-type', 'sibling-type', 'index-type', 'internal-type'],
2407
+ //
2408
+ // 'builtin',
2409
+ // 'external',
2410
+ //
2411
+ // 'internal',
2412
+ // ['parent', 'sibling', 'index'],
2413
+ //
2414
+ // 'side-effect',
2415
+ // 'object',
2416
+ // 'unknown'
2417
+ // ],
2418
+ newlinesBetween: "ignore",
2419
+ order: "asc",
2420
+ type: "line-length"
2421
+ }],
2422
+ "perfectionist/sort-named-exports": ["error", { order: "asc", type: "line-length" }],
2423
+ "perfectionist/sort-named-imports": ["error", { order: "asc", type: "line-length" }]
2424
+ }
2403
2425
  }
2404
2426
  ];
2405
2427
  }
@@ -2414,6 +2436,12 @@ var flatConfigProps = [
2414
2436
  "rules",
2415
2437
  "settings"
2416
2438
  ];
2439
+ var NuxtPackages = [
2440
+ "nuxt",
2441
+ "@nuxt/kit",
2442
+ "@nuxt/schema",
2443
+ "@nuxt/content"
2444
+ ];
2417
2445
  var VuePackages = [
2418
2446
  "vue",
2419
2447
  "nuxt",
@@ -2432,13 +2460,14 @@ var defaultPluginRenaming = {
2432
2460
  "vitest": "test",
2433
2461
  "yml": "yaml"
2434
2462
  };
2435
- function antfu(options = {}, ...userConfigs) {
2463
+ function whoj(options = {}, ...userConfigs) {
2436
2464
  const {
2437
2465
  astro: enableAstro = false,
2438
2466
  autoRenamePlugins = true,
2439
2467
  componentExts = [],
2440
2468
  gitignore: enableGitignore = true,
2441
2469
  jsx: enableJsx = true,
2470
+ nuxt: enableNuxt = NuxtPackages.some((i) => isPackageExists4(i)),
2442
2471
  react: enableReact = false,
2443
2472
  regexp: enableRegexp = true,
2444
2473
  solid: enableSolid = false,
@@ -2446,7 +2475,7 @@ function antfu(options = {}, ...userConfigs) {
2446
2475
  typescript: enableTypeScript = isPackageExists4("typescript"),
2447
2476
  unicorn: enableUnicorn = true,
2448
2477
  unocss: enableUnoCSS = false,
2449
- vue: enableVue = VuePackages.some((i) => isPackageExists4(i))
2478
+ vue: enableVue = enableNuxt !== false && VuePackages.some((i) => isPackageExists4(i))
2450
2479
  } = options;
2451
2480
  let isInEditor = options.isInEditor;
2452
2481
  if (isInEditor == null) {
@@ -2455,18 +2484,27 @@ function antfu(options = {}, ...userConfigs) {
2455
2484
  console.log("[@whoj/eslint-config] Detected running in editor, some rules are disabled.");
2456
2485
  }
2457
2486
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2487
+ if (stylisticOptions) {
2488
+ stylisticOptions.overrides = {
2489
+ ...stylisticOptions.overrides || {},
2490
+ "style/comma-dangle": ["error", "never"],
2491
+ "style/quotes": ["error", "single"],
2492
+ "style/semi": [2, "always"],
2493
+ "style/spaced-comment": "off"
2494
+ };
2495
+ }
2458
2496
  if (stylisticOptions && !("jsx" in stylisticOptions))
2459
2497
  stylisticOptions.jsx = enableJsx;
2460
2498
  const configs2 = [];
2461
2499
  if (enableGitignore) {
2462
2500
  if (typeof enableGitignore !== "boolean") {
2463
2501
  configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
2464
- name: "antfu/gitignore",
2502
+ name: "whoj/gitignore",
2465
2503
  ...enableGitignore
2466
2504
  })]));
2467
2505
  } else {
2468
2506
  configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
2469
- name: "antfu/gitignore",
2507
+ name: "whoj/gitignore",
2470
2508
  strict: false
2471
2509
  })]));
2472
2510
  }
@@ -2616,6 +2654,27 @@ function antfu(options = {}, ...userConfigs) {
2616
2654
  }, {});
2617
2655
  if (Object.keys(fusedConfig).length)
2618
2656
  configs2.push([fusedConfig]);
2657
+ configs2.push([{
2658
+ rules: {
2659
+ "eqeqeq": "warn",
2660
+ "import/order": "off",
2661
+ "no-useless-escape": "warn",
2662
+ "require-await": "warn"
2663
+ }
2664
+ }]);
2665
+ if (enableNuxt) {
2666
+ const { dirs, features = {} } = resolveSubOptions(options, "nuxt");
2667
+ configs2.push(nuxt({
2668
+ dirs,
2669
+ features: {
2670
+ ...features,
2671
+ stylistic: features.stylistic === false ? false : {
2672
+ ...stylisticOptions,
2673
+ ...typeof features.stylistic !== "object" ? {} : features.stylistic
2674
+ }
2675
+ }
2676
+ }));
2677
+ }
2619
2678
  let composer = new FlatConfigComposer();
2620
2679
  composer = composer.append(
2621
2680
  ...configs2,
@@ -2650,7 +2709,7 @@ function getOverrides(options, key) {
2650
2709
  init_esm_shims();
2651
2710
 
2652
2711
  // src/index.ts
2653
- var index_default = antfu;
2712
+ var index_default = whoj;
2654
2713
  export {
2655
2714
  GLOB_ALL_SRC,
2656
2715
  GLOB_ASTRO,
@@ -2683,7 +2742,6 @@ export {
2683
2742
  GLOB_XML,
2684
2743
  GLOB_YAML,
2685
2744
  StylisticConfigDefaults,
2686
- antfu,
2687
2745
  astro,
2688
2746
  combine,
2689
2747
  command,
@@ -2706,6 +2764,7 @@ export {
2706
2764
  jsx,
2707
2765
  markdown,
2708
2766
  node,
2767
+ nuxt,
2709
2768
  parserPlain,
2710
2769
  perfectionist,
2711
2770
  react,
@@ -2725,5 +2784,6 @@ export {
2725
2784
  unicorn,
2726
2785
  unocss,
2727
2786
  vue,
2787
+ whoj,
2728
2788
  yaml
2729
2789
  };