@liwo/eslint-config 0.2.0 → 0.2.3-beta.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.
Files changed (4) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +3099 -2529
  3. package/dist/index.js +118 -151
  4. package/package.json +53 -56
package/dist/index.js CHANGED
@@ -13,7 +13,6 @@ import { fileURLToPath } from "node:url";
13
13
  import globals from "globals";
14
14
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
15
15
  import { configs } from "eslint-plugin-regexp";
16
-
17
16
  //#region src/configs/command.ts
18
17
  async function command() {
19
18
  return [{
@@ -21,7 +20,6 @@ async function command() {
21
20
  name: "liwo/command/rules"
22
21
  }];
23
22
  }
24
-
25
23
  //#endregion
26
24
  //#region src/configs/comments.ts
27
25
  async function comments() {
@@ -36,7 +34,6 @@ async function comments() {
36
34
  }
37
35
  }];
38
36
  }
39
-
40
37
  //#endregion
41
38
  //#region src/globs.ts
42
39
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -114,7 +111,6 @@ const GLOB_EXCLUDE = [
114
111
  "**/auto-import?(s).d.ts",
115
112
  "**/components.d.ts"
116
113
  ];
117
-
118
114
  //#endregion
119
115
  //#region src/configs/disables.ts
120
116
  async function disables() {
@@ -169,7 +165,6 @@ async function disables() {
169
165
  }
170
166
  ];
171
167
  }
172
-
173
168
  //#endregion
174
169
  //#region src/utils.ts
175
170
  const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
