@vinicunca/eslint-config 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -868,8 +868,8 @@ var GLOB_EXCLUDE = [
868
868
  ];
869
869
 
870
870
  // src/utils.ts
871
- async function combineConfigs(...configs) {
872
- const resolved = await Promise.all(configs);
871
+ async function combineConfigs(...configs2) {
872
+ const resolved = await Promise.all(configs2);
873
873
  return resolved.flat();
874
874
  }
875
875
  function renameRules(rules, map2) {
@@ -884,8 +884,8 @@ function renameRules(rules, map2) {
884
884
  })
885
885
  );
886
886
  }
887
- function renamePluginInConfigs(configs, map2) {
888
- return configs.map((i) => {
887
+ function renamePluginInConfigs(configs2, map2) {
888
+ return configs2.map((i) => {
889
889
  const clone = { ...i };
890
890
  if (clone.rules) {
891
891
  clone.rules = renameRules(clone.rules, map2);
@@ -1070,7 +1070,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1070
1070
  options.dprintOptions || {}
1071
1071
  );
1072
1072
  const pluginFormat = await interopDefault(import("eslint-plugin-format"));
1073
- const configs = [
1073
+ const configs2 = [
1074
1074
  {
1075
1075
  name: "vinicunca/formatter/setup",
1076
1076
  plugins: {
@@ -1079,7 +1079,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1079
1079
  }
1080
1080
  ];
1081
1081
  if (options.css) {
1082
- configs.push(
1082
+ configs2.push(
1083
1083
  {
1084
1084
  files: [GLOB_CSS, GLOB_POSTCSS],
1085
1085
  languageOptions: {
@@ -1131,7 +1131,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1131
1131
  );
1132
1132
  }
1133
1133
  if (options.html) {
1134
- configs.push({
1134
+ configs2.push({
1135
1135
  files: ["**/*.html"],
1136
1136
  languageOptions: {
1137
1137
  parser: parserPlain
@@ -1150,7 +1150,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1150
1150
  }
1151
1151
  if (options.markdown) {
1152
1152
  const formater = options.markdown === true ? "prettier" : options.markdown;
1153
- configs.push({
1153
+ configs2.push({
1154
1154
  files: [GLOB_MARKDOWN],
1155
1155
  languageOptions: {
1156
1156
  parser: parserPlain
@@ -1173,7 +1173,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1173
1173
  });
1174
1174
  }
1175
1175
  if (options.graphql) {
1176
- configs.push({
1176
+ configs2.push({
1177
1177
  files: ["**/*.graphql"],
1178
1178
  languageOptions: {
1179
1179
  parser: parserPlain
@@ -1190,7 +1190,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1190
1190
  }
1191
1191
  });
1192
1192
  }
1193
- return configs;
1193
+ return configs2;
1194
1194
  }
1195
1195
 
1196
1196
  // src/configs/ignores.ts
@@ -1771,7 +1771,7 @@ async function perfectionist() {
1771
1771
  // src/configs/react.ts
1772
1772
  async function react(options = {}) {
1773
1773
  const {
1774
- files = [GLOB_JSX, GLOB_TSX],
1774
+ files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
1775
1775
  overrides = {}
1776
1776
  } = options;
1777
1777
  const [
@@ -1839,6 +1839,32 @@ async function react(options = {}) {
1839
1839
  ];
1840
1840
  }
1841
1841
 
1842
+ // src/configs/regexp.ts
1843
+ import { configs } from "eslint-plugin-regexp";
1844
+ async function regexp(options = {}) {
1845
+ const config = configs["flat/recommended"];
1846
+ const rules = {
1847
+ ...config.rules
1848
+ };
1849
+ if (options.level === WARN) {
1850
+ for (const key in rules) {
1851
+ if (rules[key] === ERROR) {
1852
+ rules[key] = WARN;
1853
+ }
1854
+ }
1855
+ }
1856
+ return [
1857
+ {
1858
+ ...config,
1859
+ name: "vinicunca/regexp/rules",
1860
+ rules: {
1861
+ ...rules,
1862
+ ...options.overrides
1863
+ }
1864
+ }
1865
+ ];
1866
+ }
1867
+
1842
1868
  // src/configs/sonar.ts
1843
1869
  async function sonar() {
1844
1870
  return [
@@ -2161,7 +2187,8 @@ async function typescript(options = {}) {
2161
2187
  "ts/no-misused-promises": OFF,
2162
2188
  "ts/no-throw-literal": ERROR,
2163
2189
  "ts/restrict-plus-operands": ERROR,
2164
- "ts/restrict-template-expressions": ERROR
2190
+ "ts/restrict-template-expressions": ERROR,
2191
+ "ts/strict-boolean-expressions": "error"
2165
2192
  };
2166
2193
  const [
2167
2194
  pluginTs,
@@ -2595,6 +2622,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2595
2622
  gitignore: enableGitignore = true,
2596
2623
  isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE || process2.env.VIM) && !process2.env.CI),
2597
2624
  react: enableReact = false,
2625
+ regexp: enableRegexp = true,
2598
2626
  typescript: enableTypeScript = isPackageExists("typescript"),
2599
2627
  unocss: enableUnoCSS = false,
2600
2628
  vue: enableVue = VuePackages.some((i) => isPackageExists(i))
@@ -2608,17 +2636,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2608
2636
  jsx: options.jsx ?? true
2609
2637
  };
2610
2638
  }
2611
- const configs = [];
2639
+ const configs2 = [];
2612
2640
  if (enableGitignore) {
2613
2641
  if (typeof enableGitignore !== "boolean") {
2614
- configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
2642
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
2615
2643
  } else {
2616
2644
  if (fs.existsSync(".gitignore")) {
2617
- configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
2645
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
2618
2646
  }
2619
2647
  }
2620
2648
  }
2621
- configs.push(
2649
+ const typescriptOptions = resolveSubOptions(options, "typescript");
2650
+ const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
2651
+ configs2.push(
2622
2652
  ignores(),
2623
2653
  javascript({
2624
2654
  isInEditor,
@@ -2638,26 +2668,29 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2638
2668
  componentExts.push("vue");
2639
2669
  }
2640
2670
  if (enableTypeScript) {
2641
- configs.push(typescript({
2642
- ...resolveSubOptions(options, "typescript"),
2671
+ configs2.push(typescript({
2672
+ ...typescriptOptions,
2643
2673
  componentExts,
2644
2674
  overrides: getOverrides(options, "typescript")
2645
2675
  }));
2646
2676
  }
2647
2677
  if (stylisticOptions) {
2648
- configs.push(stylistic({
2678
+ configs2.push(stylistic({
2649
2679
  ...stylisticOptions,
2650
2680
  overrides: getOverrides(options, "stylistic")
2651
2681
  }));
2652
2682
  }
2683
+ if (enableRegexp) {
2684
+ configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
2685
+ }
2653
2686
  if (options.test ?? true) {
2654
- configs.push(test({
2687
+ configs2.push(test({
2655
2688
  isInEditor,
2656
2689
  overrides: getOverrides(options, "test")
2657
2690
  }));
2658
2691
  }
2659
2692
  if (enableVue) {
2660
- configs.push(vue({
2693
+ configs2.push(vue({
2661
2694
  ...resolveSubOptions(options, "vue"),
2662
2695
  overrides: getOverrides(options, "vue"),
2663
2696
  stylistic: stylisticOptions,
@@ -2665,19 +2698,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2665
2698
  }));
2666
2699
  }
2667
2700
  if (enableReact) {
2668
- configs.push(react({
2701
+ configs2.push(react({
2669
2702
  overrides: getOverrides(options, "react"),
2670
- typescript: !!enableTypeScript
2703
+ tsconfigPath
2671
2704
  }));
2672
2705
  }
2673
2706
  if (enableUnoCSS) {
2674
- configs.push(unocss({
2707
+ configs2.push(unocss({
2675
2708
  ...resolveSubOptions(options, "unocss"),
2676
2709
  overrides: getOverrides(options, "unocss")
2677
2710
  }));
2678
2711
  }
2679
2712
  if (options.jsonc ?? true) {
2680
- configs.push(
2713
+ configs2.push(
2681
2714
  jsonc({
2682
2715
  overrides: getOverrides(options, "jsonc"),
2683
2716
  stylistic: stylisticOptions
@@ -2687,13 +2720,13 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2687
2720
  );
2688
2721
  }
2689
2722
  if (options.yaml ?? true) {
2690
- configs.push(yaml({
2723
+ configs2.push(yaml({
2691
2724
  overrides: getOverrides(options, "yaml"),
2692
2725
  stylistic: stylisticOptions
2693
2726
  }));
2694
2727
  }
2695
2728
  if (options.markdown ?? true) {
2696
- configs.push(
2729
+ configs2.push(
2697
2730
  markdown(
2698
2731
  {
2699
2732
  componentExts,
@@ -2703,7 +2736,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2703
2736
  );
2704
2737
  }
2705
2738
  if (options.formatters) {
2706
- configs.push(formatters(
2739
+ configs2.push(formatters(
2707
2740
  options.formatters,
2708
2741
  typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2709
2742
  ));
@@ -2716,12 +2749,12 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2716
2749
  return acc;
2717
2750
  }, {});
2718
2751
  if (Object.keys(fusedConfig).length) {
2719
- configs.push([fusedConfig]);
2752
+ configs2.push([fusedConfig]);
2720
2753
  }
2721
2754
  ;
2722
2755
  let composer = new FlatConfigComposer();
2723
2756
  composer = composer.append(
2724
- ...configs,
2757
+ ...configs2,
2725
2758
  ...userConfigs
2726
2759
  );
2727
2760
  if (autoRenamePlugins) {
@@ -2786,6 +2819,7 @@ export {
2786
2819
  default7 as pluginUnicorn,
2787
2820
  default8 as pluginUnusedImports,
2788
2821
  react,
2822
+ regexp,
2789
2823
  renamePluginInConfigs,
2790
2824
  renameRules,
2791
2825
  sonar,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vinicunca/eslint-config",
3
3
  "type": "module",
4
- "version": "2.5.0",
4
+ "version": "2.6.0",
5
5
  "description": "Vinicunca ESLint config",
6
6
  "author": {
7
7
  "name": "praburangki",
@@ -59,42 +59,43 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@stylistic/eslint-plugin": "^2.1.0",
62
- "@typescript-eslint/eslint-plugin": "^7.8.0",
63
- "@typescript-eslint/parser": "^7.8.0",
64
- "@unocss/eslint-plugin": "^0.60.0",
62
+ "@typescript-eslint/eslint-plugin": "^7.11.0",
63
+ "@typescript-eslint/parser": "^7.11.0",
64
+ "@unocss/eslint-plugin": "^0.60.4",
65
65
  "eslint-config-flat-gitignore": "^0.1.5",
66
- "eslint-flat-config-utils": "^0.2.4",
66
+ "eslint-flat-config-utils": "^0.2.5",
67
67
  "eslint-merge-processors": "^0.1.0",
68
- "eslint-plugin-antfu": "^2.2.0",
68
+ "eslint-plugin-antfu": "^2.3.3",
69
69
  "eslint-plugin-eslint-comments": "^3.2.0",
70
70
  "eslint-plugin-format": "^0.1.1",
71
- "eslint-plugin-import-x": "^0.5.0",
72
- "eslint-plugin-jsdoc": "^48.2.4",
73
- "eslint-plugin-jsonc": "^2.15.1",
71
+ "eslint-plugin-import-x": "^0.5.1",
72
+ "eslint-plugin-jsdoc": "^48.2.7",
73
+ "eslint-plugin-jsonc": "^2.16.0",
74
74
  "eslint-plugin-markdown": "^5.0.0",
75
- "eslint-plugin-n": "^17.6.0",
75
+ "eslint-plugin-n": "^17.7.0",
76
76
  "eslint-plugin-no-only-tests": "^3.1.0",
77
77
  "eslint-plugin-perfectionist": "^2.10.0",
78
- "eslint-plugin-react": "^7.34.1",
78
+ "eslint-plugin-react": "^7.34.2",
79
79
  "eslint-plugin-react-hooks": "^4.6.2",
80
+ "eslint-plugin-regexp": "^2.6.0",
80
81
  "eslint-plugin-sonarjs": "^1.0.3",
81
82
  "eslint-plugin-unicorn": "^53.0.0",
82
- "eslint-plugin-unused-imports": "^3.2.0",
83
+ "eslint-plugin-unused-imports": "^4.0.0",
83
84
  "eslint-plugin-vitest": "^0.5.4",
84
85
  "eslint-plugin-vue": "^9.26.0",
85
86
  "eslint-plugin-yml": "^1.14.0",
86
87
  "eslint-processor-vue-blocks": "^0.1.2",
87
- "globals": "^15.2.0",
88
+ "globals": "^15.3.0",
88
89
  "jsonc-eslint-parser": "^2.4.0",
89
90
  "local-pkg": "^0.5.0",
90
- "vue-eslint-parser": "^9.4.2",
91
- "yaml-eslint-parser": "^1.2.2"
91
+ "vue-eslint-parser": "^9.4.3",
92
+ "yaml-eslint-parser": "^1.2.3"
92
93
  },
93
94
  "devDependencies": {
94
95
  "@types/eslint": "^8.56.10",
95
96
  "@types/fs-extra": "^11.0.4",
96
97
  "eslint-typegen": "^0.2.4",
97
- "execa": "^9.0.2",
98
+ "execa": "^9.1.0",
98
99
  "fast-glob": "^3.3.2",
99
100
  "fs-extra": "^11.2.0",
100
101
  "react": "^18.3.1",