@kirklin/eslint-config 8.1.0 → 8.2.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/cli.mjs +17 -29
- package/dist/index.d.mts +629 -525
- package/dist/index.mjs +88 -164
- package/dist/{lib-4A9shWox.mjs → lib-EoktVv6C.mjs} +2731 -2507
- package/package.json +66 -56
package/dist/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import fs$1 from "node:fs";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { isPackageExists } from "local-pkg";
|
|
8
8
|
import createCommand from "eslint-plugin-command/config";
|
|
9
|
+
import pluginE18e from "@e18e/eslint-plugin";
|
|
9
10
|
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
10
11
|
import pluginImportLite from "eslint-plugin-import-lite";
|
|
11
12
|
import pluginKirkLin from "eslint-plugin-kirklin";
|
|
@@ -16,7 +17,6 @@ import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
|
16
17
|
import globals from "globals";
|
|
17
18
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
18
19
|
import { configs } from "eslint-plugin-regexp";
|
|
19
|
-
|
|
20
20
|
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
21
21
|
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
22
22
|
async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
@@ -49,7 +49,6 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
|
49
49
|
directory = path.dirname(directory);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
53
52
|
//#endregion
|
|
54
53
|
//#region src/globs.ts
|
|
55
54
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -131,7 +130,6 @@ const GLOB_EXCLUDE = [
|
|
|
131
130
|
"**/auto-import?(s).d.ts",
|
|
132
131
|
"**/components.d.ts"
|
|
133
132
|
];
|
|
134
|
-
|
|
135
133
|
//#endregion
|
|
136
134
|
//#region src/utils.ts
|
|
137
135
|
const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
@@ -229,12 +227,11 @@ async function ensurePackages(packages) {
|
|
|
229
227
|
function isInEditorEnv() {
|
|
230
228
|
if (process.env.CI) return false;
|
|
231
229
|
if (isInGitHooksOrLintStaged()) return false;
|
|
232
|
-
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
|
|
230
|
+
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM || process.env.ZED_ENVIRONMENT && !process.env.ZED_TERM);
|
|
233
231
|
}
|
|
234
232
|
function isInGitHooksOrLintStaged() {
|
|
235
233
|
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
236
234
|
}
|
|
237
|
-
|
|
238
235
|
//#endregion
|
|
239
236
|
//#region src/configs/angular.ts
|
|
240
237
|
async function angular(options = {}) {
|
|
@@ -300,7 +297,6 @@ async function angular(options = {}) {
|
|
|
300
297
|
}
|
|
301
298
|
];
|
|
302
299
|
}
|
|
303
|
-
|
|
304
300
|
//#endregion
|
|
305
301
|
//#region src/configs/astro.ts
|
|
306
302
|
async function astro(options = {}) {
|
|
@@ -348,7 +344,6 @@ async function astro(options = {}) {
|
|
|
348
344
|
}
|
|
349
345
|
}];
|
|
350
346
|
}
|
|
351
|
-
|
|
352
347
|
//#endregion
|
|
353
348
|
//#region src/configs/command.ts
|
|
354
349
|
async function command() {
|
|
@@ -357,7 +352,6 @@ async function command() {
|
|
|
357
352
|
name: "kirklin/command/rules"
|
|
358
353
|
}];
|
|
359
354
|
}
|
|
360
|
-
|
|
361
355
|
//#endregion
|
|
362
356
|
//#region src/configs/comments.ts
|
|
363
357
|
async function comments() {
|
|
@@ -372,7 +366,6 @@ async function comments() {
|
|
|
372
366
|
}
|
|
373
367
|
}];
|
|
374
368
|
}
|
|
375
|
-
|
|
376
369
|
//#endregion
|
|
377
370
|
//#region src/configs/disables.ts
|
|
378
371
|
async function disables() {
|
|
@@ -427,7 +420,6 @@ async function disables() {
|
|
|
427
420
|
}
|
|
428
421
|
];
|
|
429
422
|
}
|
|
430
|
-
|
|
431
423
|
//#endregion
|
|
432
424
|
//#region src/configs/stylistic.ts
|
|
433
425
|
const StylisticConfigDefaults = {
|
|
@@ -485,7 +477,6 @@ async function stylistic(options = {}) {
|
|
|
485
477
|
}
|
|
486
478
|
}];
|
|
487
479
|
}
|
|
488
|
-
|
|
489
480
|
//#endregion
|
|
490
481
|
//#region src/configs/formatters.ts
|
|
491
482
|
function mergePrettierOptions(options, overrides) {
|
|
@@ -535,11 +526,12 @@ async function formatters(options = {}, stylistic = {}) {
|
|
|
535
526
|
xmlSortAttributesByKey: false,
|
|
536
527
|
xmlWhitespaceSensitivity: "ignore"
|
|
537
528
|
};
|
|
538
|
-
const dprintOptions =
|
|
529
|
+
const dprintOptions = {
|
|
539
530
|
indentWidth: typeof indent === "number" ? indent : 2,
|
|
540
531
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
541
|
-
useTabs: indent === "tab"
|
|
542
|
-
|
|
532
|
+
useTabs: indent === "tab",
|
|
533
|
+
...options.dprintOptions || {}
|
|
534
|
+
};
|
|
543
535
|
const configs = [{
|
|
544
536
|
name: "kirklin/formatter/setup",
|
|
545
537
|
plugins: { format: await interopDefault(import("eslint-plugin-format")) }
|
|
@@ -649,7 +641,6 @@ async function formatters(options = {}, stylistic = {}) {
|
|
|
649
641
|
});
|
|
650
642
|
return configs;
|
|
651
643
|
}
|
|
652
|
-
|
|
653
644
|
//#endregion
|
|
654
645
|
//#region src/configs/ignores.ts
|
|
655
646
|
async function ignores(userIgnores = [], ignoreTypeScript = false) {
|
|
@@ -662,7 +653,6 @@ async function ignores(userIgnores = [], ignoreTypeScript = false) {
|
|
|
662
653
|
name: "kirklin/ignores"
|
|
663
654
|
}];
|
|
664
655
|
}
|
|
665
|
-
|
|
666
656
|
//#endregion
|
|
667
657
|
//#region src/configs/imports.ts
|
|
668
658
|
async function imports(options = {}) {
|
|
@@ -687,7 +677,6 @@ async function imports(options = {}) {
|
|
|
687
677
|
}
|
|
688
678
|
}];
|
|
689
679
|
}
|
|
690
|
-
|
|
691
680
|
//#endregion
|
|
692
681
|
//#region src/configs/javascript.ts
|
|
693
682
|
async function javascript(options = {}) {
|
|
@@ -912,15 +901,16 @@ async function javascript(options = {}) {
|
|
|
912
901
|
}
|
|
913
902
|
}];
|
|
914
903
|
}
|
|
915
|
-
|
|
916
904
|
//#endregion
|
|
917
905
|
//#region src/configs/jsdoc.ts
|
|
918
906
|
async function jsdoc(options = {}) {
|
|
919
907
|
const { stylistic = true } = options;
|
|
920
908
|
return [{
|
|
909
|
+
name: "kirklin/jsdoc/setup",
|
|
910
|
+
plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) }
|
|
911
|
+
}, {
|
|
921
912
|
files: [GLOB_SRC],
|
|
922
913
|
name: "kirklin/jsdoc/rules",
|
|
923
|
-
plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) },
|
|
924
914
|
rules: {
|
|
925
915
|
"jsdoc/check-access": "warn",
|
|
926
916
|
"jsdoc/check-param-names": "warn",
|
|
@@ -944,7 +934,6 @@ async function jsdoc(options = {}) {
|
|
|
944
934
|
}
|
|
945
935
|
}];
|
|
946
936
|
}
|
|
947
|
-
|
|
948
937
|
//#endregion
|
|
949
938
|
//#region src/configs/jsonc.ts
|
|
950
939
|
async function jsonc(options = {}) {
|
|
@@ -954,13 +943,12 @@ async function jsonc(options = {}) {
|
|
|
954
943
|
GLOB_JSONC
|
|
955
944
|
], overrides = {}, stylistic = true } = options;
|
|
956
945
|
const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
957
|
-
const [pluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
|
|
958
946
|
return [{
|
|
959
947
|
name: "kirklin/jsonc/setup",
|
|
960
|
-
plugins: { jsonc:
|
|
948
|
+
plugins: { jsonc: await interopDefault(import("eslint-plugin-jsonc")) }
|
|
961
949
|
}, {
|
|
962
950
|
files,
|
|
963
|
-
|
|
951
|
+
language: "jsonc/x",
|
|
964
952
|
name: "kirklin/jsonc/rules",
|
|
965
953
|
rules: {
|
|
966
954
|
"jsonc/no-bigint-literals": "error",
|
|
@@ -1011,7 +999,6 @@ async function jsonc(options = {}) {
|
|
|
1011
999
|
}
|
|
1012
1000
|
}];
|
|
1013
1001
|
}
|
|
1014
|
-
|
|
1015
1002
|
//#endregion
|
|
1016
1003
|
//#region src/configs/jsx.ts
|
|
1017
1004
|
async function jsx(options = {}) {
|
|
@@ -1050,11 +1037,10 @@ async function jsx(options = {}) {
|
|
|
1050
1037
|
}
|
|
1051
1038
|
}];
|
|
1052
1039
|
}
|
|
1053
|
-
|
|
1054
1040
|
//#endregion
|
|
1055
1041
|
//#region src/configs/markdown.ts
|
|
1056
1042
|
async function markdown(options = {}) {
|
|
1057
|
-
const { componentExts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
|
|
1043
|
+
const { componentExts = [], files = [GLOB_MARKDOWN], gfm = true, overrides = {}, overridesMarkdown = {} } = options;
|
|
1058
1044
|
const markdown = await interopDefault(import("@eslint/markdown"));
|
|
1059
1045
|
return [
|
|
1060
1046
|
{
|
|
@@ -1069,14 +1055,40 @@ async function markdown(options = {}) {
|
|
|
1069
1055
|
},
|
|
1070
1056
|
{
|
|
1071
1057
|
files,
|
|
1072
|
-
|
|
1058
|
+
language: gfm ? "markdown/gfm" : "markdown/commonmark",
|
|
1073
1059
|
name: "kirklin/markdown/parser"
|
|
1074
1060
|
},
|
|
1061
|
+
{
|
|
1062
|
+
files,
|
|
1063
|
+
name: "kirklin/markdown/rules",
|
|
1064
|
+
rules: {
|
|
1065
|
+
...markdown.configs.recommended.at(0)?.rules,
|
|
1066
|
+
"markdown/fenced-code-language": "off",
|
|
1067
|
+
"markdown/no-missing-label-refs": "off",
|
|
1068
|
+
...overridesMarkdown
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
files,
|
|
1073
|
+
name: "kirklin/markdown/disables/markdown",
|
|
1074
|
+
rules: {
|
|
1075
|
+
"command/command": "off",
|
|
1076
|
+
"no-irregular-whitespace": "off",
|
|
1077
|
+
"perfectionist/sort-exports": "off",
|
|
1078
|
+
"perfectionist/sort-imports": "off",
|
|
1079
|
+
"regexp/no-legacy-features": "off",
|
|
1080
|
+
"regexp/no-missing-g-flag": "off",
|
|
1081
|
+
"regexp/no-useless-dollar-replacements": "off",
|
|
1082
|
+
"regexp/no-useless-flag": "off",
|
|
1083
|
+
"style/indent": "off"
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1075
1086
|
{
|
|
1076
1087
|
files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
|
|
1077
1088
|
languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
|
|
1078
|
-
name: "kirklin/markdown/disables",
|
|
1089
|
+
name: "kirklin/markdown/disables/code",
|
|
1079
1090
|
rules: {
|
|
1091
|
+
"e18e/prefer-static-regex": "off",
|
|
1080
1092
|
"kirklin/no-top-level-await": "off",
|
|
1081
1093
|
"no-alert": "off",
|
|
1082
1094
|
"no-console": "off",
|
|
@@ -1107,7 +1119,6 @@ async function markdown(options = {}) {
|
|
|
1107
1119
|
}
|
|
1108
1120
|
];
|
|
1109
1121
|
}
|
|
1110
|
-
|
|
1111
1122
|
//#endregion
|
|
1112
1123
|
//#region src/configs/nextjs.ts
|
|
1113
1124
|
function normalizeRules(rules) {
|
|
@@ -1140,14 +1151,15 @@ async function nextjs(options = {}) {
|
|
|
1140
1151
|
settings: { react: { version: "detect" } }
|
|
1141
1152
|
}];
|
|
1142
1153
|
}
|
|
1143
|
-
|
|
1144
1154
|
//#endregion
|
|
1145
1155
|
//#region src/configs/node.ts
|
|
1146
1156
|
async function node() {
|
|
1147
1157
|
return [{
|
|
1158
|
+
name: "kirklin/node/setup",
|
|
1159
|
+
plugins: { node: pluginNode }
|
|
1160
|
+
}, {
|
|
1148
1161
|
files: [GLOB_SRC],
|
|
1149
1162
|
name: "kirklin/node/rules",
|
|
1150
|
-
plugins: { node: pluginNode },
|
|
1151
1163
|
rules: {
|
|
1152
1164
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
1153
1165
|
"node/no-deprecated-api": "error",
|
|
@@ -1160,7 +1172,6 @@ async function node() {
|
|
|
1160
1172
|
}
|
|
1161
1173
|
}];
|
|
1162
1174
|
}
|
|
1163
|
-
|
|
1164
1175
|
//#endregion
|
|
1165
1176
|
//#region src/configs/perfectionist.ts
|
|
1166
1177
|
/**
|
|
@@ -1214,7 +1225,6 @@ async function perfectionist() {
|
|
|
1214
1225
|
}
|
|
1215
1226
|
}];
|
|
1216
1227
|
}
|
|
1217
|
-
|
|
1218
1228
|
//#endregion
|
|
1219
1229
|
//#region src/configs/pnpm.ts
|
|
1220
1230
|
async function detectCatalogUsage() {
|
|
@@ -1224,17 +1234,16 @@ async function detectCatalogUsage() {
|
|
|
1224
1234
|
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
1225
1235
|
}
|
|
1226
1236
|
async function pnpm(options) {
|
|
1227
|
-
const [pluginPnpm, pluginYaml, yamlParser
|
|
1237
|
+
const [pluginPnpm, pluginYaml, yamlParser] = await Promise.all([
|
|
1228
1238
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
1229
1239
|
interopDefault(import("eslint-plugin-yml")),
|
|
1230
|
-
interopDefault(import("yaml-eslint-parser"))
|
|
1231
|
-
interopDefault(import("jsonc-eslint-parser"))
|
|
1240
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
1232
1241
|
]);
|
|
1233
1242
|
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml = true } = options;
|
|
1234
1243
|
const configs = [];
|
|
1235
1244
|
if (json) configs.push({
|
|
1236
1245
|
files: ["package.json", "**/package.json"],
|
|
1237
|
-
|
|
1246
|
+
language: "jsonc/x",
|
|
1238
1247
|
name: "kirklin/pnpm/package-json",
|
|
1239
1248
|
plugins: { pnpm: pluginPnpm },
|
|
1240
1249
|
rules: {
|
|
@@ -1342,7 +1351,6 @@ async function pnpm(options) {
|
|
|
1342
1351
|
}
|
|
1343
1352
|
return configs;
|
|
1344
1353
|
}
|
|
1345
|
-
|
|
1346
1354
|
//#endregion
|
|
1347
1355
|
//#region src/configs/react.ts
|
|
1348
1356
|
const ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
@@ -1359,24 +1367,12 @@ const ReactRouterPackages = [
|
|
|
1359
1367
|
"@react-router/dev"
|
|
1360
1368
|
];
|
|
1361
1369
|
const NextJsPackages = ["next"];
|
|
1362
|
-
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
1363
1370
|
async function react(options = {}) {
|
|
1364
|
-
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath
|
|
1365
|
-
await ensurePackages([
|
|
1366
|
-
"@eslint-react/eslint-plugin",
|
|
1367
|
-
"eslint-plugin-react-hooks",
|
|
1368
|
-
"eslint-plugin-react-refresh"
|
|
1369
|
-
]);
|
|
1371
|
+
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath } = options;
|
|
1372
|
+
await ensurePackages(["@eslint-react/eslint-plugin", "eslint-plugin-react-refresh"]);
|
|
1370
1373
|
const isTypeAware = !!tsconfigPath;
|
|
1371
|
-
const typeAwareRules = {
|
|
1372
|
-
|
|
1373
|
-
"react/no-implicit-key": "error"
|
|
1374
|
-
};
|
|
1375
|
-
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
1376
|
-
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1377
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1378
|
-
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1379
|
-
]);
|
|
1374
|
+
const typeAwareRules = { "react/no-leaked-conditional-rendering": "error" };
|
|
1375
|
+
const [pluginReact, pluginReactRefresh] = await Promise.all([interopDefault(import("@eslint-react/eslint-plugin")), interopDefault(import("eslint-plugin-react-refresh"))]);
|
|
1380
1376
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
|
|
1381
1377
|
const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
|
|
1382
1378
|
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
|
|
@@ -1388,8 +1384,6 @@ async function react(options = {}) {
|
|
|
1388
1384
|
plugins: {
|
|
1389
1385
|
"react": plugins["@eslint-react"],
|
|
1390
1386
|
"react-dom": plugins["@eslint-react/dom"],
|
|
1391
|
-
"react-hooks": pluginReactHooks,
|
|
1392
|
-
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1393
1387
|
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1394
1388
|
"react-refresh": pluginReactRefresh,
|
|
1395
1389
|
"react-rsc": plugins["@eslint-react/rsc"],
|
|
@@ -1404,85 +1398,8 @@ async function react(options = {}) {
|
|
|
1404
1398
|
},
|
|
1405
1399
|
name: "kirklin/react/rules",
|
|
1406
1400
|
rules: {
|
|
1407
|
-
|
|
1408
|
-
"react/jsx-no-comment-textnodes": "warn",
|
|
1409
|
-
"react/jsx-no-duplicate-props": "warn",
|
|
1410
|
-
"react/jsx-uses-react": "warn",
|
|
1411
|
-
"react/jsx-uses-vars": "warn",
|
|
1412
|
-
"react/no-access-state-in-setstate": "error",
|
|
1413
|
-
"react/no-array-index-key": "warn",
|
|
1414
|
-
"react/no-children-count": "warn",
|
|
1415
|
-
"react/no-children-for-each": "warn",
|
|
1416
|
-
"react/no-children-map": "warn",
|
|
1417
|
-
"react/no-children-only": "warn",
|
|
1418
|
-
"react/no-children-to-array": "warn",
|
|
1419
|
-
"react/no-clone-element": "warn",
|
|
1420
|
-
"react/no-component-will-mount": "error",
|
|
1421
|
-
"react/no-component-will-receive-props": "error",
|
|
1422
|
-
"react/no-component-will-update": "error",
|
|
1423
|
-
"react/no-context-provider": "warn",
|
|
1424
|
-
"react/no-create-ref": "error",
|
|
1425
|
-
"react/no-default-props": "error",
|
|
1426
|
-
"react/no-direct-mutation-state": "error",
|
|
1427
|
-
"react/no-forward-ref": "warn",
|
|
1428
|
-
"react/no-missing-key": "error",
|
|
1429
|
-
"react/no-nested-component-definitions": "error",
|
|
1430
|
-
"react/no-nested-lazy-component-declarations": "error",
|
|
1431
|
-
"react/no-prop-types": "error",
|
|
1432
|
-
"react/no-redundant-should-component-update": "error",
|
|
1433
|
-
"react/no-set-state-in-component-did-mount": "warn",
|
|
1434
|
-
"react/no-set-state-in-component-did-update": "warn",
|
|
1435
|
-
"react/no-set-state-in-component-will-update": "warn",
|
|
1436
|
-
"react/no-string-refs": "error",
|
|
1437
|
-
"react/no-unnecessary-use-prefix": "warn",
|
|
1438
|
-
"react/no-unsafe-component-will-mount": "warn",
|
|
1439
|
-
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1440
|
-
"react/no-unsafe-component-will-update": "warn",
|
|
1441
|
-
"react/no-unused-class-component-members": "warn",
|
|
1442
|
-
"react/no-use-context": "warn",
|
|
1443
|
-
"react/no-useless-forward-ref": "warn",
|
|
1444
|
-
"react/prefer-use-state-lazy-initialization": "warn",
|
|
1401
|
+
...pluginReact.configs.recommended.rules,
|
|
1445
1402
|
"react/prefer-namespace-import": "error",
|
|
1446
|
-
"react-rsc/function-definition": "error",
|
|
1447
|
-
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
1448
|
-
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
1449
|
-
"react-dom/no-find-dom-node": "error",
|
|
1450
|
-
"react-dom/no-flush-sync": "error",
|
|
1451
|
-
"react-dom/no-hydrate": "error",
|
|
1452
|
-
"react-dom/no-namespace": "error",
|
|
1453
|
-
"react-dom/no-render": "error",
|
|
1454
|
-
"react-dom/no-render-return-value": "error",
|
|
1455
|
-
"react-dom/no-script-url": "warn",
|
|
1456
|
-
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1457
|
-
"react-dom/no-use-form-state": "error",
|
|
1458
|
-
"react-dom/no-void-elements-with-children": "error",
|
|
1459
|
-
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1460
|
-
"react-naming-convention/context-name": "warn",
|
|
1461
|
-
"react-naming-convention/ref-name": "warn",
|
|
1462
|
-
"react-naming-convention/use-state": "warn",
|
|
1463
|
-
"react-web-api/no-leaked-event-listener": "warn",
|
|
1464
|
-
"react-web-api/no-leaked-interval": "warn",
|
|
1465
|
-
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1466
|
-
"react-web-api/no-leaked-timeout": "warn",
|
|
1467
|
-
"react-hooks/rules-of-hooks": "error",
|
|
1468
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
1469
|
-
...reactCompiler ? {
|
|
1470
|
-
"react-hooks/config": "error",
|
|
1471
|
-
"react-hooks/error-boundaries": "error",
|
|
1472
|
-
"react-hooks/component-hook-factories": "error",
|
|
1473
|
-
"react-hooks/gating": "error",
|
|
1474
|
-
"react-hooks/globals": "error",
|
|
1475
|
-
"react-hooks/immutability": "error",
|
|
1476
|
-
"react-hooks/preserve-manual-memoization": "error",
|
|
1477
|
-
"react-hooks/purity": "error",
|
|
1478
|
-
"react-hooks/refs": "error",
|
|
1479
|
-
"react-hooks/set-state-in-effect": "error",
|
|
1480
|
-
"react-hooks/set-state-in-render": "error",
|
|
1481
|
-
"react-hooks/static-components": "error",
|
|
1482
|
-
"react-hooks/unsupported-syntax": "warn",
|
|
1483
|
-
"react-hooks/use-memo": "error",
|
|
1484
|
-
"react-hooks/incompatible-library": "warn"
|
|
1485
|
-
} : {},
|
|
1486
1403
|
"react-refresh/only-export-components": ["error", {
|
|
1487
1404
|
allowConstantExport: isAllowConstantExport,
|
|
1488
1405
|
allowExportNames: [...isUsingNext ? [
|
|
@@ -1520,11 +1437,7 @@ async function react(options = {}) {
|
|
|
1520
1437
|
name: "kirklin/react/typescript",
|
|
1521
1438
|
rules: {
|
|
1522
1439
|
"react-dom/no-string-style-prop": "off",
|
|
1523
|
-
"react-dom/no-unknown-property": "off"
|
|
1524
|
-
"react/jsx-no-duplicate-props": "off",
|
|
1525
|
-
"react/jsx-no-undef": "off",
|
|
1526
|
-
"react/jsx-uses-react": "off",
|
|
1527
|
-
"react/jsx-uses-vars": "off"
|
|
1440
|
+
"react-dom/no-unknown-property": "off"
|
|
1528
1441
|
}
|
|
1529
1442
|
},
|
|
1530
1443
|
...isTypeAware ? [{
|
|
@@ -1535,7 +1448,6 @@ async function react(options = {}) {
|
|
|
1535
1448
|
}] : []
|
|
1536
1449
|
];
|
|
1537
1450
|
}
|
|
1538
|
-
|
|
1539
1451
|
//#endregion
|
|
1540
1452
|
//#region src/configs/regexp.ts
|
|
1541
1453
|
async function regexp(options = {}) {
|
|
@@ -1553,7 +1465,6 @@ async function regexp(options = {}) {
|
|
|
1553
1465
|
}
|
|
1554
1466
|
}];
|
|
1555
1467
|
}
|
|
1556
|
-
|
|
1557
1468
|
//#endregion
|
|
1558
1469
|
//#region src/configs/solid.ts
|
|
1559
1470
|
async function solid(options = {}) {
|
|
@@ -1604,7 +1515,6 @@ async function solid(options = {}) {
|
|
|
1604
1515
|
}
|
|
1605
1516
|
}];
|
|
1606
1517
|
}
|
|
1607
|
-
|
|
1608
1518
|
//#endregion
|
|
1609
1519
|
//#region src/configs/sort.ts
|
|
1610
1520
|
/**
|
|
@@ -1838,7 +1748,6 @@ function sortTsconfig() {
|
|
|
1838
1748
|
] }
|
|
1839
1749
|
}];
|
|
1840
1750
|
}
|
|
1841
|
-
|
|
1842
1751
|
//#endregion
|
|
1843
1752
|
//#region src/configs/svelte.ts
|
|
1844
1753
|
async function svelte(options = {}) {
|
|
@@ -1913,7 +1822,6 @@ async function svelte(options = {}) {
|
|
|
1913
1822
|
}
|
|
1914
1823
|
}];
|
|
1915
1824
|
}
|
|
1916
|
-
|
|
1917
1825
|
//#endregion
|
|
1918
1826
|
//#region src/configs/test.ts
|
|
1919
1827
|
let _pluginTest;
|
|
@@ -1943,6 +1851,7 @@ async function test(options = {}) {
|
|
|
1943
1851
|
"test/no-only-tests": isInEditor ? "warn" : "error",
|
|
1944
1852
|
"test/prefer-hooks-in-order": "error",
|
|
1945
1853
|
"test/prefer-lowercase-title": "error",
|
|
1854
|
+
"e18e/prefer-static-regex": "off",
|
|
1946
1855
|
"kirklin/no-top-level-await": "off",
|
|
1947
1856
|
"no-unused-expressions": "off",
|
|
1948
1857
|
"node/prefer-global/process": "off",
|
|
@@ -1951,7 +1860,6 @@ async function test(options = {}) {
|
|
|
1951
1860
|
}
|
|
1952
1861
|
}];
|
|
1953
1862
|
}
|
|
1954
|
-
|
|
1955
1863
|
//#endregion
|
|
1956
1864
|
//#region src/configs/toml.ts
|
|
1957
1865
|
async function toml(options = {}) {
|
|
@@ -1992,18 +1900,17 @@ async function toml(options = {}) {
|
|
|
1992
1900
|
}
|
|
1993
1901
|
}];
|
|
1994
1902
|
}
|
|
1995
|
-
|
|
1996
1903
|
//#endregion
|
|
1997
1904
|
//#region src/configs/typescript.ts
|
|
1998
1905
|
async function typescript(options = {}) {
|
|
1999
1906
|
const { componentExts = [], erasableOnly = true, overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
|
|
2000
1907
|
const files = options.files ?? [
|
|
2001
|
-
|
|
2002
|
-
|
|
1908
|
+
"**/*.?([cm])ts",
|
|
1909
|
+
"**/*.?([cm])tsx",
|
|
2003
1910
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2004
1911
|
];
|
|
2005
|
-
const filesTypeAware = options.filesTypeAware ?? [
|
|
2006
|
-
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
1912
|
+
const filesTypeAware = options.filesTypeAware ?? ["**/*.?([cm])ts", "**/*.?([cm])tsx"];
|
|
1913
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`, "**/*.astro/*.ts"];
|
|
2007
1914
|
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
2008
1915
|
const isTypeAware = !!tsconfigPath;
|
|
2009
1916
|
const typeAwareRules = {
|
|
@@ -2126,7 +2033,7 @@ async function typescript(options = {}) {
|
|
|
2126
2033
|
}] : [],
|
|
2127
2034
|
...erasableOnly ? [{
|
|
2128
2035
|
name: "kirklin/typescript/erasable-syntax-only",
|
|
2129
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
2036
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-EoktVv6C.mjs")) },
|
|
2130
2037
|
rules: {
|
|
2131
2038
|
"erasable-syntax-only/enums": "error",
|
|
2132
2039
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -2136,7 +2043,6 @@ async function typescript(options = {}) {
|
|
|
2136
2043
|
}] : []
|
|
2137
2044
|
];
|
|
2138
2045
|
}
|
|
2139
|
-
|
|
2140
2046
|
//#endregion
|
|
2141
2047
|
//#region src/configs/unicorn.ts
|
|
2142
2048
|
async function unicorn(options = {}) {
|
|
@@ -2166,7 +2072,6 @@ async function unicorn(options = {}) {
|
|
|
2166
2072
|
}
|
|
2167
2073
|
}];
|
|
2168
2074
|
}
|
|
2169
|
-
|
|
2170
2075
|
//#endregion
|
|
2171
2076
|
//#region src/configs/unocss.ts
|
|
2172
2077
|
async function unocss(options = {}) {
|
|
@@ -2183,7 +2088,6 @@ async function unocss(options = {}) {
|
|
|
2183
2088
|
}
|
|
2184
2089
|
}];
|
|
2185
2090
|
}
|
|
2186
|
-
|
|
2187
2091
|
//#endregion
|
|
2188
2092
|
//#region src/configs/vue.ts
|
|
2189
2093
|
async function vue(options = {}) {
|
|
@@ -2397,7 +2301,6 @@ async function vue(options = {}) {
|
|
|
2397
2301
|
}
|
|
2398
2302
|
}];
|
|
2399
2303
|
}
|
|
2400
|
-
|
|
2401
2304
|
//#endregion
|
|
2402
2305
|
//#region src/configs/yaml.ts
|
|
2403
2306
|
async function yaml(options = {}) {
|
|
@@ -2440,7 +2343,26 @@ async function yaml(options = {}) {
|
|
|
2440
2343
|
}
|
|
2441
2344
|
}];
|
|
2442
2345
|
}
|
|
2443
|
-
|
|
2346
|
+
//#endregion
|
|
2347
|
+
//#region src/configs/e18e.ts
|
|
2348
|
+
async function e18e(options = {}) {
|
|
2349
|
+
const { isInEditor = false, modernization = true, type = "app", moduleReplacements = type === "lib" && isInEditor, overrides = {}, performanceImprovements = true } = options;
|
|
2350
|
+
const configs = pluginE18e.configs;
|
|
2351
|
+
return [{
|
|
2352
|
+
name: "kirklin/e18e/rules",
|
|
2353
|
+
plugins: { e18e: pluginE18e },
|
|
2354
|
+
rules: {
|
|
2355
|
+
...modernization ? { ...configs.modernization.rules } : {},
|
|
2356
|
+
...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
|
|
2357
|
+
...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
|
|
2358
|
+
"e18e/prefer-array-to-reversed": "off",
|
|
2359
|
+
"e18e/prefer-array-to-sorted": "off",
|
|
2360
|
+
"e18e/prefer-array-to-spliced": "off",
|
|
2361
|
+
"e18e/prefer-spread-syntax": "off",
|
|
2362
|
+
...overrides
|
|
2363
|
+
}
|
|
2364
|
+
}];
|
|
2365
|
+
}
|
|
2444
2366
|
//#endregion
|
|
2445
2367
|
//#region src/factory.ts
|
|
2446
2368
|
const flatConfigProps = [
|
|
@@ -2461,8 +2383,9 @@ const VuePackages = [
|
|
|
2461
2383
|
const defaultPluginRenaming = {
|
|
2462
2384
|
"@eslint-react": "react",
|
|
2463
2385
|
"@eslint-react/dom": "react-dom",
|
|
2464
|
-
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
2465
2386
|
"@eslint-react/naming-convention": "react-naming-convention",
|
|
2387
|
+
"@eslint-react/rsc": "react-rsc",
|
|
2388
|
+
"@eslint-react/web-api": "react-web-api",
|
|
2466
2389
|
"@next/next": "next",
|
|
2467
2390
|
"@stylistic": "style",
|
|
2468
2391
|
"@typescript-eslint": "ts",
|
|
@@ -2482,7 +2405,7 @@ const defaultPluginRenaming = {
|
|
|
2482
2405
|
* The merged ESLint configurations.
|
|
2483
2406
|
*/
|
|
2484
2407
|
function kirklin(options = {}, ...userConfigs) {
|
|
2485
|
-
const { angular: enableAngular = false, astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), 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;
|
|
2408
|
+
const { angular: enableAngular = false, astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, type: appType = "app", typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2486
2409
|
let isInEditor = options.isInEditor;
|
|
2487
2410
|
if (isInEditor == null) {
|
|
2488
2411
|
isInEditor = isInEditorEnv();
|
|
@@ -2511,6 +2434,10 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2511
2434
|
stylistic: stylisticOptions,
|
|
2512
2435
|
...resolveSubOptions(options, "imports")
|
|
2513
2436
|
}));
|
|
2437
|
+
if (enableE18e) configs.push(e18e({
|
|
2438
|
+
isInEditor,
|
|
2439
|
+
...enableE18e === true ? {} : enableE18e
|
|
2440
|
+
}));
|
|
2514
2441
|
if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2515
2442
|
if (enableVue) componentExts.push("vue");
|
|
2516
2443
|
if (enableJsx) configs.push(jsx(enableJsx === true ? {} : enableJsx));
|
|
@@ -2518,7 +2445,7 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2518
2445
|
...typescriptOptions,
|
|
2519
2446
|
componentExts,
|
|
2520
2447
|
overrides: getOverrides(options, "typescript"),
|
|
2521
|
-
type:
|
|
2448
|
+
type: appType
|
|
2522
2449
|
}));
|
|
2523
2450
|
if (stylisticOptions) configs.push(stylistic({
|
|
2524
2451
|
...stylisticOptions,
|
|
@@ -2615,7 +2542,6 @@ function getOverrides(options, key) {
|
|
|
2615
2542
|
..."overrides" in sub ? sub.overrides : {}
|
|
2616
2543
|
};
|
|
2617
2544
|
}
|
|
2618
|
-
|
|
2619
2545
|
//#endregion
|
|
2620
2546
|
//#region src/config-presets.ts
|
|
2621
2547
|
const CONFIG_PRESET_FULL_ON = {
|
|
@@ -2631,7 +2557,7 @@ const CONFIG_PRESET_FULL_ON = {
|
|
|
2631
2557
|
nextjs: true,
|
|
2632
2558
|
node: true,
|
|
2633
2559
|
pnpm: true,
|
|
2634
|
-
react:
|
|
2560
|
+
react: true,
|
|
2635
2561
|
regexp: true,
|
|
2636
2562
|
solid: true,
|
|
2637
2563
|
stylistic: { experimental: true },
|
|
@@ -2673,10 +2599,8 @@ const CONFIG_PRESET_FULL_OFF = {
|
|
|
2673
2599
|
vue: false,
|
|
2674
2600
|
yaml: false
|
|
2675
2601
|
};
|
|
2676
|
-
|
|
2677
2602
|
//#endregion
|
|
2678
2603
|
//#region src/index.ts
|
|
2679
2604
|
var src_default = kirklin;
|
|
2680
|
-
|
|
2681
2605
|
//#endregion
|
|
2682
|
-
export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, 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, StylisticConfigDefaults, angular, astro, combine, command, comments, src_default as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, kirklin, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
2606
|
+
export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, 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, StylisticConfigDefaults, angular, astro, combine, command, comments, src_default as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, kirklin, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|