@@ -196,8 +191,8 @@ const parserPlain = {
196
191
  /**
197
192
  * Combine array and non-array configs into a single array.
198
193
  */
199
- async function combine(...configs$1) {
200
- return (await Promise.all(configs$1)).flat();
194
+ async function combine(...configs) {
195
+ return (await Promise.all(configs)).flat();
201
196
  }
202
197
  /**
203
198
  * Rename plugin prefixes in a rule object.
@@ -237,8 +232,8 @@ function renameRules(rules, map) {
237
232
  * })
238
233
  * ```
239
234
  */
240
- function renamePluginInConfigs(configs$1, map) {
241
- return configs$1.map((i) => {
235
+ function renamePluginInConfigs(configs, map) {
236
+ return configs.map((i) => {
242
237
  const clone = { ...i };
243
238
  if (clone.rules) clone.rules = renameRules(clone.rules, map);
244
239
  if (clone.plugins) clone.plugins = Object.fromEntries(Object.entries(clone.plugins).map(([key, value]) => {
@@ -272,7 +267,6 @@ function isInEditorEnv() {
272
267
  function isInGitHooksOrLintStaged() {
273
268
  return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
274
269
  }
275
-
276
270
  //#endregion
277
271
  //#region src/configs/stylistic.ts
278
272
  const StylisticConfigDefaults = {
@@ -282,14 +276,14 @@ const StylisticConfigDefaults = {
282
276
  semi: false
283
277
  };
284
278
  async function stylistic(options = {}) {
285
- const { indent, jsx: jsx$1, lessOpinionated = false, overrides = {}, quotes, semi } = {
279
+ const { indent, jsx, lessOpinionated = false, overrides = {}, quotes, semi } = {
286
280
  ...StylisticConfigDefaults,
287
281
  ...options
288
282
  };
289
283
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
290
284
  const config = pluginStylistic.configs.customize({
291
285
  indent,
292
- jsx: jsx$1,
286
+ jsx,
293
287
  pluginName: "style",
294
288
  quotes,
295
289
  semi
@@ -322,7 +316,6 @@ async function stylistic(options = {}) {
322
316
  }
323
317
  }];
324
318
  }
325
-
326
319
  //#endregion
327
320
  //#region src/configs/formatters.ts
328
321
  function mergePrettierOptions(options, overrides = {}) {
@@ -332,7 +325,7 @@ function mergePrettierOptions(options, overrides = {}) {
332
325
  plugins: [...overrides.plugins || [], ...options.plugins || []]
333
326
  };
334
327
  }
335
- async function formatters(options = {}, stylistic$1 = {}) {
328
+ async function formatters(options = {}, stylistic = {}) {
336
329
  if (options === true) {
337
330
  const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
338
331
  options = {
@@ -353,7 +346,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
353
346
  if (options.slidev && options.markdown !== true && options.markdown !== "prettier") throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
354
347
  const { indent, quotes, semi } = {
355
348
  ...StylisticConfigDefaults,
356
- ...stylistic$1
349
+ ...stylistic
357
350
  };
358
351
  const prettierOptions = Object.assign({
359
352
  endOfLine: "auto",
@@ -375,11 +368,11 @@ async function formatters(options = {}, stylistic$1 = {}) {
375
368
  quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
376
369
  useTabs: indent === "tab"
377
370
  }, options.dprintOptions || {});
378
- const configs$1 = [{
371
+ const configs = [{
379
372
  name: "liwo/formatter/setup",
380
373
  plugins: { format: await interopDefault(import("eslint-plugin-format")) }
381
374
  }];
382
- if (options.css) configs$1.push({
375
+ if (options.css) configs.push({
383
376
  files: [GLOB_CSS, GLOB_POSTCSS],
384
377
  languageOptions: { parser: parserPlain },
385
378
  name: "liwo/formatter/css",
@@ -395,13 +388,13 @@ async function formatters(options = {}, stylistic$1 = {}) {
395
388
  name: "liwo/formatter/less",
396
389
  rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
397
390
  });
398
- if (options.html) configs$1.push({
391
+ if (options.html) configs.push({
399
392
  files: [GLOB_HTML],
400
393
  languageOptions: { parser: parserPlain },
401
394
  name: "liwo/formatter/html",
402
395
  rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
403
396
  });
404
- if (options.xml) configs$1.push({
397
+ if (options.xml) configs.push({
405
398
  files: [GLOB_XML],
406
399
  languageOptions: { parser: parserPlain },
407
400
  name: "liwo/formatter/xml",
@@ -413,7 +406,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
413
406
  plugins: ["@prettier/plugin-xml"]
414
407
  })] }
415
408
  });
416
- if (options.svg) configs$1.push({
409
+ if (options.svg) configs.push({
417
410
  files: [GLOB_SVG],
418
411
  languageOptions: { parser: parserPlain },
419
412
  name: "liwo/formatter/svg",
@@ -428,7 +421,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
428
421
  if (options.markdown) {
429
422
  const formater = options.markdown === true ? "prettier" : options.markdown;
430
423
  const GLOB_SLIDEV = !options.slidev ? [] : options.slidev === true ? ["**/slides.md"] : options.slidev.files;
431
- configs$1.push({
424
+ configs.push({
432
425
  files: [GLOB_MARKDOWN],
433
426
  ignores: GLOB_SLIDEV,
434
427
  languageOptions: { parser: parserPlain },
@@ -441,7 +434,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
441
434
  language: "markdown"
442
435
  }] }
443
436
  });
444
- if (options.slidev) configs$1.push({
437
+ if (options.slidev) configs.push({
445
438
  files: GLOB_SLIDEV,
446
439
  languageOptions: { parser: parserPlain },
447
440
  name: "liwo/formatter/slidev",
@@ -452,15 +445,14 @@ async function formatters(options = {}, stylistic$1 = {}) {
452
445
  })] }
453
446
  });
454
447
  }
455
- if (options.graphql) configs$1.push({
448
+ if (options.graphql) configs.push({
456
449
  files: [GLOB_GRAPHQL],
457
450
  languageOptions: { parser: parserPlain },
458
451
  name: "liwo/formatter/graphql",
459
452
  rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
460
453
  });
461
- return configs$1;
454
+ return configs;
462
455
  }
463
-
464
456
  //#endregion
465
457
  //#region src/configs/ignores.ts
466
458
  async function ignores(userIgnores = []) {
@@ -469,11 +461,10 @@ async function ignores(userIgnores = []) {
469
461
  name: "liwo/ignores"
470
462
  }];
471
463
  }
472
-
473
464
  //#endregion
474
465
  //#region src/configs/imports.ts
475
466
  async function imports(options = {}) {
476
- const { overrides = {}, stylistic: stylistic$1 = true } = options;
467
+ const { overrides = {}, stylistic = true } = options;
477
468
  return [{
478
469
  name: "liwo/imports/rules",
479
470
  plugins: {
@@ -489,12 +480,11 @@ async function imports(options = {}) {
489
480
  "import/no-duplicates": "error",
490
481
  "import/no-mutable-exports": "error",
491
482
  "import/no-named-default": "error",
492
- ...stylistic$1 ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
483
+ ...stylistic ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
493
484
  ...overrides
494
485
  }
495
486
  }];
496
487
  }
497
-
498
488
  //#endregion
499
489
  //#region src/configs/javascript.ts
500
490
  async function javascript(options = {}) {
@@ -719,11 +709,10 @@ async function javascript(options = {}) {
719
709
  }
720
710
  }];
721
711
  }
722
-
723
712
  //#endregion
724
713
  //#region src/configs/jsdoc.ts
725
714
  async function jsdoc(options = {}) {
726
- const { stylistic: stylistic$1 = true } = options;
715
+ const { stylistic = true } = options;
727
716
  return [{
728
717
  name: "liwo/jsdoc/rules",
729
718
  plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) },
@@ -743,14 +732,13 @@ async function jsdoc(options = {}) {
743
732
  "jsdoc/require-returns-check": "warn",
744
733
  "jsdoc/require-returns-description": "warn",
745
734
  "jsdoc/require-yields-check": "warn",
746
- ...stylistic$1 ? {
735
+ ...stylistic ? {
747
736
  "jsdoc/check-alignment": "warn",
748
737
  "jsdoc/multiline-blocks": "warn"
749
738
  } : {}
750
739
  }
751
740
  }];
752
741
  }
753
-
754
742
  //#endregion
755
743
  //#region src/configs/jsonc.ts
756
744
  async function jsonc(options = {}) {
@@ -758,8 +746,8 @@ async function jsonc(options = {}) {
758
746
  GLOB_JSON,
759
747
  GLOB_JSON5,
760
748
  GLOB_JSONC
761
- ], overrides = {}, stylistic: stylistic$1 = true } = options;
762
- const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
749
+ ], overrides = {}, stylistic = true } = options;
750
+ const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
763
751
  const [pluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
764
752
  return [{
765
753
  name: "liwo/jsonc/setup",
@@ -795,7 +783,7 @@ async function jsonc(options = {}) {
795
783
  "jsonc/space-unary-ops": "error",
796
784
  "jsonc/valid-json-number": "error",
797
785
  "jsonc/vue-custom-block/no-parsing-error": "error",
798
- ...stylistic$1 ? {
786
+ ...stylistic ? {
799
787
  "jsonc/array-bracket-spacing": ["error", "never"],
800
788
  "jsonc/comma-dangle": ["error", "never"],
801
789
  "jsonc/comma-style": ["error", "last"],
@@ -817,7 +805,6 @@ async function jsonc(options = {}) {
817
805
  }
818
806
  }];
819
807
  }
820
-
821
808
  //#endregion
822
809
  //#region src/configs/jsx.ts
823
810
  async function jsx() {
@@ -827,22 +814,21 @@ async function jsx() {
827
814
  name: "liwo/jsx/setup"
828
815
  }];
829
816
  }
830
-
831
817
  //#endregion
832
818
  //#region src/configs/markdown.ts
833
819
  async function markdown(options = {}) {
834
820
  const { componentExts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
835
- const markdown$1 = await interopDefault(import("@eslint/markdown"));
821
+ const markdown = await interopDefault(import("@eslint/markdown"));
836
822
  return [
837
823
  {
838
824
  name: "liwo/markdown/setup",
839
- plugins: { markdown: markdown$1 }
825
+ plugins: { markdown }
840
826
  },
841
827
  {
842
828
  files,
843
829
  ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
844
830
  name: "liwo/markdown/processor",
845
- processor: mergeProcessors([markdown$1.processors.markdown, processorPassThrough])
831
+ processor: mergeProcessors([markdown.processors.markdown, processorPassThrough])
846
832
  },
847
833
  {
848
834
  files,
@@ -884,7 +870,6 @@ async function markdown(options = {}) {
884
870
  }
885
871
  ];
886
872
  }
887
-
888
873
  //#endregion
889
874
  //#region src/configs/node.ts
890
875
  async function node() {
@@ -903,7 +888,6 @@ async function node() {
903
888
  }
904
889
  }];
905
890
  }
906
-
907
891
  //#endregion
908
892
  //#region src/configs/perfectionist.ts
909
893
  /**
@@ -922,26 +906,27 @@ async function perfectionist() {
922
906
  }],
923
907
  "perfectionist/sort-imports": ["error", {
924
908
  groups: [
925
- "type",
909
+ "type-import",
926
910
  [
927
- "parent-type",
928
- "sibling-type",
929
- "index-type",
930
- "internal-type"
911
+ "type-parent",
912
+ "type-sibling",
913
+ "type-index",
914
+ "type-internal"
931
915
  ],
932
- "builtin",
933
- "external",
934
- "internal",
916
+ "value-builtin",
917
+ "value-external",
918
+ "value-internal",
935
919
  [
936
- "parent",
937
- "sibling",
938
- "index"
920
+ "value-parent",
921
+ "value-sibling",
922
+ "value-index"
939
923
  ],
940
924
  "side-effect",
941
- "object",
925
+ "ts-equals-import",
942
926
  "unknown"
943
927
  ],
944
928
  newlinesBetween: "ignore",
929
+ newlinesInside: "ignore",
945
930
  order: "asc",
946
931
  type: "natural"
947
932
  }],
@@ -956,7 +941,6 @@ async function perfectionist() {
956
941
  }
957
942
  }];
958
943
  }
959
-
960
944
  //#endregion
961
945
  //#region src/configs/pnpm.ts
962
946
  async function pnpm() {
@@ -986,7 +970,6 @@ async function pnpm() {
986
970
  }
987
971
  }];
988
972
  }
989
-
990
973
  //#endregion
991
974
  //#region src/configs/react.ts
992
975
  const ReactRefreshAllowConstantExportPackages = ["vite"];
@@ -1011,7 +994,10 @@ async function react(options = {}) {
1011
994
  "eslint-plugin-react-refresh"
1012
995
  ]);
1013
996
  const isTypeAware = !!tsconfigPath;
1014
- const typeAwareRules = { "react/no-leaked-conditional-rendering": "warn" };
997
+ const typeAwareRules = {
998
+ "react/no-implicit-key": "error",
999
+ "react/no-leaked-conditional-rendering": "warn"
1000
+ };
1015
1001
  const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
1016
1002
  interopDefault(import("@eslint-react/eslint-plugin")),
1017
1003
  interopDefault(import("eslint-plugin-react-hooks")),
@@ -1021,18 +1007,13 @@ async function react(options = {}) {
1021
1007
  const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
1022
1008
  const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
1023
1009
  const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
1024
- const plugins = pluginReact.configs.all.plugins;
1025
1010
  return [
1026
1011
  {
1027
1012
  name: "liwo/react/setup",
1028
1013
  plugins: {
1029
- "react": plugins["@eslint-react"],
1030
- "react-dom": plugins["@eslint-react/dom"],
1014
+ "react": pluginReact,
1031
1015
  "react-hooks": pluginReactHooks,
1032
- "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1033
- "react-naming-convention": plugins["@eslint-react/naming-convention"],
1034
- "react-refresh": pluginReactRefresh,
1035
- "react-web-api": plugins["@eslint-react/web-api"]
1016
+ "react-refresh": pluginReactRefresh
1036
1017
  }
1037
1018
  },
1038
1019
  {
@@ -1043,9 +1024,6 @@ async function react(options = {}) {
1043
1024
  },
1044
1025
  name: "liwo/react/rules",
1045
1026
  rules: {
1046
- "react/jsx-no-comment-textnodes": "warn",
1047
- "react/jsx-no-duplicate-props": "warn",
1048
- "react/jsx-uses-vars": "warn",
1049
1027
  "react/no-access-state-in-setstate": "error",
1050
1028
  "react/no-array-index-key": "warn",
1051
1029
  "react/no-children-count": "warn",
@@ -1053,25 +1031,23 @@ async function react(options = {}) {
1053
1031
  "react/no-children-map": "warn",
1054
1032
  "react/no-children-only": "warn",
1055
1033
  "react/no-children-to-array": "warn",
1034
+ "react/no-class-component": "warn",
1056
1035
  "react/no-clone-element": "warn",
1057
1036
  "react/no-component-will-mount": "error",
1058
1037
  "react/no-component-will-receive-props": "error",
1059
1038
  "react/no-component-will-update": "error",
1060
1039
  "react/no-context-provider": "warn",
1061
1040
  "react/no-create-ref": "error",
1062
- "react/no-default-props": "error",
1063
1041
  "react/no-direct-mutation-state": "error",
1064
1042
  "react/no-duplicate-key": "warn",
1065
1043
  "react/no-forward-ref": "warn",
1066
- "react/no-implicit-key": "warn",
1044
+ "react/no-missing-component-display-name": "warn",
1067
1045
  "react/no-missing-key": "error",
1046
+ "react/no-misused-capture-owner-stack": "warn",
1068
1047
  "react/no-nested-component-definitions": "error",
1069
- "react/no-prop-types": "error",
1070
- "react/no-redundant-should-component-update": "error",
1071
1048
  "react/no-set-state-in-component-did-mount": "warn",
1072
1049
  "react/no-set-state-in-component-did-update": "warn",
1073
1050
  "react/no-set-state-in-component-will-update": "warn",
1074
- "react/no-string-refs": "error",
1075
1051
  "react/no-unnecessary-use-prefix": "warn",
1076
1052
  "react/no-unsafe-component-will-mount": "warn",
1077
1053
  "react/no-unsafe-component-will-receive-props": "warn",
@@ -1079,31 +1055,37 @@ async function react(options = {}) {
1079
1055
  "react/no-unstable-context-value": "warn",
1080
1056
  "react/no-unstable-default-props": "warn",
1081
1057
  "react/no-unused-class-component-members": "warn",
1082
- "react/no-unused-state": "warn",
1083
1058
  "react/no-use-context": "warn",
1084
- "react/no-useless-forward-ref": "warn",
1085
- "react/prefer-use-state-lazy-initialization": "warn",
1086
- "react-dom/no-dangerously-set-innerhtml": "warn",
1087
- "react-dom/no-dangerously-set-innerhtml-with-children": "error",
1088
- "react-dom/no-find-dom-node": "error",
1089
- "react-dom/no-flush-sync": "error",
1090
- "react-dom/no-hydrate": "error",
1091
- "react-dom/no-missing-button-type": "warn",
1092
- "react-dom/no-missing-iframe-sandbox": "warn",
1093
- "react-dom/no-namespace": "error",
1094
- "react-dom/no-render": "error",
1095
- "react-dom/no-render-return-value": "error",
1096
- "react-dom/no-script-url": "warn",
1097
- "react-dom/no-unsafe-iframe-sandbox": "warn",
1098
- "react-dom/no-unsafe-target-blank": "warn",
1099
- "react-dom/no-use-form-state": "error",
1100
- "react-dom/no-void-elements-with-children": "error",
1059
+ "react/jsx-no-comment-textnodes": "warn",
1060
+ "react/jsx-no-children-prop": "warn",
1061
+ "react/jsx-no-useless-fragment": "warn",
1062
+ "react/jsx-no-namespace": "error",
1063
+ "react/dom-no-dangerously-set-innerhtml": "warn",
1064
+ "react/dom-no-dangerously-set-innerhtml-with-children": "error",
1065
+ "react/dom-no-find-dom-node": "error",
1066
+ "react/dom-no-flush-sync": "error",
1067
+ "react/dom-no-hydrate": "error",
1068
+ "react/dom-no-missing-button-type": "warn",
1069
+ "react/dom-no-missing-iframe-sandbox": "warn",
1070
+ "react/dom-no-render": "error",
1071
+ "react/dom-no-render-return-value": "error",
1072
+ "react/dom-no-script-url": "warn",
1073
+ "react/dom-no-string-style-prop": "warn",
1074
+ "react/dom-no-unknown-property": "warn",
1075
+ "react/dom-no-unsafe-iframe-sandbox": "warn",
1076
+ "react/dom-no-unsafe-target-blank": "warn",
1077
+ "react/dom-no-use-form-state": "error",
1078
+ "react/dom-no-void-elements-with-children": "error",
1101
1079
  ...pluginReactHooks.configs.recommended.rules,
1102
- "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1103
- "react-web-api/no-leaked-event-listener": "warn",
1104
- "react-web-api/no-leaked-interval": "warn",
1105
- "react-web-api/no-leaked-resize-observer": "warn",
1106
- "react-web-api/no-leaked-timeout": "warn",
1080
+ "react/set-state-in-effect": "warn",
1081
+ "react/web-api-no-leaked-event-listener": "warn",
1082
+ "react/web-api-no-leaked-fetch": "warn",
1083
+ "react/web-api-no-leaked-interval": "warn",
1084
+ "react/web-api-no-leaked-resize-observer": "warn",
1085
+ "react/web-api-no-leaked-timeout": "warn",
1086
+ "react/naming-convention-context-name": "warn",
1087
+ "react/naming-convention-id-name": "warn",
1088
+ "react/naming-convention-ref-name": "warn",
1107
1089
  "react-refresh/only-export-components": ["warn", {
1108
1090
  allowConstantExport: isAllowConstantExport,
1109
1091
  allowExportNames: [...isUsingNext ? [
@@ -1143,7 +1125,6 @@ async function react(options = {}) {
1143
1125
  }] : []
1144
1126
  ];
1145
1127
  }
1146
-
1147
1128
  //#endregion
1148
1129
  //#region src/configs/regexp.ts
1149
1130
  async function regexp(options = {}) {
@@ -1161,7 +1142,6 @@ async function regexp(options = {}) {
1161
1142
  }
1162
1143
  }];
1163
1144
  }
1164
-
1165
1145
  //#endregion
1166
1146
  //#region src/configs/sort.ts
1167
1147
  /**
@@ -1387,7 +1367,6 @@ function sortTsconfig() {
1387
1367
  ] }
1388
1368
  }];
1389
1369
  }
1390
-
1391
1370
  //#endregion
1392
1371
  //#region src/configs/test.ts
1393
1372
  let _pluginTest;
@@ -1425,12 +1404,11 @@ async function test(options = {}) {
1425
1404
  }
1426
1405
  }];
1427
1406
  }
1428
-
1429
1407
  //#endregion
1430
1408
  //#region src/configs/toml.ts
1431
1409
  async function toml(options = {}) {
1432
- const { files = [GLOB_TOML], overrides = {}, stylistic: stylistic$1 = true } = options;
1433
- const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1410
+ const { files = [GLOB_TOML], overrides = {}, stylistic = true } = options;
1411
+ const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
1434
1412
  const [pluginToml, parserToml] = await Promise.all([interopDefault(import("eslint-plugin-toml")), interopDefault(import("toml-eslint-parser"))]);
1435
1413
  return [{
1436
1414
  name: "liwo/toml/setup",
@@ -1449,7 +1427,7 @@ async function toml(options = {}) {
1449
1427
  "toml/precision-of-integer": "error",
1450
1428
  "toml/tables-order": "error",
1451
1429
  "toml/vue-custom-block/no-parsing-error": "error",
1452
- ...stylistic$1 ? {
1430
+ ...stylistic ? {
1453
1431
  "toml/array-bracket-newline": "error",
1454
1432
  "toml/array-bracket-spacing": "error",
1455
1433
  "toml/array-element-newline": "error",
@@ -1466,18 +1444,17 @@ async function toml(options = {}) {
1466
1444
  }
1467
1445
  }];
1468
1446
  }
1469
-
1470
1447
  //#endregion
1471
1448
  //#region src/configs/typescript.ts
1472
1449
  async function typescript(options = {}) {
1473
1450
  const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
1474
1451
  const files = options.files ?? [
1475
- GLOB_TS,
1476
- GLOB_TSX,
1452
+ "**/*.?([cm])ts",
1453
+ "**/*.?([cm])tsx",
1477
1454
  ...componentExts.map((ext) => `**/*.${ext}`)
1478
1455
  ];
1479
- const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1480
- const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`];
1456
+ const filesTypeAware = options.filesTypeAware ?? ["**/*.?([cm])ts", "**/*.?([cm])tsx"];
1457
+ const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`];
1481
1458
  const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
1482
1459
  const isTypeAware = !!tsconfigPath;
1483
1460
  const typeAwareRules = {
@@ -1507,10 +1484,10 @@ async function typescript(options = {}) {
1507
1484
  "ts/unbound-method": "error"
1508
1485
  };
1509
1486
  const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
1510
- function makeParser(typeAware, files$1, ignores$1) {
1487
+ function makeParser(typeAware, files, ignores) {
1511
1488
  return {
1512
- files: files$1,
1513
- ...ignores$1 ? { ignores: ignores$1 } : {},
1489
+ files,
1490
+ ...ignores ? { ignores } : {},
1514
1491
  languageOptions: {
1515
1492
  parser: parserTs,
1516
1493
  parserOptions: {
@@ -1600,7 +1577,6 @@ async function typescript(options = {}) {
1600
1577
  }] : []
1601
1578
  ];
1602
1579
  }
1603
-
1604
1580
  //#endregion
1605
1581
  //#region src/configs/unicorn.ts
1606
1582
  async function unicorn(options = {}) {
@@ -1630,7 +1606,6 @@ async function unicorn(options = {}) {
1630
1606
  }
1631
1607
  }];
1632
1608
  }
1633
-
1634
1609
  //#endregion
1635
1610
  //#region src/configs/unocss.ts
1636
1611
  async function unocss(options = {}) {
@@ -1647,13 +1622,12 @@ async function unocss(options = {}) {
1647
1622
  }
1648
1623
  }];
1649
1624
  }
1650
-
1651
1625
  //#endregion
1652
1626
  //#region src/configs/vue.ts
1653
1627
  async function vue(options = {}) {
1654
- const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic: stylistic$1 = true, vueVersion = 3 } = options;
1628
+ const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic = true, vueVersion = 3 } = options;
1655
1629
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1656
- const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1630
+ const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
1657
1631
  if (a11y) await ensurePackages(["eslint-plugin-vuejs-accessibility"]);
1658
1632
  const [pluginVue, parserVue, processorVueBlocks, pluginVueA11y] = await Promise.all([
1659
1633
  interopDefault(import("eslint-plugin-vue")),
@@ -1781,7 +1755,7 @@ async function vue(options = {}) {
1781
1755
  nonwords: false,
1782
1756
  words: true
1783
1757
  }],
1784
- ...stylistic$1 ? {
1758
+ ...stylistic ? {
1785
1759
  "vue/array-bracket-spacing": ["error", "never"],
1786
1760
  "vue/arrow-spacing": ["error", {
1787
1761
  after: true,
@@ -1853,12 +1827,11 @@ async function vue(options = {}) {
1853
1827
  }
1854
1828
  }];
1855
1829
  }
1856
-
1857
1830
  //#endregion
1858
1831
  //#region src/configs/yaml.ts
1859
1832
  async function yaml(options = {}) {
1860
- const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
1861
- const { indent = 2, quotes = "single" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1833
+ const { files = [GLOB_YAML], overrides = {}, stylistic = true } = options;
1834
+ const { indent = 2, quotes = "single" } = typeof stylistic === "boolean" ? {} : stylistic;
1862
1835
  const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
1863
1836
  return [
1864
1837
  {
@@ -1878,7 +1851,7 @@ async function yaml(options = {}) {
1878
1851
  "yaml/no-irregular-whitespace": "error",
1879
1852
  "yaml/plain-scalar": "error",
1880
1853
  "yaml/vue-custom-block/no-parsing-error": "error",
1881
- ...stylistic$1 ? {
1854
+ ...stylistic ? {
1882
1855
  "yaml/block-mapping-question-indicator-newline": "error",
1883
1856
  "yaml/block-sequence-hyphen-indicator-newline": "error",
1884
1857
  "yaml/flow-mapping-curly-newline": "error",
@@ -1932,7 +1905,6 @@ async function yaml(options = {}) {
1932
1905
  }
1933
1906
  ];
1934
1907
  }
1935
-
1936
1908
  //#endregion
1937
1909
  //#region src/factory.ts
1938
1910
  const flatConfigProps = [
@@ -1952,9 +1924,6 @@ const VuePackages = [
1952
1924
  ];
1953
1925
  const defaultPluginRenaming = {
1954
1926
  "@eslint-react": "react",
1955
- "@eslint-react/dom": "react-dom",
1956
- "@eslint-react/hooks-extra": "react-hooks-extra",
1957
- "@eslint-react/naming-convention": "react-naming-convention",
1958
1927
  "@stylistic": "style",
1959
1928
  "@typescript-eslint": "ts",
1960
1929
  "import-lite": "import",
@@ -1981,86 +1950,86 @@ function eslintConfig(options = {}, ...userConfigs) {
1981
1950
  }
1982
1951
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
1983
1952
  if (stylisticOptions && !("jsx" in stylisticOptions)) stylisticOptions.jsx = enableJsx;
1984
- const configs$1 = [];
1985
- if (enableGitignore) if (typeof enableGitignore !== "boolean") configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
1953
+ const configs = [];
1954
+ if (enableGitignore) if (typeof enableGitignore !== "boolean") configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
1986
1955
  name: "liwo/gitignore",
1987
1956
  ...enableGitignore
1988
1957
  })]));
1989
- else configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
1958
+ else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
1990
1959
  name: "liwo/gitignore",
1991
1960
  strict: false
1992
1961
  })]));
1993
1962
  const typescriptOptions = resolveSubOptions(options, "typescript");
1994
1963
  const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
1995
- configs$1.push(ignores(options.ignores), javascript({
1964
+ configs.push(ignores(options.ignores), javascript({
1996
1965
  isInEditor,
1997
1966
  overrides: getOverrides(options, "javascript")
1998
1967
  }), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), command(), perfectionist());
1999
- if (enableImports) configs$1.push(imports(enableImports === true ? { stylistic: stylisticOptions } : {
1968
+ if (enableImports) configs.push(imports(enableImports === true ? { stylistic: stylisticOptions } : {
2000
1969
  stylistic: stylisticOptions,
2001
1970
  ...enableImports
2002
1971
  }));
2003
- if (enableUnicorn) configs$1.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
1972
+ if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2004
1973
  if (enableVue) componentExts.push("vue");
2005
- if (enableJsx) configs$1.push(jsx());
2006
- if (enableTypeScript) configs$1.push(typescript({
1974
+ if (enableJsx) configs.push(jsx());
1975
+ if (enableTypeScript) configs.push(typescript({
2007
1976
  ...typescriptOptions,
2008
1977
  componentExts,
2009
1978
  overrides: getOverrides(options, "typescript"),
2010
1979
  type: options.type
2011
1980
  }));
2012
- if (stylisticOptions) configs$1.push(stylistic({
1981
+ if (stylisticOptions) configs.push(stylistic({
2013
1982
  ...stylisticOptions,
2014
1983
  lessOpinionated: options.lessOpinionated,
2015
1984
  overrides: getOverrides(options, "stylistic")
2016
1985
  }));
2017
- if (enableRegexp) configs$1.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
2018
- if (options.test ?? true) configs$1.push(test({
1986
+ if (enableRegexp) configs.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
1987
+ if (options.test ?? true) configs.push(test({
2019
1988
  isInEditor,
2020
1989
  overrides: getOverrides(options, "test")
2021
1990
  }));
2022
- if (enableVue) configs$1.push(vue({
1991
+ if (enableVue) configs.push(vue({
2023
1992
  ...resolveSubOptions(options, "vue"),
2024
1993
  overrides: getOverrides(options, "vue"),
2025
1994
  stylistic: stylisticOptions,
2026
1995
  typescript: !!enableTypeScript
2027
1996
  }));
2028
- if (enableReact) configs$1.push(react({
1997
+ if (enableReact) configs.push(react({
2029
1998
  ...typescriptOptions,
2030
1999
  overrides: getOverrides(options, "react"),
2031
2000
  tsconfigPath
2032
2001
  }));
2033
- if (enableUnoCSS) configs$1.push(unocss({
2002
+ if (enableUnoCSS) configs.push(unocss({
2034
2003
  ...resolveSubOptions(options, "unocss"),
2035
2004
  overrides: getOverrides(options, "unocss")
2036
2005
  }));
2037
- if (options.jsonc ?? true) configs$1.push(jsonc({
2006
+ if (options.jsonc ?? true) configs.push(jsonc({
2038
2007
  overrides: getOverrides(options, "jsonc"),
2039
2008
  stylistic: stylisticOptions
2040
2009
  }), sortPackageJson(), sortTsconfig());
2041
- if (enableCatalogs) configs$1.push(pnpm());
2042
- if (options.yaml ?? true) configs$1.push(yaml({
2010
+ if (enableCatalogs) configs.push(pnpm());
2011
+ if (options.yaml ?? true) configs.push(yaml({
2043
2012
  overrides: getOverrides(options, "yaml"),
2044
2013
  stylistic: stylisticOptions
2045
2014
  }));
2046
- if (options.toml ?? true) configs$1.push(toml({
2015
+ if (options.toml ?? true) configs.push(toml({
2047
2016
  overrides: getOverrides(options, "toml"),
2048
2017
  stylistic: stylisticOptions
2049
2018
  }));
2050
- if (options.markdown ?? true) configs$1.push(markdown({
2019
+ if (options.markdown ?? true) configs.push(markdown({
2051
2020
  componentExts,
2052
2021
  overrides: getOverrides(options, "markdown")
2053
2022
  }));
2054
- if (options.formatters || options.formatters === void 0) configs$1.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions));
2055
- configs$1.push(disables());
2023
+ if (options.formatters || options.formatters === void 0) configs.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions));
2024
+ configs.push(disables());
2056
2025
  if ("files" in options) throw new Error("[@liwo/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
2057
2026
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
2058
2027
  if (key in options) acc[key] = options[key];
2059
2028
  return acc;
2060
2029
  }, {});
2061
- if (Object.keys(fusedConfig).length) configs$1.push([fusedConfig]);
2030
+ if (Object.keys(fusedConfig).length) configs.push([fusedConfig]);
2062
2031
  let composer = new FlatConfigComposer();
2063
- composer = composer.append(...configs$1, ...userConfigs);
2032
+ composer = composer.append(...configs, ...userConfigs);
2064
2033
  if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
2065
2034
  if (isInEditor) composer = composer.disableRulesFix([
2066
2035
  "unused-imports/no-unused-imports",
@@ -2076,10 +2045,8 @@ function getOverrides(options, key) {
2076
2045
  const sub = resolveSubOptions(options, key);
2077
2046
  return { ..."overrides" in sub ? sub.overrides : {} };
2078
2047
  }
2079
-
2080
2048
  //#endregion
2081
2049
  //#region src/index.ts
2082
2050
  var src_default = eslintConfig;
2083
-
2084
2051
  //#endregion
2085
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, command, comments, src_default as default, defaultPluginRenaming, disables, ensurePackages, eslintConfig, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
2052
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, command, comments, src_default as default, defaultPluginRenaming, disables, ensurePackages, eslintConfig, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };