@vinicunca/eslint-config 2.4.4 → 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
@@ -771,13 +771,14 @@ var NEVER = "never";
771
771
  var ALWAYS = "always";
772
772
 
773
773
  // src/plugins.ts
774
- import { default as default2 } from "@vinicunca/eslint-plugin-vinicunca";
774
+ import { default as default2 } from "eslint-plugin-antfu";
775
775
  import { default as default3 } from "eslint-plugin-eslint-comments";
776
776
  import * as pluginImport from "eslint-plugin-import-x";
777
777
  import { default as default4 } from "eslint-plugin-n";
778
778
  import { default as default5 } from "eslint-plugin-perfectionist";
779
- import { default as default6 } from "eslint-plugin-unicorn";
780
- import { default as default7 } from "eslint-plugin-unused-imports";
779
+ import { default as default6 } from "eslint-plugin-sonarjs";
780
+ import { default as default7 } from "eslint-plugin-unicorn";
781
+ import { default as default8 } from "eslint-plugin-unused-imports";
781
782
 
782
783
  // src/configs/comments.ts
783
784
  async function comments() {
@@ -867,8 +868,8 @@ var GLOB_EXCLUDE = [
867
868
  ];
868
869
 
869
870
  // src/utils.ts
870
- async function combineConfigs(...configs) {
871
- const resolved = await Promise.all(configs);
871
+ async function combineConfigs(...configs2) {
872
+ const resolved = await Promise.all(configs2);
872
873
  return resolved.flat();
873
874
  }
874
875
  function renameRules(rules, map2) {
@@ -883,8 +884,8 @@ function renameRules(rules, map2) {
883
884
  })
884
885
  );
885
886
  }
