@whoj/eslint-config 2.1.0 → 2.2.1

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: "whoj/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: "whoj/astro/rules",
229
- processor: "astro/client-side-ts",
230
187
  rules: {
231
- // use recommended rules
232
- "astro/missing-client-only-directive-value": "error",
233
- "astro/no-conflict-set-directives": "error",
234
- "astro/no-deprecated-astro-canonicalurl": "error",
235
- "astro/no-deprecated-astro-fetchcontent": "error",
236
- "astro/no-deprecated-astro-resolve": "error",
237
- "astro/no-deprecated-getentrybyslug": "error",
238
- "astro/no-set-html-directive": "off",
239
- "astro/no-unused-define-vars-in-style": "error",
240
- "astro/semi": "off",
241
- "astro/valid-compile": "error",
242
- // Astro uses top level await for e.g. data fetching
243
- // https://docs.astro.build/en/guides/data-fetching/#fetch-in-astro
244
- "whoj/no-top-level-await": "off",
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: "whoj/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: "whoj/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: "whoj/disables/scripts",
307
- rules: {
308
- "no-console": "off",
309
- "ts/explicit-function-return-type": "off",
310
- "whoj/no-top-level-await": "off"
311
- }
312
- },
313
- {
314
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
315
- name: "whoj/disables/cli",
316
- rules: {
317
- "no-console": "off",
318
- "whoj/no-top-level-await": "off"
319
- }
320
- },
321
- {
322
- files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
323
- name: "whoj/disables/bin",
324
- rules: {
325
- "whoj/no-import-dist": "off",
326
- "whoj/no-import-node-modules-by-path": "off"
327
- }
328
- },
329
- {
330
- files: ["**/*.d.?([cm])ts"],
331
- name: "whoj/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: "whoj/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: "whoj/disables/config-files",
349
- rules: {
350
- "no-console": "off",
351
- "ts/explicit-function-return-type": "off",
352
- "whoj/no-top-level-await": "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: "whoj/stylistic/rules",
394
- plugins: {
395
- style: pluginStylistic,
396
- whoj: default3
397
- },
398
- rules: {
399
- ...config.rules,
400
- "whoj/consistent-chaining": "error",
401
- "whoj/consistent-list-newline": "error",
402
- ...lessOpinionated ? {
403
- curly: ["error", "all"]
404
- } : {
405
- "whoj/curly": "error",
406
- "whoj/if-newline": "error",
407
- "whoj/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 = {}) {
@@ -692,207 +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: "whoj/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: "whoj/imports/rules",
718
- plugins: {
719
- import: pluginImport,
720
- whoj: default3
574
+ files: [GLOB_JSX, GLOB_TSX],
575
+ languageOptions: {
576
+ parserOptions: {
577
+ ecmaFeatures: {
578
+ jsx: true
579
+ }
580
+ }
721
581
  },
722
- rules: {
723
- "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
724
- "import/first": "error",
725
- "import/no-duplicates": "error",
726
- "import/no-mutable-exports": "error",
727
- "import/no-named-default": "error",
728
- "import/no-self-import": "error",
729
- "import/no-webpack-loader-syntax": "error",
730
- "whoj/import-dedupe": "error",
731
- "whoj/no-import-dist": "error",
732
- "whoj/no-import-node-modules-by-path": "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: "whoj/javascript/setup"
774
- },
775
- {
776
- name: "whoj/javascript/rules",
777
- plugins: {
778
- "unused-imports": default7,
779
- "whoj": default3
648
+ }
780
649
  },
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
+ ]),
781
661
  rules: {
782
- "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
783
- "array-callback-return": "error",
784
- "block-scoped-var": "error",
785
- "constructor-super": "error",
786
- "default-case-last": "error",
787
- "dot-notation": ["error", { allowKeywords: true }],
788
- "eqeqeq": ["error", "smart"],
789
- "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
790
- "no-alert": "error",
791
- "no-array-constructor": "error",
792
- "no-async-promise-executor": "error",
793
- "no-caller": "error",
794
- "no-case-declarations": "error",
795
- "no-class-assign": "error",
796
- "no-compare-neg-zero": "error",
797
- "no-cond-assign": ["error", "always"],
798
- "no-console": ["error", { allow: ["warn", "error"] }],
799
- "no-const-assign": "error",
800
- "no-control-regex": "error",
801
- "no-debugger": "error",
802
- "no-delete-var": "error",
803
- "no-dupe-args": "error",
804
- "no-dupe-class-members": "error",
805
- "no-dupe-keys": "error",
806
- "no-duplicate-case": "error",
807
- "no-empty": ["error", { allowEmptyCatch: true }],
808
- "no-empty-character-class": "error",
809
- "no-empty-pattern": "error",
810
- "no-eval": "error",
811
- "no-ex-assign": "error",
812
- "no-extend-native": "error",
813
- "no-extra-bind": "error",
814
- "no-extra-boolean-cast": "error",
815
- "no-fallthrough": "error",
816
- "no-func-assign": "error",
817
- "no-global-assign": "error",
818
- "no-implied-eval": "error",
819
- "no-import-assign": "error",
820
- "no-invalid-regexp": "error",
821
- "no-irregular-whitespace": "error",
822
- "no-iterator": "error",
823
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
824
- "no-lone-blocks": "error",
825
- "no-loss-of-precision": "error",
826
- "no-misleading-character-class": "error",
827
- "no-multi-str": "error",
828
- "no-new": "error",
829
- "no-new-func": "error",
830
- "no-new-native-nonconstructor": "error",
831
- "no-new-wrappers": "error",
832
- "no-obj-calls": "error",
833
- "no-octal": "error",
834
- "no-octal-escape": "error",
835
- "no-proto": "error",
836
- "no-prototype-builtins": "error",
837
- "no-redeclare": ["error", { builtinGlobals: false }],
838
- "no-regex-spaces": "error",
839
- "no-restricted-globals": [
840
- "error",
841
- { message: "Use `globalThis` instead.", name: "global" },
842
- { message: "Use `globalThis` instead.", name: "self" }
843
- ],
844
- "no-restricted-properties": [
845
- "error",
846
- { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
847
- { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
848
- { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
849
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
850
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
851
- ],
852
- "no-restricted-syntax": [
853
- "error",
854
- "TSEnumDeclaration[const=true]",
855
- "TSExportAssignment"
856
- ],
857
- "no-self-assign": ["error", { props: true }],
858
- "no-self-compare": "error",
859
- "no-sequences": "error",
860
- "no-shadow-restricted-names": "error",
861
- "no-sparse-arrays": "error",
862
- "no-template-curly-in-string": "error",
863
- "no-this-before-super": "error",
864
- "no-throw-literal": "error",
865
- "no-undef": "error",
866
- "no-undef-init": "error",
867
- "no-unexpected-multiline": "error",
868
- "no-unmodified-loop-condition": "error",
869
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
870
- "no-unreachable": "error",
871
- "no-unreachable-loop": "error",
872
- "no-unsafe-finally": "error",
873
- "no-unsafe-negation": "error",
874
- "no-unused-expressions": ["error", {
875
- allowShortCircuit: true,
876
- allowTaggedTemplates: true,
877
- allowTernary: true
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"]
878
676
  }],
879
- "no-unused-vars": ["error", {
880
- args: "none",
881
- caughtErrors: "none",
882
- ignoreRestSiblings: true,
883
- 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"]
884
684
  }],
885
- "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
886
- "no-useless-backreference": "error",
887
- "no-useless-call": "error",
888
- "no-useless-catch": "error",
889
- "no-useless-computed-key": "error",
890
- "no-useless-constructor": "error",
891
- "no-useless-rename": "error",
892
- "no-useless-return": "error",
893
- "no-var": "error",
894
- "no-with": "error",
895
- "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": [
896
709
  "error",
897
710
  "always",
898
711
  {
@@ -900,157 +713,39 @@ async function javascript(options = {}) {
900
713
  ignoreConstructors: false
901
714
  }
902
715
  ],
903
- "one-var": ["error", { initialized: "never" }],
904
- "prefer-arrow-callback": [
905
- "error",
906
- {
907
- allowNamedFunctions: false,
908
- allowUnboundThis: true
909
- }
910
- ],
911
- "prefer-const": [
912
- isInEditor ? "warn" : "error",
913
- {
914
- destructuring: "all",
915
- ignoreReadBeforeAssign: true
916
- }
917
- ],
918
- "prefer-exponentiation-operator": "error",
919
- "prefer-promise-reject-errors": "error",
920
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
921
- "prefer-rest-params": "error",
922
- "prefer-spread": "error",
923
- "prefer-template": "error",
924
- "symbol-description": "error",
925
- "unicode-bom": ["error", "never"],
926
- "unused-imports/no-unused-imports": isInEditor ? "warn" : "error",
927
- "unused-imports/no-unused-vars": [
928
- "error",
929
- {
930
- args: "after-used",
931
- argsIgnorePattern: "^_",
932
- ignoreRestSiblings: true,
933
- vars: "all",
934
- varsIgnorePattern: "^_"
935
- }
936
- ],
937
- "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
938
- "valid-typeof": ["error", { requireStringLiterals: true }],
939
- "vars-on-top": "error",
940
- "whoj/no-top-level-await": "error",
941
- "yoda": ["error", "never"],
942
- ...overrides
943
- }
944
- }
945
- ];
946
- }
947
-
948
- // src/configs/jsdoc.ts
949
- init_esm_shims();
950
- async function jsdoc(options = {}) {
951
- const {
952
- stylistic: stylistic2 = true
953
- } = options;
954
- return [
955
- {
956
- name: "whoj/jsdoc/rules",
957
- plugins: {
958
- jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
959
- },
960
- 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
- } : {}
980
- }
981
- }
982
- ];
983
- }
984
-
985
- // src/configs/jsonc.ts
986
- 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: "whoj/jsonc/setup",
1006
- plugins: {
1007
- jsonc: pluginJsonc
1008
- }
1009
- },
1010
- {
1011
- files,
1012
- languageOptions: {
1013
- parser: parserJsonc
1014
- },
1015
- name: "whoj/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",
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",
1043
724
  ...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"
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"
1054
749
  } : {},
1055
750
  ...overrides
1056
751
  }
@@ -1058,105 +753,6 @@ async function jsonc(options = {}) {
1058
753
  ];
1059
754
  }
1060
755
 
1061
- // src/configs/jsx.ts
1062
- init_esm_shims();
1063
- async function jsx() {
1064
- return [
1065
- {
1066
- files: [GLOB_JSX, GLOB_TSX],
1067
- languageOptions: {
1068
- parserOptions: {
1069
- ecmaFeatures: {
1070
- jsx: true
1071
- }
1072
- }
1073
- },
1074
- name: "whoj/jsx/setup"
1075
- }
1076
- ];
1077
- }
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"));
1089
- return [
1090
- {
1091
- name: "whoj/markdown/setup",
1092
- plugins: {
1093
- markdown: markdown2
1094
- }
1095
- },
1096
- {
1097
- files,
1098
- ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1099
- name: "whoj/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: "whoj/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: "whoj/markdown/disables",
1128
- rules: {
1129
- "import/newline-after-import": "off",
1130
- "no-alert": "off",
1131
- "no-console": "off",
1132
- "no-labels": "off",
1133
- "no-lone-blocks": "off",
1134
- "no-restricted-syntax": "off",
1135
- "no-undef": "off",
1136
- "no-unused-expressions": "off",
1137
- "no-unused-labels": "off",
1138
- "no-unused-vars": "off",
1139
- "node/prefer-global/process": "off",
1140
- "style/comma-dangle": "off",
1141
- "style/eol-last": "off",
1142
- "ts/consistent-type-imports": "off",
1143
- "ts/explicit-function-return-type": "off",
1144
- "ts/no-namespace": "off",
1145
- "ts/no-redeclare": "off",
1146
- "ts/no-require-imports": "off",
1147
- "ts/no-unused-expressions": "off",
1148
- "ts/no-unused-vars": "off",
1149
- "ts/no-use-before-define": "off",
1150
- "unicode-bom": "off",
1151
- "unused-imports/no-unused-imports": "off",
1152
- "unused-imports/no-unused-vars": "off",
1153
- "whoj/no-top-level-await": "off",
1154
- ...overrides
1155
- }
1156
- }
1157
- ];
1158
- }
1159
-
1160
756
  // src/configs/node.ts
