@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.cjs +73 -31
- package/dist/index.d.cts +650 -95
- package/dist/index.d.ts +650 -95
- package/dist/index.js +72 -31
- package/package.json +18 -17
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 [
|
|
@@ -2256,8 +2283,16 @@ async function typescript(options = {}) {
|
|
|
2256
2283
|
// Temporary turning it off due to performance
|
|
2257
2284
|
"ts/no-misused-promises": OFF,
|
|
2258
2285
|
"ts/no-throw-literal": ERROR,
|
|
2286
|
+
"ts/no-unnecessary-type-assertion": ERROR,
|
|
2287
|
+
"ts/no-unsafe-argument": ERROR,
|
|
2288
|
+
"ts/no-unsafe-assignment": ERROR,
|
|
2289
|
+
"ts/no-unsafe-call": ERROR,
|
|
2290
|
+
"ts/no-unsafe-member-access": ERROR,
|
|
2291
|
+
"ts/no-unsafe-return": ERROR,
|
|
2259
2292
|
"ts/restrict-plus-operands": ERROR,
|
|
2260
|
-
"ts/restrict-template-expressions": ERROR
|
|
2293
|
+
"ts/restrict-template-expressions": ERROR,
|
|
2294
|
+
"ts/strict-boolean-expressions": ERROR,
|
|
2295
|
+
"ts/unbound-method": ERROR
|
|
2261
2296
|
};
|
|
2262
2297
|
const [
|
|
2263
2298
|
pluginTs,
|
|
@@ -2327,7 +2362,7 @@ async function typescript(options = {}) {
|
|
|
2327
2362
|
"ts/explicit-member-accessibility": OFF,
|
|
2328
2363
|
"ts/explicit-module-boundary-types": OFF,
|
|
2329
2364
|
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
2330
|
-
"ts/method-signature-style": [
|
|
2365
|
+
"ts/method-signature-style": [ERROR, "property"],
|
|
2331
2366
|
"ts/naming-convention": OFF,
|
|
2332
2367
|
"ts/no-dupe-class-members": ERROR,
|
|
2333
2368
|
"ts/no-empty-function": OFF,
|
|
@@ -2691,6 +2726,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2691
2726
|
gitignore: enableGitignore = true,
|
|
2692
2727
|
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
2728
|
react: enableReact = false,
|
|
2729
|
+
regexp: enableRegexp = true,
|
|
2694
2730
|
typescript: enableTypeScript = (0, import_local_pkg.isPackageExists)("typescript"),
|
|
2695
2731
|
unocss: enableUnoCSS = false,
|
|
2696
2732
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i))
|
|
@@ -2704,17 +2740,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2704
2740
|
jsx: options.jsx ?? true
|
|
2705
2741
|
};
|
|
2706
2742
|
}
|
|
2707
|
-
const
|
|
2743
|
+
const configs2 = [];
|
|
2708
2744
|
if (enableGitignore) {
|
|
2709
2745
|
if (typeof enableGitignore !== "boolean") {
|
|
2710
|
-
|
|
2746
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
2711
2747
|
} else {
|
|
2712
2748
|
if (import_node_fs.default.existsSync(".gitignore")) {
|
|
2713
|
-
|
|
2749
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
2714
2750
|
}
|
|
2715
2751
|
}
|
|
2716
2752
|
}
|
|
2717
|
-
|
|
2753
|
+
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2754
|
+
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2755
|
+
configs2.push(
|
|
2718
2756
|
ignores(),
|
|
2719
2757
|
javascript({
|
|
2720
2758
|
isInEditor,
|
|
@@ -2734,26 +2772,29 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2734
2772
|
componentExts.push("vue");
|
|
2735
2773
|
}
|
|
2736
2774
|
if (enableTypeScript) {
|
|
2737
|
-
|
|
2738
|
-
...
|
|
2775
|
+
configs2.push(typescript({
|
|
2776
|
+
...typescriptOptions,
|
|
2739
2777
|
componentExts,
|
|
2740
2778
|
overrides: getOverrides(options, "typescript")
|
|
2741
2779
|
}));
|
|
2742
2780
|
}
|
|
2743
2781
|
if (stylisticOptions) {
|
|
2744
|
-
|
|
2782
|
+
configs2.push(stylistic({
|
|
2745
2783
|
...stylisticOptions,
|
|
2746
2784
|
overrides: getOverrides(options, "stylistic")
|
|
2747
2785
|
}));
|
|
2748
2786
|
}
|
|
2787
|
+
if (enableRegexp) {
|
|
2788
|
+
configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
|
2789
|
+
}
|
|
2749
2790
|
if (options.test ?? true) {
|
|
2750
|
-
|
|
2791
|
+
configs2.push(test({
|
|
2751
2792
|
isInEditor,
|
|
2752
2793
|
overrides: getOverrides(options, "test")
|
|
2753
2794
|
}));
|
|
2754
2795
|
}
|
|
2755
2796
|
if (enableVue) {
|
|
2756
|
-
|
|
2797
|
+
configs2.push(vue({
|
|
2757
2798
|
...resolveSubOptions(options, "vue"),
|
|
2758
2799
|
overrides: getOverrides(options, "vue"),
|
|
2759
2800
|
stylistic: stylisticOptions,
|
|
@@ -2761,19 +2802,19 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2761
2802
|
}));
|
|
2762
2803
|
}
|
|
2763
2804
|
if (enableReact) {
|
|
2764
|
-
|
|
2805
|
+
configs2.push(react({
|
|
2765
2806
|
overrides: getOverrides(options, "react"),
|
|
2766
|
-
|
|
2807
|
+
tsconfigPath
|
|
2767
2808
|
}));
|
|
2768
2809
|
}
|
|
2769
2810
|
if (enableUnoCSS) {
|
|
2770
|
-
|
|
2811
|
+
configs2.push(unocss({
|
|
2771
2812
|
...resolveSubOptions(options, "unocss"),
|
|
2772
2813
|
overrides: getOverrides(options, "unocss")
|
|
2773
2814
|
}));
|
|
2774
2815
|
}
|
|
2775
2816
|
if (options.jsonc ?? true) {
|
|
2776
|
-
|
|
2817
|
+
configs2.push(
|
|
2777
2818
|
jsonc({
|
|
2778
2819
|
overrides: getOverrides(options, "jsonc"),
|
|
2779
2820
|
stylistic: stylisticOptions
|
|
@@ -2783,13 +2824,13 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2783
2824
|
);
|
|
2784
2825
|
}
|
|
2785
2826
|
if (options.yaml ?? true) {
|
|
2786
|
-
|
|
2827
|
+
configs2.push(yaml({
|
|
2787
2828
|
overrides: getOverrides(options, "yaml"),
|
|
2788
2829
|
stylistic: stylisticOptions
|
|
2789
2830
|
}));
|
|
2790
2831
|
}
|
|
2791
2832
|
if (options.markdown ?? true) {
|
|
2792
|
-
|
|
2833
|
+
configs2.push(
|
|
2793
2834
|
markdown(
|
|
2794
2835
|
{
|
|
2795
2836
|
componentExts,
|
|
@@ -2799,7 +2840,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2799
2840
|
);
|
|
2800
2841
|
}
|
|
2801
2842
|
if (options.formatters) {
|
|
2802
|
-
|
|
2843
|
+
configs2.push(formatters(
|
|
2803
2844
|
options.formatters,
|
|
2804
2845
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2805
2846
|
));
|
|
@@ -2812,12 +2853,12 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2812
2853
|
return acc;
|
|
2813
2854
|
}, {});
|
|
2814
2855
|
if (Object.keys(fusedConfig).length) {
|
|
2815
|
-
|
|
2856
|
+
configs2.push([fusedConfig]);
|
|
2816
2857
|
}
|
|
2817
2858
|
;
|
|
2818
2859
|
let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
2819
2860
|
composer = composer.append(
|
|
2820
|
-
...
|
|
2861
|
+
...configs2,
|
|
2821
2862
|
...userConfigs
|
|
2822
2863
|
);
|
|
2823
2864
|
if (autoRenamePlugins) {
|
|
@@ -2883,6 +2924,7 @@ function resolveSubOptions(options, key) {
|
|
|
2883
2924
|
pluginUnicorn,
|
|
2884
2925
|
pluginUnusedImports,
|
|
2885
2926
|
react,
|
|
2927
|
+
regexp,
|
|
2886
2928
|
renamePluginInConfigs,
|
|
2887
2929
|
renameRules,
|
|
2888
2930
|
sonar,
|