@vinicunca/eslint-config 2.4.3 → 2.5.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 +49 -38
- package/dist/index.d.cts +436 -417
- package/dist/index.d.ts +436 -417
- package/dist/index.js +51 -42
- package/package.json +26 -26
package/dist/index.cjs
CHANGED
|
@@ -68,16 +68,18 @@ __export(src_exports, {
|
|
|
68
68
|
node: () => node,
|
|
69
69
|
parserPlain: () => parserPlain,
|
|
70
70
|
perfectionist: () => perfectionist,
|
|
71
|
+
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
71
72
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
72
73
|
pluginImport: () => pluginImport,
|
|
73
74
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
74
75
|
pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
|
|
76
|
+
pluginSonar: () => import_eslint_plugin_sonarjs.default,
|
|
75
77
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
76
78
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
77
|
-
pluginVinicunca: () => import_eslint_plugin_vinicunca.default,
|
|
78
79
|
react: () => react,
|
|
79
80
|
renamePluginInConfigs: () => renamePluginInConfigs,
|
|
80
81
|
renameRules: () => renameRules,
|
|
82
|
+
sonar: () => sonar,
|
|
81
83
|
sortPackageJson: () => sortPackageJson,
|
|
82
84
|
sortTsconfig: () => sortTsconfig,
|
|
83
85
|
stylistic: () => stylistic,
|
|
@@ -865,11 +867,12 @@ var NEVER = "never";
|
|
|
865
867
|
var ALWAYS = "always";
|
|
866
868
|
|
|
867
869
|
// src/plugins.ts
|
|
868
|
-
var
|
|
870
|
+
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
869
871
|
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
870
872
|
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
871
873
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
872
874
|
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
875
|
+
var import_eslint_plugin_sonarjs = __toESM(require("eslint-plugin-sonarjs"), 1);
|
|
873
876
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
874
877
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
875
878
|
|
|
@@ -1056,8 +1059,8 @@ async function stylistic(options = {}) {
|
|
|
1056
1059
|
{
|
|
1057
1060
|
name: "vinicunca/stylistic/rules",
|
|
1058
1061
|
plugins: {
|
|
1059
|
-
|
|
1060
|
-
|
|
1062
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
1063
|
+
style: pluginStylistic
|
|
1061
1064
|
},
|
|
1062
1065
|
rules: {
|
|
1063
1066
|
...config.rules,
|
|
@@ -1119,17 +1122,8 @@ async function stylistic(options = {}) {
|
|
|
1119
1122
|
"style/rest-spread-spacing": [ERROR, NEVER],
|
|
1120
1123
|
"style/semi": [ERROR, semi ? ALWAYS : NEVER],
|
|
1121
1124
|
"style/semi-spacing": [ERROR, { after: true, before: false }],
|
|
1122
|
-
"vinicunca/consistent-list-newline": ERROR,
|
|
1123
|
-
"vinicunca/if-newline": ERROR,
|
|
1124
|
-
"vinicunca/top-level-function": ERROR,
|
|
1125
1125
|
...overrides
|
|
1126
1126
|
}
|
|
1127
|
-
},
|
|
1128
|
-
{
|
|
1129
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
1130
|
-
rules: {
|
|
1131
|
-
"vinicunca/consistent-list-newline": OFF
|
|
1132
|
-
}
|
|
1133
1127
|
}
|
|
1134
1128
|
];
|
|
1135
1129
|
}
|
|
@@ -1310,8 +1304,8 @@ async function imports() {
|
|
|
1310
1304
|
{
|
|
1311
1305
|
name: "vinicunca/imports/rules",
|
|
1312
1306
|
plugins: {
|
|
1313
|
-
|
|
1314
|
-
|
|
1307
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
1308
|
+
import: pluginImport
|
|
1315
1309
|
},
|
|
1316
1310
|
rules: {
|
|
1317
1311
|
"import/export": ERROR,
|
|
@@ -1326,9 +1320,7 @@ async function imports() {
|
|
|
1326
1320
|
"import/no-self-import": ERROR,
|
|
1327
1321
|
"import/no-webpack-loader-syntax": ERROR,
|
|
1328
1322
|
// Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-imports
|
|
1329
|
-
"import/order": OFF
|
|
1330
|
-
"vinicunca/import-dedupe": ERROR,
|
|
1331
|
-
"vinicunca/no-import-node-modules-by-path": ERROR
|
|
1323
|
+
"import/order": OFF
|
|
1332
1324
|
}
|
|
1333
1325
|
}
|
|
1334
1326
|
];
|
|
@@ -1367,8 +1359,8 @@ async function javascript(options = {}) {
|
|
|
1367
1359
|
},
|
|
1368
1360
|
name: "vinicunca/javascript/rules",
|
|
1369
1361
|
plugins: {
|
|
1370
|
-
"
|
|
1371
|
-
"
|
|
1362
|
+
"antfu": import_eslint_plugin_antfu.default,
|
|
1363
|
+
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
1372
1364
|
},
|
|
1373
1365
|
rules: {
|
|
1374
1366
|
"accessor-pairs": [ERROR, {
|
|
@@ -1588,7 +1580,6 @@ async function javascript(options = {}) {
|
|
|
1588
1580
|
}],
|
|
1589
1581
|
"vars-on-top": ERROR,
|
|
1590
1582
|
"yoda": [ERROR, NEVER],
|
|
1591
|
-
...import_eslint_plugin_vinicunca.default.configs.recommended.rules,
|
|
1592
1583
|
...overrides
|
|
1593
1584
|
}
|
|
1594
1585
|
},
|
|
@@ -1806,7 +1797,6 @@ async function markdown(options = {}) {
|
|
|
1806
1797
|
"ts/restrict-template-expressions": OFF,
|
|
1807
1798
|
"ts/unbound-method": OFF
|
|
1808
1799
|
},
|
|
1809
|
-
"vinicunca/no-ts-export-equal": OFF,
|
|
1810
1800
|
...overrides
|
|
1811
1801
|
}
|
|
1812
1802
|
}
|
|
@@ -1945,6 +1935,21 @@ async function react(options = {}) {
|
|
|
1945
1935
|
];
|
|
1946
1936
|
}
|
|
1947
1937
|
|
|
1938
|
+
// src/configs/sonar.ts
|
|
1939
|
+
async function sonar() {
|
|
1940
|
+
return [
|
|
1941
|
+
{
|
|
1942
|
+
name: "vinicunca/sonar/rules",
|
|
1943
|
+
plugins: {
|
|
1944
|
+
sonar: import_eslint_plugin_sonarjs.default
|
|
1945
|
+
},
|
|
1946
|
+
rules: {
|
|
1947
|
+
...import_eslint_plugin_sonarjs.default.configs.recommended.rules
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
];
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1948
1953
|
// src/configs/sort-package-json.ts
|
|
1949
1954
|
async function sortPackageJson() {
|
|
1950
1955
|
return [
|
|
@@ -2178,6 +2183,7 @@ function sortTsconfig() {
|
|
|
2178
2183
|
}
|
|
2179
2184
|
|
|
2180
2185
|
// src/configs/test.ts
|
|
2186
|
+
var _pluginTest;
|
|
2181
2187
|
async function test(options = {}) {
|
|
2182
2188
|
const {
|
|
2183
2189
|
files = GLOB_TESTS,
|
|
@@ -2192,18 +2198,19 @@ async function test(options = {}) {
|
|
|
2192
2198
|
// @ts-expect-error missing types
|
|
2193
2199
|
interopDefault(import("eslint-plugin-no-only-tests"))
|
|
2194
2200
|
]);
|
|
2201
|
+
_pluginTest = _pluginTest || {
|
|
2202
|
+
...pluginVitest,
|
|
2203
|
+
rules: {
|
|
2204
|
+
...pluginVitest.rules,
|
|
2205
|
+
// extend `test/no-only-tests` rule
|
|
2206
|
+
...pluginNoOnlyTests.rules
|
|
2207
|
+
}
|
|
2208
|
+
};
|
|
2195
2209
|
return [
|
|
2196
2210
|
{
|
|
2197
2211
|
name: "vinicunca/test/setup",
|
|
2198
2212
|
plugins: {
|
|
2199
|
-
test:
|
|
2200
|
-
...pluginVitest,
|
|
2201
|
-
rules: {
|
|
2202
|
-
...pluginVitest.rules,
|
|
2203
|
-
// extend `test/no-only-tests` rule
|
|
2204
|
-
...pluginNoOnlyTests.rules
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2213
|
+
test: _pluginTest
|
|
2207
2214
|
}
|
|
2208
2215
|
},
|
|
2209
2216
|
{
|
|
@@ -2283,8 +2290,8 @@ async function typescript(options = {}) {
|
|
|
2283
2290
|
// Install the plugins without globs, so they can be configured separately.
|
|
2284
2291
|
name: "vinicunca/typescript/setup",
|
|
2285
2292
|
plugins: {
|
|
2286
|
-
|
|
2287
|
-
|
|
2293
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
2294
|
+
ts: pluginTs
|
|
2288
2295
|
}
|
|
2289
2296
|
},
|
|
2290
2297
|
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
@@ -2673,6 +2680,7 @@ var defaultPluginRenaming = {
|
|
|
2673
2680
|
"@typescript-eslint": "ts",
|
|
2674
2681
|
"import-x": "import",
|
|
2675
2682
|
"n": "node",
|
|
2683
|
+
"sonarjs": "sonar",
|
|
2676
2684
|
"vitest": "test",
|
|
2677
2685
|
"yml": "yaml"
|
|
2678
2686
|
};
|
|
@@ -2719,7 +2727,8 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2719
2727
|
}),
|
|
2720
2728
|
imports(),
|
|
2721
2729
|
unicorn(),
|
|
2722
|
-
perfectionist()
|
|
2730
|
+
perfectionist(),
|
|
2731
|
+
sonar()
|
|
2723
2732
|
);
|
|
2724
2733
|
if (enableVue) {
|
|
2725
2734
|
componentExts.push("vue");
|
|
@@ -2806,15 +2815,15 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2806
2815
|
configs.push([fusedConfig]);
|
|
2807
2816
|
}
|
|
2808
2817
|
;
|
|
2809
|
-
let
|
|
2810
|
-
|
|
2818
|
+
let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
2819
|
+
composer = composer.append(
|
|
2811
2820
|
...configs,
|
|
2812
2821
|
...userConfigs
|
|
2813
2822
|
);
|
|
2814
2823
|
if (autoRenamePlugins) {
|
|
2815
|
-
|
|
2824
|
+
composer = composer.renamePlugins(defaultPluginRenaming);
|
|
2816
2825
|
}
|
|
2817
|
-
return
|
|
2826
|
+
return composer;
|
|
2818
2827
|
}
|
|
2819
2828
|
function getOverrides(options, key) {
|
|
2820
2829
|
const sub = resolveSubOptions(options, key);
|
|
@@ -2865,16 +2874,18 @@ function resolveSubOptions(options, key) {
|
|
|
2865
2874
|
node,
|
|
2866
2875
|
parserPlain,
|
|
2867
2876
|
perfectionist,
|
|
2877
|
+
pluginAntfu,
|
|
2868
2878
|
pluginComments,
|
|
2869
2879
|
pluginImport,
|
|
2870
2880
|
pluginNode,
|
|
2871
2881
|
pluginPerfectionist,
|
|
2882
|
+
pluginSonar,
|
|
2872
2883
|
pluginUnicorn,
|
|
2873
2884
|
pluginUnusedImports,
|
|
2874
|
-
pluginVinicunca,
|
|
2875
2885
|
react,
|
|
2876
2886
|
renamePluginInConfigs,
|
|
2877
2887
|
renameRules,
|
|
2888
|
+
sonar,
|
|
2878
2889
|
sortPackageJson,
|
|
2879
2890
|
sortTsconfig,
|
|
2880
2891
|
stylistic,
|