1161
757
  init_esm_shims();
1162
758
  async function node() {
@@ -1164,7 +760,7 @@ async function node() {
1164
760
  {
1165
761
  name: "whoj/node/rules",
1166
762
  plugins: {
1167
- node: default4
763
+ node: default2
1168
764
  },
1169
765
  rules: {
1170
766
  "node/handle-callback-err": ["error", "^(err|error)$"],
@@ -1172,56 +768,621 @@ async function node() {
1172
768
  "node/no-exports-assign": "error",
1173
769
  "node/no-new-require": "error",
1174
770
  "node/no-path-concat": "error",
1175
- "node/prefer-global/buffer": ["error", "never"],
1176
- "node/prefer-global/process": ["error", "never"],
771
+ "node/prefer-global/buffer": ["off"],
772
+ "node/prefer-global/process": ["off"],
1177
773
  "node/process-exit-as-throw": "error"
1178
774
  }
1179
775
  }
1180
776
  ];
1181
777
  }
1182
778
 
1183
- // src/configs/perfectionist.ts
779
+ // src/configs/nuxt.ts
1184
780
  init_esm_shims();
1185
- async function perfectionist() {
1186
- return [
1187
- {
1188
- name: "whoj/perfectionist/setup",
1189
- plugins: {
1190
- perfectionist: default5
1191
- },
1192
- 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" }]
1212
- }
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
1213
788
  }
1214
- ];
789
+ }).append({
790
+ name: "whoj/nuxt/rules",
791
+ rules: {}
792
+ }).toConfigs();
1215
793
  }
