@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.cjs +65 -30
- package/dist/index.d.cts +630 -93
- package/dist/index.d.ts +630 -93
- package/dist/index.js +64 -30
- package/package.json +17 -16
package/dist/index.cjs
CHANGED
|
@@ -77,6 +77,7 @@ __export(src_exports, {
|
|
|
77
77
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
78
78
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
79
79
|
react: () => react,
|
|
80
|
+
regexp: () => regexp,
|
|
80
81
|
renamePluginInConfigs: () => renamePluginInConfigs,
|
|
81
82
|
renameRules: () => renameRules,
|
|
82
83
|
sonar: () => sonar,
|
|
@@ -964,8 +965,8 @@ var GLOB_EXCLUDE = [
|
|
|
964
965
|
];
|
|
965
966
|
|
|
966
967
|
// src/utils.ts
|
|
967
|
-
async function combineConfigs(...
|
|
968
|
-
const resolved = await Promise.all(
|
|
968
|
+
async function combineConfigs(...configs2) {
|
|
969
|
+
const resolved = await Promise.all(configs2);
|
|
969
970
|
return resolved.flat();
|
|
970
971
|
}
|
|
971
972
|
function renameRules(rules, map2) {
|
|
@@ -980,8 +981,8 @@ function renameRules(rules, map2) {
|
|
|
980
981
|
})
|
|
981
982
|
);
|
|
982
983
|
}
|
|
983
|
-
function renamePluginInConfigs(
|
|
984
|
-
return
|
|
984
|
+
function renamePluginInConfigs(configs2, map2) {
|
|
985
|
+
return configs2.map((i) => {
|
|
985
986
|
const clone = { ...i };
|
|
986
987
|
if (clone.rules) {
|
|
987
988
|
clone.rules = renameRules(clone.rules, map2);
|
|
@@ -1166,7 +1167,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
1166
1167
|
options.dprintOptions || {}
|
|
1167
1168
|
);
|
|
1168
1169
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
1169
|
-
const
|
|
1170
|
+
const configs2 = [
|
|
1170
1171
|
{
|
|
1171
1172
|
name: "vinicunca/formatter/setup",
|
|
1172
1173
|
plugins: {
|
|
@@ -1175,7 +1176,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
1175
1176
|
}
|
|
1176
1177
|
];
|
|
1177
1178
|
if (options.css) {
|
|
1178
|
-
|
|
1179
|
+
configs2.push(
|
|
1179
1180
|
{
|
|
1180
1181
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
1181
1182
|
languageOptions: {
|
|
@@ -1227,7 +1228,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
1227
1228
|
);
|
|
1228
1229
|
}
|
|
1229
1230
|
if (options.html) {
|
|
1230
|
-
|
|
1231
|
+
configs2.push({
|
|
1231
1232
|
files: ["**/*.html"],
|
|
1232
1233
|
languageOptions: {
|
|
1233
1234
|
parser: parserPlain
|
|
@@ -1246,7 +1247,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
1246
1247
|
}
|
|
1247
1248
|
if (options.markdown) {
|
|
1248
1249
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
1249
|
-
|
|
1250
|
+
configs2.push({
|
|
1250
1251
|
files: [GLOB_MARKDOWN],
|
|
1251
1252
|
languageOptions: {
|
|
1252
1253
|
parser: parserPlain
|
|
@@ -1269,7 +1270,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
1269
1270
|
});
|
|
1270
1271
|
}
|
|
1271
1272
|
if (options.graphql) {
|
|
1272
|
-
|
|
1273
|
+
configs2.push({
|
|
1273
1274
|
files: ["**/*.graphql"],
|
|
1274
1275
|
languageOptions: {
|
|
1275
1276
|
parser: parserPlain
|
|
@@ -1286,7 +1287,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
1286
1287
|
}
|
|
1287
1288
|
});
|
|
1288
1289
|
}
|
|
1289
|
-
return
|
|
1290
|
+
return configs2;
|
|
1290
1291
|
}
|
|
1291
1292
|
|
|
1292
1293
|
// src/configs/ignores.ts
|
|
@@ -1867,7 +1868,7 @@ async function perfectionist() {
|
|
|
1867
1868
|
// src/configs/react.ts
|
|
1868
1869
|
async function react(options = {}) {
|
|
1869
1870
|
const {
|
|
1870
|
-
files = [GLOB_JSX, GLOB_TSX],
|
|
1871
|
+
files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
|
|
1871
1872
|
overrides = {}
|
|
1872
1873
|
} = options;
|
|
1873
1874
|
const [
|
|
@@ -1935,6 +1936,32 @@ async function react(options = {}) {
|
|
|
1935
1936
|
];
|
|
1936
1937
|
}
|
|
1937
1938
|
|
|
1939
|
+
// src/configs/regexp.ts
|
|
1940
|
+
var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
1941
|
+
async function regexp(options = {}) {
|
|
1942
|
+
const config = import_eslint_plugin_regexp.configs["flat/recommended"];
|
|
1943
|
+
const rules = {
|
|
1944
|
+
...config.rules
|
|
1945
|
+
};
|
|
1946
|
+
if (options.level === WARN) {
|
|
1947
|
+
for (const key in rules) {
|
|
1948
|
+
if (rules[key] === ERROR) {
|
|
1949
|
+
rules[key] = WARN;
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
return [
|
|
1954
|
+
{
|
|
1955
|
+
...config,
|
|
1956
|
+
name: "vinicunca/regexp/rules",
|
|
1957
|
+
rules: {
|
|
1958
|
+
...rules,
|
|
1959
|
+
...options.overrides
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
];
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1938
1965
|
// src/configs/sonar.ts
|
|
1939
1966
|
async function sonar() {
|
|
1940
1967
|
return [
|
|
@@ -2257,7 +2284,8 @@ async function typescript(options = {}) {
|
|
|
2257
2284
|
"ts/no-misused-promises": OFF,
|
|
2258
2285
|
"ts/no-throw-literal": ERROR,
|
|
2259
2286
|
"ts/restrict-plus-operands": ERROR,
|
|
2260
|
-
"ts/restrict-template-expressions": ERROR
|
|
2287
|
+
"ts/restrict-template-expressions": ERROR,
|
|
2288
|
+
"ts/strict-boolean-expressions": "error"
|
|
2261
2289
|
};
|
|
2262
2290
|
const [
|
|
2263
2291
|
pluginTs,
|
|
@@ -2691,6 +2719,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2691
2719
|
gitignore: enableGitignore = true,
|
|
2692
2720
|
isInEditor = !!((import_node_process2.default.env.VSCODE_PID || import_node_process2.default.env.JETBRAINS_IDE || import_node_process2.default.env.VIM) && !import_node_process2.default.env.CI),
|
|
2693
2721
|
react: enableReact = false,
|
|
2722
|
+
regexp: enableRegexp = true,
|
|
2694
2723
|
typescript: enableTypeScript = (0, import_local_pkg.isPackageExists)("typescript"),
|
|
2695
2724
|
unocss: enableUnoCSS = false,
|
|
2696
2725
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i))
|
|
@@ -2704,17 +2733,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2704
2733
|
jsx: options.jsx ?? true
|
|
2705
2734
|
};
|
|
2706
2735
|
}
|
|
2707
|
-
const
|
|
2736
|
+
const configs2 = [];
|
|
2708
2737
|
if (enableGitignore) {
|
|
2709
2738
|
if (typeof enableGitignore !== "boolean") {
|
|
2710
|
-
|
|
2739
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
2711
2740
|
} else {
|
|
2712
2741
|
if (import_node_fs.default.existsSync(".gitignore")) {
|
|
2713
|
-
|
|
2742
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
2714
2743
|
}
|
|
2715
2744
|
}
|
|
2716
2745
|
}
|
|
2717
|
-
|
|
2746
|
+
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2747
|
+
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2748
|
+
configs2.push(
|
|
2718
2749
|
ignores(),
|
|
2719
2750
|
javascript({
|
|
2720
2751
|
isInEditor,
|
|
@@ -2734,26 +2765,29 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2734
2765
|
componentExts.push("vue");
|
|
2735
2766
|
}
|
|
2736
2767
|
if (enableTypeScript) {
|
|
2737
|
-
|
|
2738
|
-
...
|
|
2768
|
+
configs2.push(typescript({
|
|
2769
|
+
...typescriptOptions,
|
|
2739
2770
|
componentExts,
|
|
2740
2771
|
overrides: getOverrides(options, "typescript")
|
|
2741
2772
|
}));
|
|
2742
2773
|
}
|
|
2743
2774
|
if (stylisticOptions) {
|
|
2744
|
-
|
|
2775
|
+
configs2.push(stylistic({
|
|
2745
2776
|
...stylisticOptions,
|
|
2746
2777
|
overrides: getOverrides(options, "stylistic")
|
|
2747
2778
|
}));
|
|
2748
2779
|
}
|
|
2780
|
+
if (enableRegexp) {
|
|
2781
|
+
configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
|
2782
|
+
}
|
|
2749
2783
|
if (options.test ?? true) {
|
|
2750
|
-
|
|
2784
|
+
configs2.push(test({
|
|
2751
2785
|
isInEditor,
|
|
2752
2786
|
overrides: getOverrides(options, "test")
|
|
2753
2787
|
}));
|
|
2754
2788
|
}
|
|
2755
2789
|
if (enableVue) {
|
|
2756
|
-
|
|
2790
|
+
configs2.push(vue({
|
|
2757
2791
|
...resolveSubOptions(options, "vue"),
|
|
2758
2792
|
overrides: getOverrides(options, "vue"),
|
|
2759
2793
|
stylistic: stylisticOptions,
|
|
@@ -2761,19 +2795,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2761
2795
|
}));
|
|
2762
2796
|
}
|
|
2763
2797
|
if (enableReact) {
|
|
2764
|
-
|
|
2798
|
+
configs2.push(react({
|
|
2765
2799
|
overrides: getOverrides(options, "react"),
|
|
2766
|
-
|
|
2800
|
+
tsconfigPath
|
|
2767
2801
|
}));
|
|
2768
2802
|
}
|
|
2769
2803
|
if (enableUnoCSS) {
|
|
2770
|
-
|
|
2804
|
+
configs2.push(unocss({
|
|
2771
2805
|
...resolveSubOptions(options, "unocss"),
|
|
2772
2806
|
overrides: getOverrides(options, "unocss")
|
|
2773
2807
|
}));
|
|
2774
2808
|
}
|
|
2775
2809
|
if (options.jsonc ?? true) {
|
|
2776
|
-
|
|
2810
|
+
configs2.push(
|
|
2777
2811
|
jsonc({
|
|
2778
2812
|
overrides: getOverrides(options, "jsonc"),
|
|
2779
2813
|
stylistic: stylisticOptions
|
|
@@ -2783,13 +2817,13 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2783
2817
|
);
|
|
2784
2818
|
}
|
|
2785
2819
|
if (options.yaml ?? true) {
|
|
2786
|
-
|
|
2820
|
+
configs2.push(yaml({
|
|
2787
2821
|
overrides: getOverrides(options, "yaml"),
|
|
2788
2822
|
stylistic: stylisticOptions
|
|
2789
2823
|
}));
|
|
2790
2824
|
}
|
|
2791
2825
|
if (options.markdown ?? true) {
|
|
2792
|
-
|
|
2826
|
+
configs2.push(
|
|
2793
2827
|
markdown(
|
|
2794
2828
|
{
|
|
2795
2829
|
componentExts,
|
|
@@ -2799,7 +2833,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2799
2833
|
);
|
|
2800
2834
|
}
|
|
2801
2835
|
if (options.formatters) {
|
|
2802
|
-
|
|
2836
|
+
configs2.push(formatters(
|
|
2803
2837
|
options.formatters,
|
|
2804
2838
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2805
2839
|
));
|
|
@@ -2812,12 +2846,12 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2812
2846
|
return acc;
|
|
2813
2847
|
}, {});
|
|
2814
2848
|
if (Object.keys(fusedConfig).length) {
|
|
2815
|
-
|
|
2849
|
+
configs2.push([fusedConfig]);
|
|
2816
2850
|
}
|
|
2817
2851
|
;
|
|
2818
2852
|
let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
2819
2853
|
composer = composer.append(
|
|
2820
|
-
...
|
|
2854
|
+
...configs2,
|
|
2821
2855
|
...userConfigs
|
|
2822
2856
|
);
|
|
2823
2857
|
if (autoRenamePlugins) {
|
|
@@ -2883,6 +2917,7 @@ function resolveSubOptions(options, key) {
|
|
|
2883
2917
|
pluginUnicorn,
|
|
2884
2918
|
pluginUnusedImports,
|
|
2885
2919
|
react,
|
|
2920
|
+
regexp,
|
|
2886
2921
|
renamePluginInConfigs,
|
|
2887
2922
|
renameRules,
|
|
2888
2923
|
sonar,
|