@vinicunca/eslint-config 2.5.0 → 2.6.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
@@ -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 [
@@ -2160,8 +2186,16 @@ async function typescript(options = {}) {
2160
2186
  // Temporary turning it off due to performance
2161
2187
  "ts/no-misused-promises": OFF,
2162
2188
  "ts/no-throw-literal": ERROR,
2189
+ "ts/no-unnecessary-type-assertion": ERROR,
2190
+ "ts/no-unsafe-argument": ERROR,
2191
+ "ts/no-unsafe-assignment": ERROR,
2192
+ "ts/no-unsafe-call": ERROR,
2193
+ "ts/no-unsafe-member-access": ERROR,
2194
+ "ts/no-unsafe-return": ERROR,
2163
2195
  "ts/restrict-plus-operands": ERROR,
2164
- "ts/restrict-template-expressions": ERROR
2196
+ "ts/restrict-template-expressions": ERROR,
2197
+ "ts/strict-boolean-expressions": ERROR,
2198
+ "ts/unbound-method": ERROR
2165
2199
  };
2166
2200
  const [
2167
2201
  pluginTs,
@@ -2231,7 +2265,7 @@ async function typescript(options = {}) {
2231
2265
  "ts/explicit-member-accessibility": OFF,
2232
2266
  "ts/explicit-module-boundary-types": OFF,
2233
2267
  // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
2234
- "ts/method-signature-style": ["error", "property"],
2268
+ "ts/method-signature-style": [ERROR, "property"],
2235
2269
  "ts/naming-convention": OFF,
2236
2270
  "ts/no-dupe-class-members": ERROR,
2237
2271
  "ts/no-empty-function": OFF,
@@ -2595,6 +2629,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2595
2629
  gitignore: enableGitignore = true,
2596
2630
  isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE || process2.env.VIM) && !process2.env.CI),
2597
2631
  react: enableReact = false,
2632
+ regexp: enableRegexp = true,
2598
2633
  typescript: enableTypeScript = isPackageExists("typescript"),
2599
2634
  unocss: enableUnoCSS = false,
2600
2635
  vue: enableVue = VuePackages.some((i) => isPackageExists(i))
@@ -2608,17 +2643,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2608
2643
  jsx: options.jsx ?? true
2609
2644
  };
2610
2645
  }
2611
- const configs = [];
2646
+ const configs2 = [];
2612
2647
  if (enableGitignore) {
2613
2648
  if (typeof enableGitignore !== "boolean") {
2614
- configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
2649
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
2615
2650
  } else {
2616
2651
  if (fs.existsSync(".gitignore")) {
2617
- configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
2652
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
2618
2653
  }
2619
2654
  }
2620
2655
  }
2621
- configs.push(
2656
+ const typescriptOptions = resolveSubOptions(options, "typescript");
2657
+ const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
2658
+ configs2.push(
2622
2659
  ignores(),
2623
2660
  javascript({
2624
2661
  isInEditor,
@@ -2638,26 +2675,29 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2638
2675
  componentExts.push("vue");
2639
2676
  }
2640
2677
  if (enableTypeScript) {
2641
- configs.push(typescript({
2642
- ...resolveSubOptions(options, "typescript"),
2678
+ configs2.push(typescript({
2679
+ ...typescriptOptions,
2643
2680
  componentExts,
2644
2681
  overrides: getOverrides(options, "typescript")
2645
2682
  }));
2646
2683
  }
2647
2684
  if (stylisticOptions) {
2648
- configs.push(stylistic({
2685
+ configs2.push(stylistic({
2649
2686
  ...stylisticOptions,
2650
2687
  overrides: getOverrides(options, "stylistic")
2651
2688
  }));
2652
2689
  }
2690
+ if (enableRegexp) {
2691
+ configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
2692
+ }
2653
2693
  if (options.test ?? true) {
2654
- configs.push(test({
2694
+ configs2.push(test({
2655
2695
  isInEditor,
2656
2696
  overrides: getOverrides(options, "test")
2657
2697
  }));
2658
2698
  }
2659
2699
  if (enableVue) {
2660
- configs.push(vue({
2700
+ configs2.push(vue({
2661
2701
  ...resolveSubOptions(options, "vue"),
2662
2702
  overrides: getOverrides(options, "vue"),
2663
2703
  stylistic: stylisticOptions,
@@ -2665,19 +2705,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2665
2705
  }));
2666
2706
  }
2667
2707
  if (enableReact) {
2668
- configs.push(react({
2708
+ configs2.push(react({
2669
2709
  overrides: getOverrides(options, "react"),
2670
- typescript: !!enableTypeScript
2710
+ tsconfigPath
2671
2711
  }));
2672
2712
  }
2673
2713
  if (enableUnoCSS) {
2674
- configs.push(unocss({
2714
+ configs2.push(unocss({
2675
2715
  ...resolveSubOptions(options, "unocss"),
2676
2716
  overrides: getOverrides(options, "unocss")
2677
2717
  }));
2678
2718
  }
2679
2719
  if (options.jsonc ?? true) {
2680
- configs.push(
2720
+ configs2.push(
2681
2721
  jsonc({
2682
2722
  overrides: getOverrides(options, "jsonc"),
2683
2723
  stylistic: stylisticOptions
@@ -2687,13 +2727,13 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2687
2727
  );
2688
2728
  }
2689
2729
  if (options.yaml ?? true) {
2690
- configs.push(yaml({
2730
+ configs2.push(yaml({
2691
2731
  overrides: getOverrides(options, "yaml"),
2692
2732
  stylistic: stylisticOptions
2693
2733
  }));
2694
2734
  }
2695
2735
  if (options.markdown ?? true) {
2696
- configs.push(
2736
+ configs2.push(
2697
2737
  markdown(
2698
2738
  {
2699
2739
  componentExts,
@@ -2703,7 +2743,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2703
2743
  );
2704
2744
  }
2705
2745
  if (options.formatters) {
2706
- configs.push(formatters(
2746
+ configs2.push(formatters(
2707
2747
  options.formatters,
2708
2748
  typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2709
2749
  ));
@@ -2716,12 +2756,12 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2716
2756
  return acc;
2717
2757
  }, {});
2718
2758
  if (Object.keys(fusedConfig).length) {
2719
- configs.push([fusedConfig]);
2759
+ configs2.push([fusedConfig]);
2720
2760
  }
2721
2761
  ;
2722
2762
  let composer = new FlatConfigComposer();
2723
2763
  composer = composer.append(
2724
- ...configs,
2764
+ ...configs2,
2725
2765
  ...userConfigs
2726
2766
  );
2727
2767
  if (autoRenamePlugins) {
@@ -2786,6 +2826,7 @@ export {
2786
2826
  default7 as pluginUnicorn,
2787
2827
  default8 as pluginUnusedImports,
2788
2828
  react,
2829
+ regexp,
2789
2830
  renamePluginInConfigs,
2790
2831
  renameRules,
2791
2832
  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.1",
5
5
  "description": "Vinicunca ESLint config",
6
6
  "author": {
7
7
  "name": "praburangki",
@@ -59,46 +59,47 @@
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.12.0",
63
+ "@typescript-eslint/parser": "^7.12.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",
101
- "tsup": "^8.0.2",
102
+ "tsup": "^8.1.0",
102
103
  "vue": "^3.4.27"
103
104
  },
104
105
  "scripts": {