@vinicunca/eslint-config 3.30.0 → 4.0.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/README.md +9 -0
- package/dist/{index-UNvaZool.d.ts → index.d.mts} +851 -321
- package/dist/{index.js → index.mjs} +348 -169
- package/dist/lib-BmGFlZdP.mjs +11154 -0
- package/package.json +86 -19
|
@@ -15,23 +15,21 @@ import globals from "globals";
|
|
|
15
15
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
16
16
|
import { configs } from "eslint-plugin-regexp";
|
|
17
17
|
|
|
18
|
-
//#region
|
|
18
|
+
//#region node_modules/.pnpm/@vinicunca+perkakas@1.9.0/node_modules/@vinicunca/perkakas/dist/is-boolean-CZKz4ij3.js
|
|
19
19
|
function e(e$3) {
|
|
20
20
|
return typeof e$3 == `boolean`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
|
-
//#region
|
|
25
|
-
function e$
|
|
26
|
-
return typeof e$3 == `
|
|
24
|
+
//#region node_modules/.pnpm/@vinicunca+perkakas@1.9.0/node_modules/@vinicunca/perkakas/dist/is-function-BwWA5uZn.js
|
|
25
|
+
function e$1(e$3) {
|
|
26
|
+
return typeof e$3 == `function`;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
|
-
//#region
|
|
31
|
-
function e$
|
|
32
|
-
|
|
33
|
-
let t = Object.getPrototypeOf(e$3);
|
|
34
|
-
return t === null || t === Object.prototype;
|
|
30
|
+
//#region node_modules/.pnpm/@vinicunca+perkakas@1.9.0/node_modules/@vinicunca/perkakas/dist/is-number-D5aNK4nm.js
|
|
31
|
+
function e$2(e$3) {
|
|
32
|
+
return typeof e$3 == `number` && !Number.isNaN(e$3);
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
//#endregion
|
|
@@ -61,7 +59,7 @@ const GLOB_JSON5 = "**/*.json5";
|
|
|
61
59
|
const GLOB_JSONC = "**/*.jsonc";
|
|
62
60
|
const GLOB_MARKDOWN = "**/*.md";
|
|
63
61
|
const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
64
|
-
const GLOB_SVELTE = "**/*.svelte";
|
|
62
|
+
const GLOB_SVELTE = "**/*.svelte?(.{js,ts})";
|
|
65
63
|
const GLOB_VUE = "**/*.vue";
|
|
66
64
|
const GLOB_YAML = "**/*.y?(a)ml";
|
|
67
65
|
const GLOB_TOML = "**/*.toml";
|
|
@@ -254,6 +252,7 @@ async function astro(options = {}) {
|
|
|
254
252
|
name: "vinicunca/astro/rules",
|
|
255
253
|
processor: "astro/client-side-ts",
|
|
256
254
|
rules: {
|
|
255
|
+
"antfu/no-top-level-await": OFF,
|
|
257
256
|
"astro/missing-client-only-directive-value": ERROR,
|
|
258
257
|
"astro/no-conflict-set-directives": ERROR,
|
|
259
258
|
"astro/no-deprecated-astro-canonicalurl": ERROR,
|
|
@@ -308,12 +307,13 @@ const STYLISTIC_CONFIG_DEFAULTS = {
|
|
|
308
307
|
semi: true
|
|
309
308
|
};
|
|
310
309
|
async function stylistic(options = {}) {
|
|
311
|
-
const { indent, jsx: jsx$1, overrides = {}, quotes, semi } = {
|
|
310
|
+
const { experimental, indent, jsx: jsx$1, overrides = {}, quotes, semi } = {
|
|
312
311
|
...STYLISTIC_CONFIG_DEFAULTS,
|
|
313
312
|
...options
|
|
314
313
|
};
|
|
315
314
|
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
316
315
|
const config = pluginStylistic.configs.customize({
|
|
316
|
+
experimental,
|
|
317
317
|
indent,
|
|
318
318
|
jsx: jsx$1,
|
|
319
319
|
pluginName: "style",
|
|
@@ -328,8 +328,8 @@ async function stylistic(options = {}) {
|
|
|
328
328
|
},
|
|
329
329
|
rules: {
|
|
330
330
|
...config.rules,
|
|
331
|
+
...experimental ? {} : { "antfu/consistent-list-newline": ERROR },
|
|
331
332
|
"antfu/consistent-chaining": ERROR,
|
|
332
|
-
"antfu/consistent-list-newline": ERROR,
|
|
333
333
|
"antfu/top-level-function": ERROR,
|
|
334
334
|
"curly": [ERROR, "all"],
|
|
335
335
|
"style/array-bracket-newline": [ERROR, CONSISTENT],
|
|
@@ -338,6 +338,10 @@ async function stylistic(options = {}) {
|
|
|
338
338
|
"style/arrow-parens": [ERROR, ALWAYS],
|
|
339
339
|
"style/brace-style": [ERROR],
|
|
340
340
|
"style/function-call-spacing": [ERROR, NEVER],
|
|
341
|
+
"style/generator-star-spacing": [ERROR, {
|
|
342
|
+
after: true,
|
|
343
|
+
before: false
|
|
344
|
+
}],
|
|
341
345
|
"style/member-delimiter-style": [ERROR],
|
|
342
346
|
"style/object-curly-newline": [ERROR, {
|
|
343
347
|
consistent: true,
|
|
@@ -359,10 +363,6 @@ async function stylistic(options = {}) {
|
|
|
359
363
|
after: true,
|
|
360
364
|
before: false
|
|
361
365
|
}],
|
|
362
|
-
"style/generator-star-spacing": ["error", {
|
|
363
|
-
after: true,
|
|
364
|
-
before: false
|
|
365
|
-
}],
|
|
366
366
|
"style/yield-star-spacing": ["error", {
|
|
367
367
|
after: true,
|
|
368
368
|
before: false
|
|
@@ -539,8 +539,11 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
539
539
|
//#endregion
|
|
540
540
|
//#region src/configs/ignores.ts
|
|
541
541
|
async function ignores(userIgnores = []) {
|
|
542
|
+
let ignores$1 = [...GLOB_EXCLUDE];
|
|
543
|
+
if (e$1(userIgnores)) ignores$1 = userIgnores(ignores$1);
|
|
544
|
+
else ignores$1 = [...ignores$1, ...userIgnores];
|
|
542
545
|
return [{
|
|
543
|
-
ignores:
|
|
546
|
+
ignores: ignores$1,
|
|
544
547
|
name: "vinicunca/ignores"
|
|
545
548
|
}];
|
|
546
549
|
}
|
|
@@ -917,11 +920,40 @@ async function jsonc(options = {}) {
|
|
|
917
920
|
|
|
918
921
|
//#endregion
|
|
919
922
|
//#region src/configs/jsx.ts
|
|
920
|
-
async function jsx() {
|
|
921
|
-
|
|
923
|
+
async function jsx(options = {}) {
|
|
924
|
+
const { a11y } = options;
|
|
925
|
+
const baseConfig = {
|
|
922
926
|
files: [GLOB_JSX, GLOB_TSX],
|
|
923
927
|
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
|
|
924
|
-
name: "
|
|
928
|
+
name: "antfu/jsx/setup",
|
|
929
|
+
plugins: {},
|
|
930
|
+
rules: {}
|
|
931
|
+
};
|
|
932
|
+
if (!a11y) return [baseConfig];
|
|
933
|
+
await ensurePackages(["eslint-plugin-jsx-a11y"]);
|
|
934
|
+
const jsxA11yPlugin = await interopDefault(import("eslint-plugin-jsx-a11y"));
|
|
935
|
+
const a11yConfig = jsxA11yPlugin.flatConfigs.recommended;
|
|
936
|
+
const a11yRules = {
|
|
937
|
+
...a11yConfig.rules || {},
|
|
938
|
+
...typeof a11y === "object" && a11y.overrides ? a11y.overrides : {}
|
|
939
|
+
};
|
|
940
|
+
return [{
|
|
941
|
+
...baseConfig,
|
|
942
|
+
...a11yConfig,
|
|
943
|
+
files: baseConfig.files,
|
|
944
|
+
languageOptions: {
|
|
945
|
+
...baseConfig.languageOptions,
|
|
946
|
+
...a11yConfig.languageOptions
|
|
947
|
+
},
|
|
948
|
+
name: baseConfig.name,
|
|
949
|
+
plugins: {
|
|
950
|
+
...baseConfig.plugins,
|
|
951
|
+
"jsx-a11y": jsxA11yPlugin
|
|
952
|
+
},
|
|
953
|
+
rules: {
|
|
954
|
+
...baseConfig.rules,
|
|
955
|
+
...a11yRules
|
|
956
|
+
}
|
|
925
957
|
}];
|
|
926
958
|
}
|
|
927
959
|
|
|
@@ -958,8 +990,8 @@ async function markdown(options = {}) {
|
|
|
958
990
|
"no-unused-vars": OFF,
|
|
959
991
|
"node/prefer-global/process": OFF,
|
|
960
992
|
"style/comma-dangle": OFF,
|
|
961
|
-
"style/padding-line-between-statements": OFF,
|
|
962
993
|
"style/eol-last": OFF,
|
|
994
|
+
"style/padding-line-between-statements": OFF,
|
|
963
995
|
"ts/consistent-type-imports": OFF,
|
|
964
996
|
"ts/no-namespace": OFF,
|
|
965
997
|
"ts/no-redeclare": OFF,
|
|
@@ -975,6 +1007,39 @@ async function markdown(options = {}) {
|
|
|
975
1007
|
];
|
|
976
1008
|
}
|
|
977
1009
|
|
|
1010
|
+
//#endregion
|
|
1011
|
+
//#region src/configs/nextjs.ts
|
|
1012
|
+
function normalizeRules(rules) {
|
|
1013
|
+
return Object.fromEntries(Object.entries(rules).map(([key, value]) => [key, typeof value === "string" ? [value] : value]));
|
|
1014
|
+
}
|
|
1015
|
+
async function nextjs(options = {}) {
|
|
1016
|
+
const { files = [GLOB_SRC], overrides = {} } = options;
|
|
1017
|
+
await ensurePackages(["@next/eslint-plugin-next"]);
|
|
1018
|
+
const pluginNextJS = await interopDefault(import("@next/eslint-plugin-next"));
|
|
1019
|
+
function getRules(name) {
|
|
1020
|
+
const rules = pluginNextJS.configs?.[name]?.rules;
|
|
1021
|
+
if (!rules) throw new Error(`[@vinicunca/eslint-config] Failed to find config ${name} in @next/eslint-plugin-next`);
|
|
1022
|
+
return normalizeRules(rules);
|
|
1023
|
+
}
|
|
1024
|
+
return [{
|
|
1025
|
+
name: "vinicunca/nextjs/setup",
|
|
1026
|
+
plugins: { next: pluginNextJS }
|
|
1027
|
+
}, {
|
|
1028
|
+
files,
|
|
1029
|
+
languageOptions: {
|
|
1030
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
1031
|
+
sourceType: "module"
|
|
1032
|
+
},
|
|
1033
|
+
name: "vinicunca/nextjs/rules",
|
|
1034
|
+
rules: {
|
|
1035
|
+
...getRules("recommended"),
|
|
1036
|
+
...getRules("core-web-vitals"),
|
|
1037
|
+
...overrides
|
|
1038
|
+
},
|
|
1039
|
+
settings: { react: { version: "detect" } }
|
|
1040
|
+
}];
|
|
1041
|
+
}
|
|
1042
|
+
|
|
978
1043
|
//#endregion
|
|
979
1044
|
//#region src/configs/node.ts
|
|
980
1045
|
async function node() {
|
|
@@ -1050,32 +1115,116 @@ async function perfectionist() {
|
|
|
1050
1115
|
|
|
1051
1116
|
//#endregion
|
|
1052
1117
|
//#region src/configs/pnpm.ts
|
|
1053
|
-
async function pnpm() {
|
|
1118
|
+
async function pnpm(options) {
|
|
1054
1119
|
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
1055
1120
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
1056
1121
|
interopDefault(import("yaml-eslint-parser")),
|
|
1057
1122
|
interopDefault(import("jsonc-eslint-parser"))
|
|
1058
1123
|
]);
|
|
1059
|
-
return [
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1124
|
+
return [
|
|
1125
|
+
{
|
|
1126
|
+
files: ["package.json", "**/package.json"],
|
|
1127
|
+
languageOptions: { parser: jsoncParser },
|
|
1128
|
+
name: "vinicunca/pnpm/package.json",
|
|
1129
|
+
plugins: { pnpm: pluginPnpm },
|
|
1130
|
+
rules: {
|
|
1131
|
+
"pnpm/json-enforce-catalog": [ERROR, { autofix: !options.isInEditor }],
|
|
1132
|
+
"pnpm/json-prefer-workspace-settings": [ERROR, { autofix: !options.isInEditor }],
|
|
1133
|
+
"pnpm/json-valid-catalog": [ERROR, { autofix: !options.isInEditor }]
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
files: ["pnpm-workspace.yaml"],
|
|
1138
|
+
languageOptions: { parser: yamlParser },
|
|
1139
|
+
name: "vinicunca/pnpm/pnpm-workspace-yaml",
|
|
1140
|
+
plugins: { pnpm: pluginPnpm },
|
|
1141
|
+
rules: {
|
|
1142
|
+
"pnpm/yaml-enforce-settings": [ERROR, { settings: {
|
|
1143
|
+
catalogMode: "prefer",
|
|
1144
|
+
shellEmulator: true,
|
|
1145
|
+
trustPolicy: "no-downgrade"
|
|
1146
|
+
} }],
|
|
1147
|
+
"pnpm/yaml-no-duplicate-catalog-item": ERROR,
|
|
1148
|
+
"pnpm/yaml-no-unused-catalog-item": ERROR
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
files: ["pnpm-workspace.yaml"],
|
|
1153
|
+
name: "vinicunca/pnpm/pnpm-workspace-yaml-sort",
|
|
1154
|
+
rules: { "yaml/sort-keys": [
|
|
1155
|
+
ERROR,
|
|
1156
|
+
{
|
|
1157
|
+
order: [
|
|
1158
|
+
...[
|
|
1159
|
+
"cacheDir",
|
|
1160
|
+
"catalogMode",
|
|
1161
|
+
"cleanupUnusedCatalogs",
|
|
1162
|
+
"dedupeDirectDeps",
|
|
1163
|
+
"deployAllFiles",
|
|
1164
|
+
"enablePrePostScripts",
|
|
1165
|
+
"engineStrict",
|
|
1166
|
+
"extendNodePath",
|
|
1167
|
+
"hoist",
|
|
1168
|
+
"hoistPattern",
|
|
1169
|
+
"hoistWorkspacePackages",
|
|
1170
|
+
"ignoreCompatibilityDb",
|
|
1171
|
+
"ignoreDepScripts",
|
|
1172
|
+
"ignoreScripts",
|
|
1173
|
+
"ignoreWorkspaceRootCheck",
|
|
1174
|
+
"managePackageManagerVersions",
|
|
1175
|
+
"minimumReleaseAge",
|
|
1176
|
+
"minimumReleaseAgeExclude",
|
|
1177
|
+
"modulesDir",
|
|
1178
|
+
"nodeLinker",
|
|
1179
|
+
"nodeVersion",
|
|
1180
|
+
"optimisticRepeatInstall",
|
|
1181
|
+
"packageManagerStrict",
|
|
1182
|
+
"packageManagerStrictVersion",
|
|
1183
|
+
"preferSymlinkedExecutables",
|
|
1184
|
+
"preferWorkspacePackages",
|
|
1185
|
+
"publicHoistPattern",
|
|
1186
|
+
"registrySupportsTimeField",
|
|
1187
|
+
"requiredScripts",
|
|
1188
|
+
"resolutionMode",
|
|
1189
|
+
"savePrefix",
|
|
1190
|
+
"scriptShell",
|
|
1191
|
+
"shamefullyHoist",
|
|
1192
|
+
"shellEmulator",
|
|
1193
|
+
"stateDir",
|
|
1194
|
+
"supportedArchitectures",
|
|
1195
|
+
"symlink",
|
|
1196
|
+
"tag",
|
|
1197
|
+
"trustPolicy",
|
|
1198
|
+
"trustPolicyExclude",
|
|
1199
|
+
"updateNotifier"
|
|
1200
|
+
],
|
|
1201
|
+
"packages",
|
|
1202
|
+
"overrides",
|
|
1203
|
+
"patchedDependencies",
|
|
1204
|
+
"catalog",
|
|
1205
|
+
"catalogs",
|
|
1206
|
+
...[
|
|
1207
|
+
"allowedDeprecatedVersions",
|
|
1208
|
+
"allowNonAppliedPatches",
|
|
1209
|
+
"configDependencies",
|
|
1210
|
+
"ignoredBuiltDependencies",
|
|
1211
|
+
"ignoredOptionalDependencies",
|
|
1212
|
+
"neverBuiltDependencies",
|
|
1213
|
+
"onlyBuiltDependencies",
|
|
1214
|
+
"onlyBuiltDependenciesFile",
|
|
1215
|
+
"packageExtensions",
|
|
1216
|
+
"peerDependencyRules"
|
|
1217
|
+
]
|
|
1218
|
+
],
|
|
1219
|
+
pathPattern: "^$"
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
order: { type: "asc" },
|
|
1223
|
+
pathPattern: ".*"
|
|
1224
|
+
}
|
|
1225
|
+
] }
|
|
1077
1226
|
}
|
|
1078
|
-
|
|
1227
|
+
];
|
|
1079
1228
|
}
|
|
1080
1229
|
|
|
1081
1230
|
//#endregion
|
|
@@ -1094,8 +1243,14 @@ const ReactRouterPackages = [
|
|
|
1094
1243
|
"@react-router/dev"
|
|
1095
1244
|
];
|
|
1096
1245
|
const NextJsPackages = ["next"];
|
|
1246
|
+
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
1097
1247
|
async function react(options = {}) {
|
|
1098
|
-
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath } = options;
|
|
1248
|
+
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, reactCompiler = ReactCompilerPackages.some((i) => isPackageExists(i)), tsconfigPath } = options;
|
|
1249
|
+
await ensurePackages([
|
|
1250
|
+
"@eslint-react/eslint-plugin",
|
|
1251
|
+
"eslint-plugin-react-hooks",
|
|
1252
|
+
"eslint-plugin-react-refresh"
|
|
1253
|
+
]);
|
|
1099
1254
|
const isTypeAware = !!tsconfigPath;
|
|
1100
1255
|
const typeAwareRules = { "react/no-leaked-conditional-rendering": WARN };
|
|
1101
1256
|
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
@@ -1129,6 +1284,26 @@ async function react(options = {}) {
|
|
|
1129
1284
|
},
|
|
1130
1285
|
name: "vinicunca/react/rules",
|
|
1131
1286
|
rules: {
|
|
1287
|
+
"react-dom/no-dangerously-set-innerhtml": WARN,
|
|
1288
|
+
"react-dom/no-dangerously-set-innerhtml-with-children": ERROR,
|
|
1289
|
+
"react-dom/no-find-dom-node": ERROR,
|
|
1290
|
+
"react-dom/no-flush-sync": ERROR,
|
|
1291
|
+
"react-dom/no-hydrate": ERROR,
|
|
1292
|
+
"react-dom/no-missing-button-type": WARN,
|
|
1293
|
+
"react-dom/no-missing-iframe-sandbox": WARN,
|
|
1294
|
+
"react-dom/no-namespace": ERROR,
|
|
1295
|
+
"react-dom/no-render": ERROR,
|
|
1296
|
+
"react-dom/no-render-return-value": ERROR,
|
|
1297
|
+
"react-dom/no-script-url": WARN,
|
|
1298
|
+
"react-dom/no-unsafe-iframe-sandbox": WARN,
|
|
1299
|
+
"react-dom/no-unsafe-target-blank": WARN,
|
|
1300
|
+
"react-dom/no-use-form-state": ERROR,
|
|
1301
|
+
"react-dom/no-void-elements-with-children": ERROR,
|
|
1302
|
+
"react-hooks/exhaustive-deps": WARN,
|
|
1303
|
+
"react-hooks/rules-of-hooks": ERROR,
|
|
1304
|
+
"react/jsx-no-comment-textnodes": WARN,
|
|
1305
|
+
"react/jsx-no-duplicate-props": WARN,
|
|
1306
|
+
"react/jsx-uses-vars": WARN,
|
|
1132
1307
|
"react/no-access-state-in-setstate": ERROR,
|
|
1133
1308
|
"react/no-array-index-key": WARN,
|
|
1134
1309
|
"react/no-children-count": WARN,
|
|
@@ -1137,7 +1312,6 @@ async function react(options = {}) {
|
|
|
1137
1312
|
"react/no-children-only": WARN,
|
|
1138
1313
|
"react/no-children-to-array": WARN,
|
|
1139
1314
|
"react/no-clone-element": WARN,
|
|
1140
|
-
"react/no-comment-textnodes": WARN,
|
|
1141
1315
|
"react/no-component-will-mount": ERROR,
|
|
1142
1316
|
"react/no-component-will-receive-props": ERROR,
|
|
1143
1317
|
"react/no-component-will-update": ERROR,
|
|
@@ -1145,7 +1319,6 @@ async function react(options = {}) {
|
|
|
1145
1319
|
"react/no-create-ref": ERROR,
|
|
1146
1320
|
"react/no-default-props": ERROR,
|
|
1147
1321
|
"react/no-direct-mutation-state": ERROR,
|
|
1148
|
-
"react/no-duplicate-jsx-props": WARN,
|
|
1149
1322
|
"react/no-duplicate-key": WARN,
|
|
1150
1323
|
"react/no-forward-ref": WARN,
|
|
1151
1324
|
"react/no-implicit-key": WARN,
|
|
@@ -1157,6 +1330,7 @@ async function react(options = {}) {
|
|
|
1157
1330
|
"react/no-set-state-in-component-did-update": WARN,
|
|
1158
1331
|
"react/no-set-state-in-component-will-update": WARN,
|
|
1159
1332
|
"react/no-string-refs": ERROR,
|
|
1333
|
+
"react/no-unnecessary-use-prefix": WARN,
|
|
1160
1334
|
"react/no-unsafe-component-will-mount": WARN,
|
|
1161
1335
|
"react/no-unsafe-component-will-receive-props": WARN,
|
|
1162
1336
|
"react/no-unsafe-component-will-update": WARN,
|
|
@@ -1166,30 +1340,25 @@ async function react(options = {}) {
|
|
|
1166
1340
|
"react/no-unused-state": WARN,
|
|
1167
1341
|
"react/no-use-context": WARN,
|
|
1168
1342
|
"react/no-useless-forward-ref": WARN,
|
|
1169
|
-
"react/use-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1343
|
+
"react/prefer-use-state-lazy-initialization": WARN,
|
|
1344
|
+
...reactCompiler ? {
|
|
1345
|
+
"react-hooks/component-hook-factories": ERROR,
|
|
1346
|
+
"react-hooks/config": ERROR,
|
|
1347
|
+
"react-hooks/error-boundaries": ERROR,
|
|
1348
|
+
"react-hooks/gating": ERROR,
|
|
1349
|
+
"react-hooks/globals": ERROR,
|
|
1350
|
+
"react-hooks/immutability": ERROR,
|
|
1351
|
+
"react-hooks/incompatible-library": WARN,
|
|
1352
|
+
"react-hooks/preserve-manual-memoization": ERROR,
|
|
1353
|
+
"react-hooks/purity": ERROR,
|
|
1354
|
+
"react-hooks/refs": ERROR,
|
|
1355
|
+
"react-hooks/set-state-in-effect": ERROR,
|
|
1356
|
+
"react-hooks/set-state-in-render": ERROR,
|
|
1357
|
+
"react-hooks/static-components": ERROR,
|
|
1358
|
+
"react-hooks/unsupported-syntax": WARN,
|
|
1359
|
+
"react-hooks/use-memo": ERROR
|
|
1360
|
+
} : {},
|
|
1187
1361
|
"react-hooks-extra/no-direct-set-state-in-use-effect": WARN,
|
|
1188
|
-
"react-hooks-extra/no-unnecessary-use-prefix": WARN,
|
|
1189
|
-
"react-web-api/no-leaked-event-listener": WARN,
|
|
1190
|
-
"react-web-api/no-leaked-interval": WARN,
|
|
1191
|
-
"react-web-api/no-leaked-resize-observer": WARN,
|
|
1192
|
-
"react-web-api/no-leaked-timeout": WARN,
|
|
1193
1362
|
"react-refresh/only-export-components": [WARN, {
|
|
1194
1363
|
allowConstantExport: isAllowConstantExport,
|
|
1195
1364
|
allowExportNames: [...isUsingNext ? [
|
|
@@ -1211,16 +1380,24 @@ async function react(options = {}) {
|
|
|
1211
1380
|
"links",
|
|
1212
1381
|
"headers",
|
|
1213
1382
|
"loader",
|
|
1214
|
-
"action"
|
|
1383
|
+
"action",
|
|
1384
|
+
"clientLoader",
|
|
1385
|
+
"clientAction",
|
|
1386
|
+
"handle",
|
|
1387
|
+
"shouldRevalidate"
|
|
1215
1388
|
] : []]
|
|
1216
1389
|
}],
|
|
1390
|
+
"react-web-api/no-leaked-event-listener": WARN,
|
|
1391
|
+
"react-web-api/no-leaked-interval": WARN,
|
|
1392
|
+
"react-web-api/no-leaked-resize-observer": WARN,
|
|
1393
|
+
"react-web-api/no-leaked-timeout": WARN,
|
|
1217
1394
|
...overrides
|
|
1218
1395
|
}
|
|
1219
1396
|
},
|
|
1220
1397
|
...isTypeAware ? [{
|
|
1221
1398
|
files: filesTypeAware,
|
|
1222
1399
|
ignores: ignoresTypeAware,
|
|
1223
|
-
name: "
|
|
1400
|
+
name: "vinicunca/react/type-aware-rules",
|
|
1224
1401
|
rules: { ...typeAwareRules }
|
|
1225
1402
|
}] : []
|
|
1226
1403
|
];
|
|
@@ -1248,6 +1425,7 @@ async function regexp(options = {}) {
|
|
|
1248
1425
|
//#region src/configs/solid.ts
|
|
1249
1426
|
async function solid(options = {}) {
|
|
1250
1427
|
const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript: typescript$1 = true } = options;
|
|
1428
|
+
await ensurePackages(["eslint-plugin-solid"]);
|
|
1251
1429
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1252
1430
|
const isTypeAware = !!tsconfigPath;
|
|
1253
1431
|
const [pluginSolid, parserTs] = await Promise.all([interopDefault(import("eslint-plugin-solid")), interopDefault(import("@typescript-eslint/parser"))]);
|
|
@@ -1302,11 +1480,11 @@ async function sonar() {
|
|
|
1302
1480
|
plugins: { sonar: pluginSonar },
|
|
1303
1481
|
rules: {
|
|
1304
1482
|
...pluginSonar.configs.recommended.rules,
|
|
1305
|
-
"sonar/
|
|
1483
|
+
"sonar/cognitive-complexity": OFF,
|
|
1484
|
+
"sonar/no-unused-vars": OFF,
|
|
1306
1485
|
"sonar/pseudo-random": OFF,
|
|
1307
1486
|
"sonar/slow-regex": OFF,
|
|
1308
|
-
"sonar/
|
|
1309
|
-
"sonar/no-unused-vars": OFF
|
|
1487
|
+
"sonar/todo-tag": OFF
|
|
1310
1488
|
}
|
|
1311
1489
|
}];
|
|
1312
1490
|
}
|
|
@@ -1381,15 +1559,19 @@ async function sortPackageJson() {
|
|
|
1381
1559
|
},
|
|
1382
1560
|
{
|
|
1383
1561
|
order: { type: "asc" },
|
|
1384
|
-
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies
|
|
1562
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
order: { type: "asc" },
|
|
1566
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
1385
1567
|
},
|
|
1386
1568
|
{
|
|
1387
1569
|
order: { type: "asc" },
|
|
1388
|
-
pathPattern: "^
|
|
1570
|
+
pathPattern: "^workspaces\\.catalog$"
|
|
1389
1571
|
},
|
|
1390
1572
|
{
|
|
1391
1573
|
order: { type: "asc" },
|
|
1392
|
-
pathPattern: "^
|
|
1574
|
+
pathPattern: "^workspaces\\.catalogs\\.[^.]+$"
|
|
1393
1575
|
},
|
|
1394
1576
|
{
|
|
1395
1577
|
order: [
|
|
@@ -1426,7 +1608,7 @@ async function sortPackageJson() {
|
|
|
1426
1608
|
*/
|
|
1427
1609
|
function sortTsconfig() {
|
|
1428
1610
|
return [{
|
|
1429
|
-
files: ["**/
|
|
1611
|
+
files: ["**/[jt]sconfig.json", "**/[jt]sconfig.*.json"],
|
|
1430
1612
|
name: "vinicunca/sort/tsconfig",
|
|
1431
1613
|
rules: { "jsonc/sort-keys": [
|
|
1432
1614
|
ERROR,
|
|
@@ -1527,6 +1709,7 @@ function sortTsconfig() {
|
|
|
1527
1709
|
"allowSyntheticDefaultImports",
|
|
1528
1710
|
"esModuleInterop",
|
|
1529
1711
|
"forceConsistentCasingInFileNames",
|
|
1712
|
+
"isolatedDeclarations",
|
|
1530
1713
|
"isolatedModules",
|
|
1531
1714
|
"preserveSymlinks",
|
|
1532
1715
|
"verbatimModuleSyntax",
|
|
@@ -1545,6 +1728,7 @@ function sortTsconfig() {
|
|
|
1545
1728
|
async function svelte(options = {}) {
|
|
1546
1729
|
const { files = [GLOB_SVELTE], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
1547
1730
|
const { indent = 2, quotes = "single" } = e(stylistic$1) ? {} : stylistic$1;
|
|
1731
|
+
await ensurePackages(["eslint-plugin-svelte"]);
|
|
1548
1732
|
const [pluginSvelte, parserSvelte] = await Promise.all([interopDefault(import("eslint-plugin-svelte")), interopDefault(import("svelte-eslint-parser"))]);
|
|
1549
1733
|
return [{
|
|
1550
1734
|
name: "vinicunca/svelte/setup",
|
|
@@ -1635,16 +1819,20 @@ async function test(options = {}) {
|
|
|
1635
1819
|
files,
|
|
1636
1820
|
name: "vinicunca/test/rules",
|
|
1637
1821
|
rules: {
|
|
1638
|
-
"node/prefer-global/process": OFF,
|
|
1639
1822
|
"sonar/no-duplicate-string": OFF,
|
|
1640
1823
|
"test/consistent-test-it": [ERROR, {
|
|
1641
1824
|
fn: "it",
|
|
1642
1825
|
withinDescribe: "it"
|
|
1643
1826
|
}],
|
|
1644
1827
|
"test/no-identical-title": ERROR,
|
|
1828
|
+
"test/no-import-node-test": ERROR,
|
|
1645
1829
|
"test/no-only-tests": isInEditor ? WARN : ERROR,
|
|
1646
1830
|
"test/prefer-hooks-in-order": ERROR,
|
|
1647
1831
|
"test/prefer-lowercase-title": ERROR,
|
|
1832
|
+
"antfu/no-top-level-await": OFF,
|
|
1833
|
+
"no-unused-expressions": OFF,
|
|
1834
|
+
"node/prefer-global/process": OFF,
|
|
1835
|
+
"ts/explicit-function-return-type": OFF,
|
|
1648
1836
|
...overrides
|
|
1649
1837
|
}
|
|
1650
1838
|
}];
|
|
@@ -1694,7 +1882,7 @@ async function toml(options = {}) {
|
|
|
1694
1882
|
//#endregion
|
|
1695
1883
|
//#region src/configs/typescript.ts
|
|
1696
1884
|
async function typescript(options = {}) {
|
|
1697
|
-
const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options ?? {};
|
|
1885
|
+
const { componentExts = [], erasableOnly = false, overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options ?? {};
|
|
1698
1886
|
const files = options.files ?? [
|
|
1699
1887
|
GLOB_TS,
|
|
1700
1888
|
GLOB_TSX,
|
|
@@ -1801,12 +1989,18 @@ async function typescript(options = {}) {
|
|
|
1801
1989
|
"ts/no-empty-function": OFF,
|
|
1802
1990
|
"ts/no-empty-object-type": [ERROR, { allowInterfaces: "always" }],
|
|
1803
1991
|
"ts/no-explicit-any": OFF,
|
|
1992
|
+
"ts/no-extraneous-class": OFF,
|
|
1804
1993
|
"ts/no-import-type-side-effects": ERROR,
|
|
1805
1994
|
"ts/no-invalid-this": ERROR,
|
|
1806
1995
|
"ts/no-invalid-void-type": OFF,
|
|
1807
1996
|
"ts/no-non-null-assertion": OFF,
|
|
1808
|
-
"ts/no-redeclare": ERROR,
|
|
1997
|
+
"ts/no-redeclare": [ERROR, { builtinGlobals: false }],
|
|
1809
1998
|
"ts/no-require-imports": ERROR,
|
|
1999
|
+
"ts/no-unused-expressions": [ERROR, {
|
|
2000
|
+
allowShortCircuit: true,
|
|
2001
|
+
allowTaggedTemplates: true,
|
|
2002
|
+
allowTernary: true
|
|
2003
|
+
}],
|
|
1810
2004
|
"ts/no-unused-vars": [ERROR, {
|
|
1811
2005
|
argsIgnorePattern: "^_",
|
|
1812
2006
|
destructuredArrayIgnorePattern: "^_",
|
|
@@ -1837,6 +2031,16 @@ async function typescript(options = {}) {
|
|
|
1837
2031
|
...overridesTypeAware
|
|
1838
2032
|
}
|
|
1839
2033
|
}] : [],
|
|
2034
|
+
...erasableOnly ? [{
|
|
2035
|
+
name: "antfu/typescript/erasable-syntax-only",
|
|
2036
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-BmGFlZdP.mjs")) },
|
|
2037
|
+
rules: {
|
|
2038
|
+
"erasable-syntax-only/enums": "error",
|
|
2039
|
+
"erasable-syntax-only/import-aliases": "error",
|
|
2040
|
+
"erasable-syntax-only/namespaces": "error",
|
|
2041
|
+
"erasable-syntax-only/parameter-properties": "error"
|
|
2042
|
+
}
|
|
2043
|
+
}] : [],
|
|
1840
2044
|
{
|
|
1841
2045
|
files: ["**/*.d.?([cm])ts"],
|
|
1842
2046
|
name: "vinicunca/typescript/disables/dts",
|
|
@@ -1887,24 +2091,25 @@ async function unicorn(options = {}) {
|
|
|
1887
2091
|
//#endregion
|
|
1888
2092
|
//#region src/configs/unocss.ts
|
|
1889
2093
|
async function unocss(options = {}) {
|
|
1890
|
-
const { attributify = false, strict = false
|
|
2094
|
+
const { attributify = false, configPath, strict = false } = options;
|
|
2095
|
+
await ensurePackages(["@unocss/eslint-plugin"]);
|
|
1891
2096
|
const [pluginUnoCSS] = await Promise.all([interopDefault(import("@unocss/eslint-plugin"))]);
|
|
1892
2097
|
return [{
|
|
1893
2098
|
name: "vinicunca/unocss",
|
|
1894
2099
|
plugins: { unocss: pluginUnoCSS },
|
|
1895
|
-
settings: { unocss: { configPath } },
|
|
1896
2100
|
rules: {
|
|
1897
2101
|
"unocss/order": WARN,
|
|
1898
2102
|
...attributify ? { "unocss/order-attributify": WARN } : {},
|
|
1899
2103
|
...strict ? { "unocss/blocklist": ERROR } : {}
|
|
1900
|
-
}
|
|
2104
|
+
},
|
|
2105
|
+
settings: { unocss: { configPath } }
|
|
1901
2106
|
}];
|
|
1902
2107
|
}
|
|
1903
2108
|
|
|
1904
2109
|
//#endregion
|
|
1905
2110
|
//#region src/configs/vue.ts
|
|
1906
2111
|
async function vue(options = {}) {
|
|
1907
|
-
const { files = [GLOB_VUE], overrides = {}, stylistic: stylistic$1 = true
|
|
2112
|
+
const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
1908
2113
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
1909
2114
|
const { indent = 2 } = e(stylistic$1) ? {} : stylistic$1;
|
|
1910
2115
|
if (a11y) await ensurePackages(["eslint-plugin-vuejs-accessibility"]);
|
|
@@ -1915,11 +2120,6 @@ async function vue(options = {}) {
|
|
|
1915
2120
|
...a11y ? [interopDefault(import("eslint-plugin-vuejs-accessibility"))] : []
|
|
1916
2121
|
]);
|
|
1917
2122
|
return [{
|
|
1918
|
-
name: "vinicunca/vue/setup",
|
|
1919
|
-
plugins: {
|
|
1920
|
-
vue: pluginVue,
|
|
1921
|
-
...a11y ? { "vue-a11y": pluginVueA11y } : {}
|
|
1922
|
-
},
|
|
1923
2123
|
languageOptions: { globals: {
|
|
1924
2124
|
computed: "readonly",
|
|
1925
2125
|
defineEmits: "readonly",
|
|
@@ -1935,7 +2135,12 @@ async function vue(options = {}) {
|
|
|
1935
2135
|
toRefs: "readonly",
|
|
1936
2136
|
watch: "readonly",
|
|
1937
2137
|
watchEffect: "readonly"
|
|
1938
|
-
} }
|
|
2138
|
+
} },
|
|
2139
|
+
name: "vinicunca/vue/setup",
|
|
2140
|
+
plugins: {
|
|
2141
|
+
vue: pluginVue,
|
|
2142
|
+
...a11y ? { "vue-a11y": pluginVueA11y } : {}
|
|
2143
|
+
}
|
|
1939
2144
|
}, {
|
|
1940
2145
|
files,
|
|
1941
2146
|
languageOptions: {
|
|
@@ -1969,7 +2174,9 @@ async function vue(options = {}) {
|
|
|
1969
2174
|
...acc,
|
|
1970
2175
|
...c
|
|
1971
2176
|
}), {}),
|
|
2177
|
+
"antfu/no-top-level-await": OFF,
|
|
1972
2178
|
"node/prefer-global/process": OFF,
|
|
2179
|
+
"ts/explicit-function-return-type": OFF,
|
|
1973
2180
|
"vue/block-order": [ERROR, { order: [
|
|
1974
2181
|
"script",
|
|
1975
2182
|
"template",
|
|
@@ -1992,6 +2199,7 @@ async function vue(options = {}) {
|
|
|
1992
2199
|
"vue/dot-notation": [ERROR, { allowKeywords: true }],
|
|
1993
2200
|
"vue/eqeqeq": [ERROR, "smart"],
|
|
1994
2201
|
"vue/html-indent": [ERROR, indent],
|
|
2202
|
+
"vue/html-quotes": ["error", "double"],
|
|
1995
2203
|
"vue/max-attributes-per-line": [ERROR],
|
|
1996
2204
|
"vue/multi-word-component-names": OFF,
|
|
1997
2205
|
"vue/no-constant-condition": WARN,
|
|
@@ -2024,6 +2232,7 @@ async function vue(options = {}) {
|
|
|
2024
2232
|
"vue/prefer-import-from-vue": OFF,
|
|
2025
2233
|
"vue/prefer-separate-static-class": ERROR,
|
|
2026
2234
|
"vue/prefer-template": ERROR,
|
|
2235
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
2027
2236
|
"vue/require-default-prop": OFF,
|
|
2028
2237
|
"vue/require-prop-types": OFF,
|
|
2029
2238
|
"vue/space-infix-ops": ERROR,
|
|
@@ -2113,77 +2322,41 @@ async function yaml(options = {}) {
|
|
|
2113
2322
|
const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
2114
2323
|
const { indent = 2, quotes = "single" } = e(stylistic$1) ? {} : stylistic$1;
|
|
2115
2324
|
const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
|
|
2116
|
-
return [
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
{
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
"yaml/
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
} : {},
|
|
2150
|
-
...overrides
|
|
2151
|
-
}
|
|
2152
|
-
},
|
|
2153
|
-
{
|
|
2154
|
-
files: ["pnpm-workspace.yaml"],
|
|
2155
|
-
name: "vinicunca/yaml/pnpm-workspace",
|
|
2156
|
-
rules: { "yaml/sort-keys": [
|
|
2157
|
-
ERROR,
|
|
2158
|
-
{
|
|
2159
|
-
order: [
|
|
2160
|
-
"packages",
|
|
2161
|
-
"overrides",
|
|
2162
|
-
"patchedDependencies",
|
|
2163
|
-
"hoistPattern",
|
|
2164
|
-
"catalog",
|
|
2165
|
-
"catalogs",
|
|
2166
|
-
"allowedDeprecatedVersions",
|
|
2167
|
-
"allowNonAppliedPatches",
|
|
2168
|
-
"configDependencies",
|
|
2169
|
-
"ignoredBuiltDependencies",
|
|
2170
|
-
"ignoredOptionalDependencies",
|
|
2171
|
-
"neverBuiltDependencies",
|
|
2172
|
-
"onlyBuiltDependencies",
|
|
2173
|
-
"onlyBuiltDependenciesFile",
|
|
2174
|
-
"packageExtensions",
|
|
2175
|
-
"peerDependencyRules",
|
|
2176
|
-
"supportedArchitectures"
|
|
2177
|
-
],
|
|
2178
|
-
pathPattern: "^$"
|
|
2179
|
-
},
|
|
2180
|
-
{
|
|
2181
|
-
order: { type: "asc" },
|
|
2182
|
-
pathPattern: ".*"
|
|
2183
|
-
}
|
|
2184
|
-
] }
|
|
2325
|
+
return [{
|
|
2326
|
+
name: "vinicunca/yaml/setup",
|
|
2327
|
+
plugins: { yaml: pluginYaml }
|
|
2328
|
+
}, {
|
|
2329
|
+
files,
|
|
2330
|
+
languageOptions: { parser: parserYaml },
|
|
2331
|
+
name: "vinicunca/yaml/rules",
|
|
2332
|
+
rules: {
|
|
2333
|
+
"style/spaced-comment": OFF,
|
|
2334
|
+
"yaml/block-mapping": ERROR,
|
|
2335
|
+
"yaml/block-sequence": ERROR,
|
|
2336
|
+
"yaml/no-empty-key": ERROR,
|
|
2337
|
+
"yaml/no-empty-sequence-entry": ERROR,
|
|
2338
|
+
"yaml/no-irregular-whitespace": ERROR,
|
|
2339
|
+
"yaml/plain-scalar": ERROR,
|
|
2340
|
+
"yaml/vue-custom-block/no-parsing-error": ERROR,
|
|
2341
|
+
...stylistic$1 ? {
|
|
2342
|
+
"yaml/block-mapping-question-indicator-newline": ERROR,
|
|
2343
|
+
"yaml/block-sequence-hyphen-indicator-newline": ERROR,
|
|
2344
|
+
"yaml/flow-mapping-curly-newline": ERROR,
|
|
2345
|
+
"yaml/flow-mapping-curly-spacing": ERROR,
|
|
2346
|
+
"yaml/flow-sequence-bracket-newline": ERROR,
|
|
2347
|
+
"yaml/flow-sequence-bracket-spacing": ERROR,
|
|
2348
|
+
"yaml/indent": [ERROR, indent === "tab" ? 2 : indent],
|
|
2349
|
+
"yaml/key-spacing": ERROR,
|
|
2350
|
+
"yaml/no-tab-indent": ERROR,
|
|
2351
|
+
"yaml/quotes": [ERROR, {
|
|
2352
|
+
avoidEscape: true,
|
|
2353
|
+
prefer: quotes === "backtick" ? "single" : quotes
|
|
2354
|
+
}],
|
|
2355
|
+
"yaml/spaced-comment": ERROR
|
|
2356
|
+
} : {},
|
|
2357
|
+
...overrides
|
|
2185
2358
|
}
|
|
2186
|
-
];
|
|
2359
|
+
}];
|
|
2187
2360
|
}
|
|
2188
2361
|
|
|
2189
2362
|
//#endregion
|
|
@@ -2208,6 +2381,7 @@ const defaultPluginRenaming = {
|
|
|
2208
2381
|
"@eslint-react/dom": "react-dom",
|
|
2209
2382
|
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
2210
2383
|
"@eslint-react/naming-convention": "react-naming-convention",
|
|
2384
|
+
"@next/next": "next",
|
|
2211
2385
|
"@stylistic": "style",
|
|
2212
2386
|
"@typescript-eslint": "ts",
|
|
2213
2387
|
"import-lite": "import",
|
|
@@ -2227,17 +2401,14 @@ const defaultPluginRenaming = {
|
|
|
2227
2401
|
* The merged ESLint configurations.
|
|
2228
2402
|
*/
|
|
2229
2403
|
function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
2230
|
-
const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, imports: enableImports = true, jsx: enableJsx = true, react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false,
|
|
2404
|
+
const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsx: enableJsx = true, nextjs: enableNextjs = false, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2231
2405
|
let isInEditor = options.isInEditor;
|
|
2232
2406
|
if (isInEditor == null) {
|
|
2233
2407
|
isInEditor = isInEditorEnv();
|
|
2234
2408
|
if (isInEditor) console.log("[@vinicunca/eslint-config] Detected running in editor, some rules are disabled.");
|
|
2235
2409
|
}
|
|
2236
|
-
|
|
2237
|
-
if (
|
|
2238
|
-
else if (e$1(options.stylistic)) stylisticOptions = options.stylistic;
|
|
2239
|
-
else stylisticOptions = {};
|
|
2240
|
-
if (stylisticOptions && !("jsx" in stylisticOptions)) stylisticOptions.jsx = enableJsx;
|
|
2410
|
+
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2411
|
+
if (stylisticOptions && !("jsx" in stylisticOptions)) stylisticOptions.jsx = typeof enableJsx === "object" ? true : enableJsx;
|
|
2241
2412
|
const configs$1 = [];
|
|
2242
2413
|
if (enableGitignore) if (!e(enableGitignore)) configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2243
2414
|
name: "vinicunca/gitignore",
|
|
@@ -2249,7 +2420,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2249
2420
|
})]));
|
|
2250
2421
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2251
2422
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2252
|
-
configs$1.push(ignores(
|
|
2423
|
+
configs$1.push(ignores(userIgnores), javascript({
|
|
2253
2424
|
isInEditor,
|
|
2254
2425
|
overrides: getOverrides(options, "javascript")
|
|
2255
2426
|
}), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), command(), perfectionist(), sonar());
|
|
@@ -2259,7 +2430,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2259
2430
|
}));
|
|
2260
2431
|
if (enableUnicorn) configs$1.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2261
2432
|
if (enableVue) componentExts.push("vue");
|
|
2262
|
-
if (enableJsx) configs$1.push(jsx());
|
|
2433
|
+
if (enableJsx) configs$1.push(jsx(enableJsx === true ? {} : enableJsx));
|
|
2263
2434
|
if (enableTypeScript) configs$1.push(typescript({
|
|
2264
2435
|
...typescriptOptions,
|
|
2265
2436
|
componentExts,
|
|
@@ -2268,6 +2439,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2268
2439
|
}));
|
|
2269
2440
|
if (stylisticOptions) configs$1.push(stylistic({
|
|
2270
2441
|
...stylisticOptions,
|
|
2442
|
+
lessOpinionated: options.lessOpinionated,
|
|
2271
2443
|
overrides: getOverrides(options, "stylistic")
|
|
2272
2444
|
}));
|
|
2273
2445
|
if (enableRegexp) configs$1.push(regexp(e(enableRegexp) ? {} : enableRegexp));
|
|
@@ -2283,9 +2455,11 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2283
2455
|
}));
|
|
2284
2456
|
if (enableReact) configs$1.push(react({
|
|
2285
2457
|
...typescriptOptions,
|
|
2458
|
+
...resolveSubOptions(options, "react"),
|
|
2286
2459
|
overrides: getOverrides(options, "react"),
|
|
2287
2460
|
tsconfigPath
|
|
2288
2461
|
}));
|
|
2462
|
+
if (enableNextjs) configs$1.push(nextjs({ overrides: getOverrides(options, "nextjs") }));
|
|
2289
2463
|
if (enableSolid) configs$1.push(solid({
|
|
2290
2464
|
overrides: getOverrides(options, "solid"),
|
|
2291
2465
|
tsconfigPath,
|
|
@@ -2308,7 +2482,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2308
2482
|
overrides: getOverrides(options, "jsonc"),
|
|
2309
2483
|
stylistic: stylisticOptions
|
|
2310
2484
|
}), sortPackageJson(), sortTsconfig());
|
|
2311
|
-
if (enableCatalogs) configs$1.push(pnpm());
|
|
2485
|
+
if (enableCatalogs) configs$1.push(pnpm({ isInEditor }));
|
|
2312
2486
|
if (options.yaml ?? true) configs$1.push(yaml({
|
|
2313
2487
|
overrides: getOverrides(options, "yaml"),
|
|
2314
2488
|
stylistic: stylisticOptions
|
|
@@ -2335,6 +2509,11 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2335
2509
|
let composer = new FlatConfigComposer();
|
|
2336
2510
|
composer = composer.append(...configs$1, ...userConfigs);
|
|
2337
2511
|
if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
|
|
2512
|
+
if (isInEditor) composer = composer.disableRulesFix([
|
|
2513
|
+
"unused-imports/no-unused-imports",
|
|
2514
|
+
"test/no-only-tests",
|
|
2515
|
+
"prefer-const"
|
|
2516
|
+
], { builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then((r) => r.builtinRules) });
|
|
2338
2517
|
return composer;
|
|
2339
2518
|
}
|
|
2340
2519
|
function getOverrides(options, key) {
|
|
@@ -2346,4 +2525,4 @@ function resolveSubOptions(options, key) {
|
|
|
2346
2525
|
}
|
|
2347
2526
|
|
|
2348
2527
|
//#endregion
|
|
2349
|
-
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, STYLISTIC_CONFIG_DEFAULTS, astro, combineConfigs, command, comments, defaultPluginRenaming, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginImportLite, pluginNode, pluginPerfectionist, pluginSonar, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, solid, sonar, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
|
|
2528
|
+
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, STYLISTIC_CONFIG_DEFAULTS, astro, combineConfigs, command, comments, defaultPluginRenaming, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginImportLite, pluginNode, pluginPerfectionist, pluginSonar, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, solid, sonar, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
|