1216
794
 
1217
- // src/configs/react.ts
795
+ // src/configs/sort.ts
1218
796
  init_esm_shims();
1219
- import { isPackageExists as isPackageExists3 } from "local-pkg";
1220
- var ReactRefreshAllowConstantExportPackages = [
1221
- "vite"
1222
- ];
1223
- var RemixPackages = [
1224
- "@remix-run/node",
797
+ async function sortPackageJson() {
798
+ return [
799
+ {
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$"
808
+ }
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
+ }
896
+ }
897
+ ];
898
+ }
899
+ function sortTsconfig() {
900
+ return [
901
+ {
902
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
903
+ name: "whoj/sort/tsconfig-json",
904
+ rules: {
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
+ ]
1021
+ }
1022
+ }
1023
+ ];
1024
+ }
1025
+
1026
+ // src/configs/test.ts
1027
+ init_esm_shims();
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
+ };
1051
+ return [
1052
+ {
1053
+ name: "whoj/test/setup",
1054
+ plugins: {
1055
+ test: _pluginTest
1056
+ }
1057
+ },
1058
+ {
1059
+ files,
1060
+ name: "whoj/test/rules",
1061
+ rules: {
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
1076
+ }
1077
+ }
1078
+ ];
1079
+ }
1080
+
1081
+ // src/configs/toml.ts
1082
+ init_esm_shims();
1083
+ async function toml(options = {}) {
1084
+ const {
1085
+ files = [GLOB_TOML],
1086
+ overrides = {},
1087
+ stylistic: stylistic2 = true
1088
+ } = options;
1089
+ const {
1090
+ indent = 2
1091
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1092
+ const [
1093
+ pluginToml,
1094
+ parserToml
1095
+ ] = await Promise.all([
1096
+ interopDefault(import("eslint-plugin-toml")),
1097
+ interopDefault(import("toml-eslint-parser"))
1098
+ ]);
1099
+ return [
1100
+ {
1101
+ name: "whoj/toml/setup",
1102
+ plugins: {
1103
+ toml: pluginToml
1104
+ }
1105
+ },
1106
+ {
1107
+ files,
1108
+ languageOptions: {
1109
+ parser: parserToml
1110
+ },
1111
+ name: "whoj/toml/rules",
1112
+ rules: {
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
+ } : {},
1135
+ ...overrides
1136
+ }
1137
+ }
1138
+ ];
1139
+ }
1140
+
1141
+ // src/configs/yaml.ts
1142
+ init_esm_shims();
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
+ ]);
1160
+ return [
1161
+ {
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",
1173
+ rules: {
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
1196
+ }
1197
+ }
1198
+ ];
1199
+ }
1200
+
1201
+ // src/configs/astro.ts
1202
+ init_esm_shims();
1203
+ async function astro(options = {}) {
1204
+ const {
1205
+ files = [GLOB_ASTRO],
1206
+ overrides = {},
1207
+ stylistic: stylistic2 = true
1208
+ } = options;
1209
+ const [
1210
+ pluginAstro,
1211
+ parserAstro,
1212
+ parserTs
1213
+ ] = await Promise.all([
1214
+ interopDefault(import("./lib-FENTQ4WJ.js")),
1215
+ interopDefault(import("./lib-WKUBBNE4.js")),
1216
+ interopDefault(import("@typescript-eslint/parser"))
1217
+ ]);
1218
+ return [
1219
+ {
1220
+ name: "whoj/astro/setup",
1221
+ plugins: {
1222
+ astro: pluginAstro
1223
+ }
1224
+ },
1225
+ {
1226
+ files,
1227
+ languageOptions: {
1228
+ globals: pluginAstro.environments.astro.globals,
1229
+ parser: parserAstro,
1230
+ parserOptions: {
1231
+ extraFileExtensions: [".astro"],
1232
+ parser: parserTs
1233
+ },
1234
+ sourceType: "module"
1235
+ },
1236
+ name: "whoj/astro/rules",
1237
+ processor: "astro/client-side-ts",
1238
+ rules: {
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 [
1272
+ {
1273
+ name: "whoj/jsdoc/rules",
1274
+ plugins: {
1275
+ jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
1276
+ },
1277
+ rules: {
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
+ } : {}
1297
+ }
1298
+ }
1299
+ ];
1300
+ }
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
+ ]);
1320
+ return [
1321
+ {
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",
1333
+ rules: {
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",
1225
1386
  "@remix-run/react",
1226
1387
  "@remix-run/serve",
1227
1388
  "@remix-run/dev"
@@ -1384,352 +1545,95 @@ async function react(options = {}) {
1384
1545
  "react/no-unused-class-component-members": "warn",
1385
1546
  "react/no-unused-state": "warn",
1386
1547
  "react/prefer-destructuring-assignment": "warn",
1387
- "react/prefer-shorthand-boolean": "warn",
1388
- "react/prefer-shorthand-fragment": "warn",
1389
- // overrides
1390
- ...overrides
1391
- }
1392
- },
1393
- ...isTypeAware ? [{
1394
- files: filesTypeAware,
1395
- ignores: ignoresTypeAware,
1396
- name: "whoj/react/type-aware-rules",
1397
- rules: {
1398
- ...typeAwareRules
1399
- }
1400
- }] : []
1401
- ];
1402
- }
1403
-
1404
- // src/configs/regexp.ts
1405
- 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
- }
1418
- return [
1419
- {
1420
- ...config,
1421
- name: "whoj/regexp/rules",
1422
- rules: {
1423
- ...rules,
1424
- ...options.overrides
1425
- }
1426
- }
1427
- ];
1428
- }
1429
-
1430
- // src/configs/solid.ts
1431
- init_esm_shims();
1432
- async function solid(options = {}) {
1433
- const {
1434
- files = [GLOB_JSX, GLOB_TSX],
1435
- overrides = {},
1436
- typescript: typescript2 = true
1437
- } = options;
1438
- await ensurePackages([
1439
- "eslint-plugin-solid"
1440
- ]);
1441
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1442
- const isTypeAware = !!tsconfigPath;
1443
- const [
1444
- pluginSolid,
1445
- parserTs
1446
- ] = await Promise.all([
1447
- interopDefault(import("./dist-MYXPM6TG.js")),
1448
- interopDefault(import("@typescript-eslint/parser"))
1449
- ]);
1450
- return [
1451
- {
1452
- name: "whoj/solid/setup",
1453
- plugins: {
1454
- solid: pluginSolid
1455
- }
1456
- },
1457
- {
1458
- files,
1459
- languageOptions: {
1460
- parser: parserTs,
1461
- parserOptions: {
1462
- ecmaFeatures: {
1463
- jsx: true
1464
- },
1465
- ...isTypeAware ? { project: tsconfigPath } : {}
1466
- },
1467
- sourceType: "module"
1468
- },
1469
- name: "whoj/solid/rules",
1470
- 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
- } : {},
1548
+ "react/prefer-shorthand-boolean": "warn",
1549
+ "react/prefer-shorthand-fragment": "warn",
1500
1550
  // overrides
1501
1551
  ...overrides
1502
1552
  }
1503
- }
1504
- ];
1505
- }
1506
-
1507
- // src/configs/sort.ts
1508
- init_esm_shims();
1509
- async function sortPackageJson() {
1510
- return [
1511
- {
1512
- files: ["**/package.json"],
1513
- name: "whoj/sort/package-json",
1553
+ },
1554
+ ...isTypeAware ? [{
1555
+ files: filesTypeAware,
1556
+ ignores: ignoresTypeAware,
1557
+ name: "whoj/react/type-aware-rules",
1514
1558
  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
- ]
1559
+ ...typeAwareRules
1607
1560
  }
1608
- }
1561
+ }] : []
1609
1562
  ];