886
- function renamePluginInConfigs(configs, map2) {
887
- return configs.map((i) => {
887
+ function renamePluginInConfigs(configs2, map2) {
888
+ return configs2.map((i) => {
888
889
  const clone = { ...i };
889
890
  if (clone.rules) {
890
891
  clone.rules = renameRules(clone.rules, map2);
@@ -962,8 +963,8 @@ async function stylistic(options = {}) {
962
963
  {
963
964
  name: "vinicunca/stylistic/rules",
964
965
  plugins: {
965
- style: pluginStylistic,
966
- vinicunca: default2
966
+ antfu: default2,
967
+ style: pluginStylistic
967
968
  },
968
969
  rules: {
969
970
  ...config.rules,
@@ -1025,17 +1026,8 @@ async function stylistic(options = {}) {
1025
1026
  "style/rest-spread-spacing": [ERROR, NEVER],
1026
1027
  "style/semi": [ERROR, semi ? ALWAYS : NEVER],
1027
1028
  "style/semi-spacing": [ERROR, { after: true, before: false }],
1028
- "vinicunca/consistent-list-newline": ERROR,
1029
- "vinicunca/if-newline": ERROR,
1030
- "vinicunca/top-level-function": ERROR,
1031
1029
  ...overrides
1032
1030
  }
1033
- },
1034
- {
1035
- files: [GLOB_JSX, GLOB_TSX],
1036
- rules: {
1037
- "vinicunca/consistent-list-newline": OFF
1038
- }
1039
1031
  }
1040
1032
  ];
1041
1033
  }
@@ -1078,7 +1070,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1078
1070
  options.dprintOptions || {}
1079
1071
  );
1080
1072
  const pluginFormat = await interopDefault(import("eslint-plugin-format"));
1081
- const configs = [
1073
+ const configs2 = [
1082
1074
  {
1083
1075
  name: "vinicunca/formatter/setup",
1084
1076
  plugins: {
@@ -1087,7 +1079,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1087
1079
  }
1088
1080
  ];
1089
1081
  if (options.css) {
1090
- configs.push(
1082
+ configs2.push(
1091
1083
  {
1092
1084
  files: [GLOB_CSS, GLOB_POSTCSS],
1093
1085
  languageOptions: {
@@ -1139,7 +1131,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1139
1131
  );
1140
1132
  }
1141
1133
  if (options.html) {
1142
- configs.push({
1134
+ configs2.push({
1143
1135
  files: ["**/*.html"],
1144
1136
  languageOptions: {
1145
1137
  parser: parserPlain
@@ -1158,7 +1150,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1158
1150
  }
1159
1151
  if (options.markdown) {
1160
1152
  const formater = options.markdown === true ? "prettier" : options.markdown;
1161
- configs.push({
1153
+ configs2.push({
1162
1154
  files: [GLOB_MARKDOWN],
1163
1155
  languageOptions: {
1164
1156
  parser: parserPlain
@@ -1181,7 +1173,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1181
1173
  });
1182
1174
  }
1183
1175
  if (options.graphql) {
1184
- configs.push({
1176
+ configs2.push({
1185
1177
  files: ["**/*.graphql"],
1186
1178
  languageOptions: {
1187
1179
  parser: parserPlain
@@ -1198,7 +1190,7 @@ async function formatters(options = {}, stylistic2 = {}) {
1198
1190
  }
1199
1191
  });
1200
1192
  }
1201
- return configs;
1193
+ return configs2;
1202
1194
  }
1203
1195
 
1204
1196
  // src/configs/ignores.ts
@@ -1216,8 +1208,8 @@ async function imports() {
1216
1208
  {
1217
1209
  name: "vinicunca/imports/rules",
1218
1210
  plugins: {
1219
- import: pluginImport,
1220
- vinicunca: default2
1211
+ antfu: default2,
1212
+ import: pluginImport
1221
1213
  },
1222
1214
  rules: {
1223
1215
  "import/export": ERROR,
@@ -1232,9 +1224,7 @@ async function imports() {
1232
1224
  "import/no-self-import": ERROR,
1233
1225
  "import/no-webpack-loader-syntax": ERROR,
1234
1226
  // Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-imports
1235
- "import/order": OFF,
1236
- "vinicunca/import-dedupe": ERROR,
1237
- "vinicunca/no-import-node-modules-by-path": ERROR
1227
+ "import/order": OFF
1238
1228
  }
1239
1229
  }
1240
1230
  ];
@@ -1273,8 +1263,8 @@ async function javascript(options = {}) {
1273
1263
  },
1274
1264
  name: "vinicunca/javascript/rules",
1275
1265
  plugins: {
1276
- "unused-imports": default7,
1277
- "vinicunca": default2
1266
+ "antfu": default2,
1267
+ "unused-imports": default8
1278
1268
  },
1279
1269
  rules: {
1280
1270
  "accessor-pairs": [ERROR, {
@@ -1494,7 +1484,6 @@ async function javascript(options = {}) {
1494
1484
  }],
1495
1485
  "vars-on-top": ERROR,
1496
1486
  "yoda": [ERROR, NEVER],
1497
- ...default2.configs.recommended.rules,
1498
1487
  ...overrides
1499
1488
  }
1500
1489
  },
@@ -1712,7 +1701,6 @@ async function markdown(options = {}) {
1712
1701
  "ts/restrict-template-expressions": OFF,
1713
1702
  "ts/unbound-method": OFF
1714
1703
  },
1715
- "vinicunca/no-ts-export-equal": OFF,
1716
1704
  ...overrides
1717
1705
  }
1718
1706
  }
@@ -1783,7 +1771,7 @@ async function perfectionist() {
1783
1771
  // src/configs/react.ts
1784
1772
  async function react(options = {}) {
1785
1773
  const {
1786
- files = [GLOB_JSX, GLOB_TSX],
1774
+ files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
1787
1775
  overrides = {}
1788
1776
  } = options;
1789
1777
  const [
@@ -1851,6 +1839,47 @@ async function react(options = {}) {
1851
1839
  ];
1852
1840
  }
1853
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
+
1868
+ // src/configs/sonar.ts
1869
+ async function sonar() {
1870
+ return [
1871
+ {
1872
+ name: "vinicunca/sonar/rules",
1873
+ plugins: {
1874
+ sonar: default6
1875
+ },
1876
+ rules: {
1877
+ ...default6.configs.recommended.rules
1878
+ }
1879
+ }
1880
+ ];
1881
+ }
1882
+
1854
1883
  // src/configs/sort-package-json.ts
1855
1884
  async function sortPackageJson() {
1856
1885
  return [
@@ -2158,7 +2187,8 @@ async function typescript(options = {}) {
2158
2187
  "ts/no-misused-promises": OFF,
2159
2188
  "ts/no-throw-literal": ERROR,
2160
2189
  "ts/restrict-plus-operands": ERROR,
2161
- "ts/restrict-template-expressions": ERROR
2190
+ "ts/restrict-template-expressions": ERROR,
2191
+ "ts/strict-boolean-expressions": "error"
2162
2192
  };
2163
2193
  const [
2164
2194
  pluginTs,
@@ -2191,8 +2221,8 @@ async function typescript(options = {}) {
2191
2221
  // Install the plugins without globs, so they can be configured separately.
2192
2222
  name: "vinicunca/typescript/setup",
2193
2223
  plugins: {
2194
- ts: pluginTs,
2195
- vinicunca: default2
2224
+ antfu: default2,
2225
+ ts: pluginTs
2196
2226
  }
2197
2227
  },
2198
2228
  // assign type-aware parser for type-aware files and type-unaware parser for the rest
@@ -2296,7 +2326,7 @@ async function unicorn() {
2296
2326
  {
2297
2327
  name: "vinicunca/unicorn/rules",
2298
2328
  plugins: {
2299
- unicorn: default6
2329
+ unicorn: default7
2300
2330
  },
2301
2331
  rules: {
2302
2332
  "unicorn/error-message": ERROR,
@@ -2581,6 +2611,7 @@ var defaultPluginRenaming = {
2581
2611
  "@typescript-eslint": "ts",
2582
2612
  "import-x": "import",
2583
2613
  "n": "node",
2614
+ "sonarjs": "sonar",
2584
2615
  "vitest": "test",
2585
2616
  "yml": "yaml"
2586
2617
  };
@@ -2591,6 +2622,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2591
2622
  gitignore: enableGitignore = true,
2592
2623
  isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE || process2.env.VIM) && !process2.env.CI),
2593
2624
  react: enableReact = false,
2625
+ regexp: enableRegexp = true,
2594
2626
  typescript: enableTypeScript = isPackageExists("typescript"),
2595
2627
  unocss: enableUnoCSS = false,
2596
2628
  vue: enableVue = VuePackages.some((i) => isPackageExists(i))
@@ -2604,17 +2636,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2604
2636
  jsx: options.jsx ?? true
2605
2637
  };
2606
2638
  }
2607
- const configs = [];
2639
+ const configs2 = [];
2608
2640
  if (enableGitignore) {
2609
2641
  if (typeof enableGitignore !== "boolean") {
2610
- 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)]));
2611
2643
  } else {
2612
2644
  if (fs.existsSync(".gitignore")) {
2613
- configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
2645
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
2614
2646
  }
2615
2647
  }
2616
2648
  }
2617
- configs.push(
2649
+ const typescriptOptions = resolveSubOptions(options, "typescript");
2650
+ const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
2651
+ configs2.push(
2618
2652
  ignores(),
2619
2653
  javascript({
2620
2654
  isInEditor,
@@ -2627,32 +2661,36 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2627
2661
  }),
2628
2662
  imports(),
2629
2663
  unicorn(),
2630
- perfectionist()
2664
+ perfectionist(),
2665
+ sonar()
2631
2666
  );
2632
2667
  if (enableVue) {
2633
2668
  componentExts.push("vue");
2634
2669
  }
2635
2670
  if (enableTypeScript) {
2636
- configs.push(typescript({
2637
- ...resolveSubOptions(options, "typescript"),
2671
+ configs2.push(typescript({
2672
+ ...typescriptOptions,
2638
2673
  componentExts,
2639
2674
  overrides: getOverrides(options, "typescript")
2640
2675
  }));
2641
2676
  }
2642
2677
  if (stylisticOptions) {
2643
- configs.push(stylistic({
2678
+ configs2.push(stylistic({
2644
2679
  ...stylisticOptions,
2645
2680
  overrides: getOverrides(options, "stylistic")
2646
2681
  }));
2647
2682
  }
2683
+ if (enableRegexp) {
2684
+ configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
2685
+ }
2648
2686
  if (options.test ?? true) {
2649
- configs.push(test({
2687
+ configs2.push(test({
2650
2688
  isInEditor,
2651
2689
  overrides: getOverrides(options, "test")
2652
2690
  }));
2653
2691
  }
2654
2692
  if (enableVue) {
2655
- configs.push(vue({
2693
+ configs2.push(vue({
2656
2694
  ...resolveSubOptions(options, "vue"),
2657
2695
  overrides: getOverrides(options, "vue"),
2658
2696
  stylistic: stylisticOptions,
@@ -2660,19 +2698,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2660
2698
  }));
2661
2699
  }
2662
2700
  if (enableReact) {
2663
- configs.push(react({
2701
+ configs2.push(react({
2664
2702
  overrides: getOverrides(options, "react"),
2665
- typescript: !!enableTypeScript
2703
+ tsconfigPath
2666
2704
  }));
2667
2705
  }
2668
2706
  if (enableUnoCSS) {
2669
- configs.push(unocss({
2707
+ configs2.push(unocss({
2670
2708
  ...resolveSubOptions(options, "unocss"),
2671
2709
  overrides: getOverrides(options, "unocss")
2672
2710
  }));
2673
2711
  }
2674
2712
  if (options.jsonc ?? true) {
2675
- configs.push(
2713
+ configs2.push(
2676
2714
  jsonc({
2677
2715
  overrides: getOverrides(options, "jsonc"),
2678
2716
  stylistic: stylisticOptions
@@ -2682,13 +2720,13 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2682
2720
  );
2683
2721
  }
2684
2722
  if (options.yaml ?? true) {
2685
- configs.push(yaml({
2723
+ configs2.push(yaml({
2686
2724
  overrides: getOverrides(options, "yaml"),
2687
2725
  stylistic: stylisticOptions
2688
2726
  }));
2689
2727
  }
2690
2728
  if (options.markdown ?? true) {
2691
- configs.push(
2729
+ configs2.push(
2692
2730
  markdown(
2693
2731
  {
2694
2732
  componentExts,
@@ -2698,7 +2736,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2698
2736
  );
2699
2737
  }
2700
2738
  if (options.formatters) {
2701
- configs.push(formatters(
2739
+ configs2.push(formatters(
2702
2740
  options.formatters,
2703
2741
  typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2704
2742
  ));
@@ -2711,18 +2749,18 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2711
2749
  return acc;
2712
2750
  }, {});
2713
2751
  if (Object.keys(fusedConfig).length) {
2714
- configs.push([fusedConfig]);
2752
+ configs2.push([fusedConfig]);
2715
2753
  }
2716
2754
  ;
2717
- let pipeline = new FlatConfigComposer();
2718
- pipeline = pipeline.append(
2719
- ...configs,
2755
+ let composer = new FlatConfigComposer();
2756
+ composer = composer.append(
2757
+ ...configs2,
2720
2758
  ...userConfigs
2721
2759
  );
2722
2760
  if (autoRenamePlugins) {
2723
- pipeline = pipeline.renamePlugins(defaultPluginRenaming);
2761
+ composer = composer.renamePlugins(defaultPluginRenaming);
2724
2762
  }
2725
- return pipeline;
2763
+ return composer;
2726
2764
  }
2727
2765
  function getOverrides(options, key) {
2728
2766
  const sub = resolveSubOptions(options, key);
@@ -2772,16 +2810,19 @@ export {
2772
2810
  node,
2773
2811
  parserPlain,
2774
2812
  perfectionist,
2813
+ default2 as pluginAntfu,
2775
2814
  default3 as pluginComments,
2776
2815
  pluginImport,
2777
2816
  default4 as pluginNode,
2778
2817
  default5 as pluginPerfectionist,
2779
- default6 as pluginUnicorn,
2780
- default7 as pluginUnusedImports,
2781
- default2 as pluginVinicunca,
2818
+ default6 as pluginSonar,
2819
+ default7 as pluginUnicorn,
2820
+ default8 as pluginUnusedImports,
2782
2821
  react,
2822
+ regexp,
2783
2823
  renamePluginInConfigs,
2784
2824
  renameRules,
2825
+ sonar,
2785
2826
  sortPackageJson,
2786
2827
  sortTsconfig,
2787
2828
  stylistic,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vinicunca/eslint-config",
3
3
  "type": "module",
4
- "version": "2.4.4",
4
+ "version": "2.6.0",
5
5
  "description": "Vinicunca ESLint config",
6
6
  "author": {
7
7
  "name": "praburangki",
@@ -58,49 +58,49 @@
58
58
  "eslint": ">=8.57.0"
59
59
  },
60
60
  "dependencies": {
61
- "@stylistic/eslint-plugin": "^1.7.0",
62
- "@typescript-eslint/eslint-plugin": "^7.6.0",
63
- "@typescript-eslint/parser": "^7.6.0",
64
- "@unocss/eslint-plugin": "^0.59.0",
65
- "@vinicunca/eslint-plugin-vinicunca": "^1.0.10",
66
- "eslint": "^9.0.0",
61
+ "@stylistic/eslint-plugin": "^2.1.0",
62
+ "@typescript-eslint/eslint-plugin": "^7.11.0",
63
+ "@typescript-eslint/parser": "^7.11.0",
64
+ "@unocss/eslint-plugin": "^0.60.4",
67
65
  "eslint-config-flat-gitignore": "^0.1.5",
68
- "eslint-flat-config-utils": "^0.2.2",
66
+ "eslint-flat-config-utils": "^0.2.5",
69
67
  "eslint-merge-processors": "^0.1.0",
68
+ "eslint-plugin-antfu": "^2.3.3",
70
69
  "eslint-plugin-eslint-comments": "^3.2.0",
71
- "eslint-plugin-format": "^0.1.0",
72
- "eslint-plugin-import-x": "^0.5.0",
73
- "eslint-plugin-jsdoc": "^48.2.3",
74
- "eslint-plugin-jsonc": "^2.15.0",
75
- "eslint-plugin-markdown": "^4.0.1",
76
- "eslint-plugin-n": "^17.2.0",
70
+ "eslint-plugin-format": "^0.1.1",
71
+ "eslint-plugin-import-x": "^0.5.1",
72
+ "eslint-plugin-jsdoc": "^48.2.7",
73
+ "eslint-plugin-jsonc": "^2.16.0",
74
+ "eslint-plugin-markdown": "^5.0.0",
75
+ "eslint-plugin-n": "^17.7.0",
77
76
  "eslint-plugin-no-only-tests": "^3.1.0",
78
- "eslint-plugin-perfectionist": "^2.8.0",
79
- "eslint-plugin-react": "^7.34.1",
80
- "eslint-plugin-react-hooks": "^4.6.0",
81
- "eslint-plugin-unicorn": "^52.0.0",
82
- "eslint-plugin-unused-imports": "^3.1.0",
83
- "eslint-plugin-vitest": "^0.5.1",
84
- "eslint-plugin-vue": "^9.24.1",
77
+ "eslint-plugin-perfectionist": "^2.10.0",
78
+ "eslint-plugin-react": "^7.34.2",
79
+ "eslint-plugin-react-hooks": "^4.6.2",
80
+ "eslint-plugin-regexp": "^2.6.0",
81
+ "eslint-plugin-sonarjs": "^1.0.3",
82
+ "eslint-plugin-unicorn": "^53.0.0",
83
+ "eslint-plugin-unused-imports": "^4.0.0",
84
+ "eslint-plugin-vitest": "^0.5.4",
85
+ "eslint-plugin-vue": "^9.26.0",
85
86
  "eslint-plugin-yml": "^1.14.0",
86
- "eslint-processor-vue-blocks": "^0.1.1",
87
- "eslint-typegen": "^0.2.2",
88
- "globals": "^15.0.0",
87
+ "eslint-processor-vue-blocks": "^0.1.2",
88
+ "globals": "^15.3.0",
89
89
  "jsonc-eslint-parser": "^2.4.0",
90
90
  "local-pkg": "^0.5.0",
91
- "vue-eslint-parser": "^9.4.2",
92
- "yaml-eslint-parser": "^1.2.2"
91
+ "vue-eslint-parser": "^9.4.3",
92
+ "yaml-eslint-parser": "^1.2.3"
93
93
  },
94
94
  "devDependencies": {
95
- "@eslint-stylistic/metadata": "^1.7.0",
96
- "@types/eslint": "^8.56.7",
95
+ "@types/eslint": "^8.56.10",
97
96
  "@types/fs-extra": "^11.0.4",
98
- "execa": "^8.0.1",
97
+ "eslint-typegen": "^0.2.4",
98
+ "execa": "^9.1.0",
99
99
  "fast-glob": "^3.3.2",
100
100
  "fs-extra": "^11.2.0",
101
- "react": "^18.2.0",
101
+ "react": "^18.3.1",
102
102
  "tsup": "^8.0.2",
103
- "vue": "^3.4.21"
103
+ "vue": "^3.4.27"
104
104
  },
105
105
  "scripts": {
106
106
  "lint": "eslint -v",