1610
1563
  }
1611
- function sortTsconfig() {
1612
- return [
1613
- {
1614
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1615
- name: "whoj/sort/tsconfig-json",
1616
- 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$"
1731
- }
1732
- ]
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
  ];
@@ -1835,277 +1739,95 @@ async function svelte(options = {}) {
1835
1739
  ];
1836
1740
  }
1837
1741
 
1838
- // src/configs/test.ts
1742
+ // src/configs/unocss.ts
1839
1743
  init_esm_shims();
1840
- var _pluginTest;
1841
- async function test(options = {}) {
1744
+ async function unocss(options = {}) {
1842
1745
  const {
1843
- files = GLOB_TESTS,
1844
- isInEditor = false,
1845
- overrides = {}
1746
+ attributify = true,
1747
+ strict = false
1846
1748
  } = options;
1749
+ await ensurePackages([
1750
+ "@unocss/eslint-plugin"
1751
+ ]);
1847
1752
  const [
1848
- pluginVitest,
1849
- pluginNoOnlyTests
1753
+ pluginUnoCSS
1850
1754
  ] = await Promise.all([
1851
- interopDefault(import("@vitest/eslint-plugin")),
1852
- // @ts-expect-error missing types
1853
- interopDefault(import("eslint-plugin-no-only-tests"))
1755
+ interopDefault(import("@unocss/eslint-plugin"))
1854
1756
  ]);
1855
- _pluginTest = _pluginTest || {
1856
- ...pluginVitest,
1857
- rules: {
1858
- ...pluginVitest.rules,
1859
- // extend `test/no-only-tests` rule
1860
- ...pluginNoOnlyTests.rules
1861
- }
1862
- };
1863
1757
  return [
1864
1758
  {
1865
- name: "whoj/test/setup",
1759
+ name: "whoj/unocss",
1866
1760
  plugins: {
1867
- test: _pluginTest
1868
- }
1869
- },
1870
- {
1871
- files,
1872
- name: "whoj/test/rules",
1761
+ unocss: pluginUnoCSS
1762
+ },
1873
1763
  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
- "no-unused-expressions": "off",
1883
- "node/prefer-global/process": "off",
1884
- "ts/explicit-function-return-type": "off",
1885
- "whoj/no-top-level-await": "off"
1886
- },
1887
- ...overrides
1764
+ "unocss/order": "warn",
1765
+ ...attributify ? {
1766
+ "unocss/order-attributify": "warn"
1767
+ } : {},
1768
+ ...strict ? {
1769
+ "unocss/blocklist": "error"
1770
+ } : {}
1888
1771
  }
1889
1772
  }
1890
1773
  ];
1891
1774
  }
1892
1775
 
1893
- // src/configs/toml.ts
1776
+ // src/configs/command.ts
1894
1777
  init_esm_shims();
1895
- async function toml(options = {}) {
1896
- const {
1897
- files = [GLOB_TOML],
1898
- overrides = {},
1899
- stylistic: stylistic2 = true
1900
- } = 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"))
1910
- ]);
1778
+ import createCommand from "eslint-plugin-command/config";
1779
+ async function command() {
1911
1780
  return [
1912
1781
  {
1913
- name: "whoj/toml/setup",
1914
- plugins: {
1915
- toml: pluginToml
1916
- }
1917
- },
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 [
1918
1792
  {
1919
- files,
1920
- languageOptions: {
1921
- parser: parserToml
1922
- },
1923
- name: "whoj/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
- }
1793
+ ignores: [
1794
+ ...GLOB_EXCLUDE,
1795
+ ...userIgnores
1796
+ ],
1797
+ name: "whoj/ignores"
1949
1798
  }
1950
1799
  ];
1951
1800
  }
1952
1801
 
1953
- // src/configs/typescript.ts
1802
+ // src/configs/imports.ts
1954
1803
  init_esm_shims();
1955
- import process2 from "node:process";
1956
- async function typescript(options = {}) {
1804
+ async function imports(options = {}) {
1957
1805
  const {
1958
- componentExts = [],
1959
- overrides = {},
1960
- overridesTypeAware = {},
1961
- parserOptions = {},
1962
- type = "app"
1806
+ stylistic: stylistic2 = true
1963
1807
  } = 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
- const [
2000
- pluginTs,
2001
- parserTs
2002
- ] = 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: `whoj/typescript/${typeAware ? "type-aware-parser" : "parser"}`
2026
- };
2027
- }
2028
1808
  return [
2029
1809
  {
2030
- // Install the plugins without globs, so they can be configured separately.
2031
- name: "whoj/typescript/setup",
1810
+ name: "whoj/imports/rules",
2032
1811
  plugins: {
2033
- ts: pluginTs,
1812
+ import: pluginImport,
2034
1813
  whoj: default3
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: "whoj/typescript/rules",
2047
- 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
- }]
2096
- } : {},
2097
- ...overrides
2098
- }
2099
- },
2100
- ...isTypeAware ? [{
2101
- files: filesTypeAware,
2102
- ignores: ignoresTypeAware,
2103
- name: "whoj/typescript/rules-type-aware",
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
 
@@ -2116,10 +1838,10 @@ async function unicorn(options = {}) {
2116
1838
  {
2117
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: "whoj/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: "whoj/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: "whoj/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
- "node/prefer-global/process": "off",
2264
- "ts/explicit-function-return-type": "off",
2265
- "vue/block-order": ["error", {
2266
- 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
2267
2161
  }],
2268
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
2269
- "vue/component-options-name-casing": ["error", "PascalCase"],
2270
- // this is deprecated
2271
- "vue/component-tags-order": "off",
2272
- "vue/custom-event-name-casing": ["error", "camelCase"],
2273
- "vue/define-macros-order": ["error", {
2274
- order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
2162
+ "no-unused-vars": ["error", {
2163
+ args: "none",
2164
+ caughtErrors: "none",
2165
+ ignoreRestSiblings: true,
2166
+ vars: "all"
2275
2167
  }],
2276
- "vue/dot-location": ["error", "property"],
2277
- "vue/dot-notation": ["error", { allowKeywords: true }],
2278
- "vue/eqeqeq": ["error", "smart"],
2279
- "vue/html-indent": ["error", indent],
2280
- "vue/html-quotes": ["error", "double"],
2281
- "vue/max-attributes-per-line": "off",
2282
- "vue/multi-word-component-names": "off",
2283
- "vue/no-dupe-keys": "off",
2284
- "vue/no-empty-pattern": "error",
2285
- "vue/no-irregular-whitespace": "error",
2286
- "vue/no-loss-of-precision": "error",
2287
- "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": [
2288
2179
  "error",
2289
- "DebuggerStatement",
2290
- "LabeledStatement",
2291
- "WithStatement"
2180
+ "always",
2181
+ {
2182
+ avoidQuotes: true,
2183
+ ignoreConstructors: false
2184
+ }
2292
2185
  ],
2293
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
2294
- "vue/no-setup-props-reactivity-loss": "off",
2295
- "vue/no-sparse-arrays": "error",
2296
- "vue/no-unused-refs": "error",
2297
- "vue/no-useless-v-bind": "error",
2298
- "vue/no-v-html": "off",
2299
- "vue/object-shorthand": [
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
+ }
2200
+ ],
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": [
2300
2211
  "error",
2301
- "always",
2302
2212
  {
2303
- avoidQuotes: true,
2304
- ignoreConstructors: false
2213
+ args: "after-used",
2214
+ argsIgnorePattern: "^_",
2215
+ ignoreRestSiblings: true,
2216
+ vars: "all",
2217
+ varsIgnorePattern: "^_"
2305
2218
  }
2306
2219
  ],
2307
- "vue/prefer-separate-static-class": "error",
2308
- "vue/prefer-template": "error",
2309
- "vue/prop-name-casing": ["error", "camelCase"],
2310
- "vue/require-default-prop": "off",
2311
- "vue/require-prop-types": "off",
2312
- "vue/space-infix-ops": "error",
2313
- "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
2314
- "whoj/no-top-level-await": "off",
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: "whoj/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: "whoj/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",
@@ -2439,6 +2467,7 @@ function whoj(options = {}, ...userConfigs) {
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 whoj(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,6 +2484,15 @@ function whoj(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 = [];
@@ -2616,6 +2654,27 @@ function whoj(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,
@@ -2705,6 +2764,7 @@ export {
2705
2764
  jsx,
2706
2765
  markdown,
2707
2766
  node,
2767
+ nuxt,
2708
2768
  parserPlain,
2709
2769
  perfectionist,
2710
2770
  react,