@lincy/eslint-config 6.0.1 → 6.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/index.cjs +223 -108
- package/dist/index.d.cts +46 -6
- package/dist/index.d.mts +47 -7
- package/dist/index.mjs +184 -97
- package/package.json +40 -37
- package/dist/chunk-DWy1uDak.cjs +0 -39
- package/dist/lib-BJFVxmuP.cjs +0 -11153
- package/dist/lib-D3OsxTXr.mjs +0 -11157
package/dist/index.cjs
CHANGED
|
@@ -1,31 +1,80 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
2
|
+
//#region rolldown:runtime
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
3
29
|
let eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
30
|
+
let node_process = require("node:process");
|
|
31
|
+
node_process = __toESM(node_process);
|
|
32
|
+
let node_url = require("node:url");
|
|
33
|
+
let node_fs = require("node:fs");
|
|
34
|
+
node_fs = __toESM(node_fs);
|
|
35
|
+
let node_path = require("node:path");
|
|
36
|
+
node_path = __toESM(node_path);
|
|
4
37
|
let local_pkg = require("local-pkg");
|
|
5
38
|
let __eslint_community_eslint_plugin_eslint_comments = require("@eslint-community/eslint-plugin-eslint-comments");
|
|
6
|
-
__eslint_community_eslint_plugin_eslint_comments =
|
|
39
|
+
__eslint_community_eslint_plugin_eslint_comments = __toESM(__eslint_community_eslint_plugin_eslint_comments);
|
|
7
40
|
let eslint_plugin_antfu = require("eslint-plugin-antfu");
|
|
8
|
-
eslint_plugin_antfu =
|
|
41
|
+
eslint_plugin_antfu = __toESM(eslint_plugin_antfu);
|
|
9
42
|
let eslint_plugin_import_lite = require("eslint-plugin-import-lite");
|
|
10
|
-
eslint_plugin_import_lite =
|
|
43
|
+
eslint_plugin_import_lite = __toESM(eslint_plugin_import_lite);
|
|
11
44
|
let eslint_plugin_n = require("eslint-plugin-n");
|
|
12
|
-
eslint_plugin_n =
|
|
45
|
+
eslint_plugin_n = __toESM(eslint_plugin_n);
|
|
13
46
|
let eslint_plugin_perfectionist = require("eslint-plugin-perfectionist");
|
|
14
|
-
eslint_plugin_perfectionist =
|
|
47
|
+
eslint_plugin_perfectionist = __toESM(eslint_plugin_perfectionist);
|
|
15
48
|
let eslint_plugin_unicorn = require("eslint-plugin-unicorn");
|
|
16
|
-
eslint_plugin_unicorn =
|
|
49
|
+
eslint_plugin_unicorn = __toESM(eslint_plugin_unicorn);
|
|
17
50
|
let eslint_plugin_unused_imports = require("eslint-plugin-unused-imports");
|
|
18
|
-
eslint_plugin_unused_imports =
|
|
19
|
-
let node_process = require("node:process");
|
|
20
|
-
node_process = require_chunk.__toESM(node_process);
|
|
21
|
-
let node_url = require("node:url");
|
|
51
|
+
eslint_plugin_unused_imports = __toESM(eslint_plugin_unused_imports);
|
|
22
52
|
let globals = require("globals");
|
|
23
|
-
globals =
|
|
53
|
+
globals = __toESM(globals);
|
|
24
54
|
let eslint_merge_processors = require("eslint-merge-processors");
|
|
25
55
|
let eslint_parser_plain = require("eslint-parser-plain");
|
|
26
|
-
eslint_parser_plain =
|
|
56
|
+
eslint_parser_plain = __toESM(eslint_parser_plain);
|
|
27
57
|
let eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
28
58
|
|
|
59
|
+
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
60
|
+
const toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, node_url.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
61
|
+
function findUpSync(name, { cwd = node_process.default.cwd(), type = "file", stopAt } = {}) {
|
|
62
|
+
let directory = node_path.default.resolve(toPath(cwd) ?? "");
|
|
63
|
+
const { root } = node_path.default.parse(directory);
|
|
64
|
+
stopAt = node_path.default.resolve(directory, toPath(stopAt) ?? root);
|
|
65
|
+
const isAbsoluteName = node_path.default.isAbsolute(name);
|
|
66
|
+
while (directory) {
|
|
67
|
+
const filePath = isAbsoluteName ? name : node_path.default.join(directory, name);
|
|
68
|
+
try {
|
|
69
|
+
const stats = node_fs.default.statSync(filePath, { throwIfNoEntry: false });
|
|
70
|
+
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
71
|
+
} catch {}
|
|
72
|
+
if (directory === stopAt || directory === root) break;
|
|
73
|
+
directory = node_path.default.dirname(directory);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
29
78
|
//#region src/configs/comments.ts
|
|
30
79
|
async function comments(options = {}) {
|
|
31
80
|
const { overrides = {} } = options;
|
|
@@ -979,32 +1028,115 @@ async function perfectionist(options = {}) {
|
|
|
979
1028
|
|
|
980
1029
|
//#endregion
|
|
981
1030
|
//#region src/configs/pnpm.ts
|
|
982
|
-
async function pnpm() {
|
|
1031
|
+
async function pnpm(options = {}) {
|
|
983
1032
|
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
984
1033
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
985
1034
|
interopDefault(import("yaml-eslint-parser")),
|
|
986
1035
|
interopDefault(import("jsonc-eslint-parser"))
|
|
987
1036
|
]);
|
|
988
|
-
return [
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1037
|
+
return [
|
|
1038
|
+
{
|
|
1039
|
+
files: ["package.json", "**/package.json"],
|
|
1040
|
+
languageOptions: { parser: jsoncParser },
|
|
1041
|
+
name: "eslint/pnpm/package-json",
|
|
1042
|
+
plugins: { pnpm: pluginPnpm },
|
|
1043
|
+
rules: {
|
|
1044
|
+
"pnpm/json-enforce-catalog": ["error", { autofix: !options.isInEditor }],
|
|
1045
|
+
"pnpm/json-prefer-workspace-settings": ["error", { autofix: !options.isInEditor }],
|
|
1046
|
+
"pnpm/json-valid-catalog": ["error", { autofix: !options.isInEditor }]
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
files: ["pnpm-workspace.yaml"],
|
|
1051
|
+
languageOptions: { parser: yamlParser },
|
|
1052
|
+
name: "eslint/pnpm/pnpm-workspace-yaml",
|
|
1053
|
+
plugins: { pnpm: pluginPnpm },
|
|
1054
|
+
rules: {
|
|
1055
|
+
"pnpm/yaml-enforce-settings": ["error", { settings: {
|
|
1056
|
+
catalogMode: "prefer",
|
|
1057
|
+
shellEmulator: true
|
|
1058
|
+
} }],
|
|
1059
|
+
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
1060
|
+
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
files: ["pnpm-workspace.yaml"],
|
|
1065
|
+
name: "eslint/yaml/pnpm-workspace",
|
|
1066
|
+
rules: { "yaml/sort-keys": [
|
|
1067
|
+
"error",
|
|
1068
|
+
{
|
|
1069
|
+
order: [
|
|
1070
|
+
...[
|
|
1071
|
+
"cacheDir",
|
|
1072
|
+
"catalogMode",
|
|
1073
|
+
"cleanupUnusedCatalogs",
|
|
1074
|
+
"dedupeDirectDeps",
|
|
1075
|
+
"deployAllFiles",
|
|
1076
|
+
"enablePrePostScripts",
|
|
1077
|
+
"engineStrict",
|
|
1078
|
+
"extendNodePath",
|
|
1079
|
+
"hoist",
|
|
1080
|
+
"hoistPattern",
|
|
1081
|
+
"hoistWorkspacePackages",
|
|
1082
|
+
"ignoreCompatibilityDb",
|
|
1083
|
+
"ignoreDepScripts",
|
|
1084
|
+
"ignoreScripts",
|
|
1085
|
+
"ignoreWorkspaceRootCheck",
|
|
1086
|
+
"managePackageManagerVersions",
|
|
1087
|
+
"minimumReleaseAge",
|
|
1088
|
+
"minimumReleaseAgeExclude",
|
|
1089
|
+
"modulesDir",
|
|
1090
|
+
"nodeLinker",
|
|
1091
|
+
"nodeVersion",
|
|
1092
|
+
"optimisticRepeatInstall",
|
|
1093
|
+
"packageManagerStrict",
|
|
1094
|
+
"packageManagerStrictVersion",
|
|
1095
|
+
"preferSymlinkedExecutables",
|
|
1096
|
+
"preferWorkspacePackages",
|
|
1097
|
+
"publicHoistPattern",
|
|
1098
|
+
"registrySupportsTimeField",
|
|
1099
|
+
"requiredScripts",
|
|
1100
|
+
"resolutionMode",
|
|
1101
|
+
"savePrefix",
|
|
1102
|
+
"scriptShell",
|
|
1103
|
+
"shamefullyHoist",
|
|
1104
|
+
"shellEmulator",
|
|
1105
|
+
"stateDir",
|
|
1106
|
+
"supportedArchitectures",
|
|
1107
|
+
"symlink",
|
|
1108
|
+
"tag",
|
|
1109
|
+
"trustPolicy",
|
|
1110
|
+
"trustPolicyExclude",
|
|
1111
|
+
"updateNotifier"
|
|
1112
|
+
],
|
|
1113
|
+
"packages",
|
|
1114
|
+
"overrides",
|
|
1115
|
+
"patchedDependencies",
|
|
1116
|
+
"catalog",
|
|
1117
|
+
"catalogs",
|
|
1118
|
+
...[
|
|
1119
|
+
"allowedDeprecatedVersions",
|
|
1120
|
+
"allowNonAppliedPatches",
|
|
1121
|
+
"configDependencies",
|
|
1122
|
+
"ignoredBuiltDependencies",
|
|
1123
|
+
"ignoredOptionalDependencies",
|
|
1124
|
+
"neverBuiltDependencies",
|
|
1125
|
+
"onlyBuiltDependencies",
|
|
1126
|
+
"onlyBuiltDependenciesFile",
|
|
1127
|
+
"packageExtensions",
|
|
1128
|
+
"peerDependencyRules"
|
|
1129
|
+
]
|
|
1130
|
+
],
|
|
1131
|
+
pathPattern: "^$"
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
order: { type: "asc" },
|
|
1135
|
+
pathPattern: ".*"
|
|
1136
|
+
}
|
|
1137
|
+
] }
|
|
1006
1138
|
}
|
|
1007
|
-
|
|
1139
|
+
];
|
|
1008
1140
|
}
|
|
1009
1141
|
|
|
1010
1142
|
//#endregion
|
|
@@ -1023,8 +1155,9 @@ const ReactRouterPackages = [
|
|
|
1023
1155
|
"@react-router/dev"
|
|
1024
1156
|
];
|
|
1025
1157
|
const NextJsPackages = ["next"];
|
|
1158
|
+
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
1026
1159
|
async function react(options = {}) {
|
|
1027
|
-
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, tsconfigPath } = options;
|
|
1160
|
+
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, reactCompiler = ReactCompilerPackages.some((i) => (0, local_pkg.isPackageExists)(i)), tsconfigPath } = options;
|
|
1028
1161
|
await ensurePackages([
|
|
1029
1162
|
"@eslint-react/eslint-plugin",
|
|
1030
1163
|
"eslint-plugin-react-hooks",
|
|
@@ -1078,6 +1211,8 @@ async function react(options = {}) {
|
|
|
1078
1211
|
"react-dom/no-unsafe-target-blank": "warn",
|
|
1079
1212
|
"react-dom/no-use-form-state": "error",
|
|
1080
1213
|
"react-dom/no-void-elements-with-children": "error",
|
|
1214
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1215
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1081
1216
|
"react/jsx-no-comment-textnodes": "warn",
|
|
1082
1217
|
"react/jsx-no-duplicate-props": "warn",
|
|
1083
1218
|
"react/jsx-uses-vars": "warn",
|
|
@@ -1118,7 +1253,23 @@ async function react(options = {}) {
|
|
|
1118
1253
|
"react/no-use-context": "warn",
|
|
1119
1254
|
"react/no-useless-forward-ref": "warn",
|
|
1120
1255
|
"react/prefer-use-state-lazy-initialization": "warn",
|
|
1121
|
-
...
|
|
1256
|
+
...reactCompiler ? {
|
|
1257
|
+
"react-hooks/component-hook-factories": "error",
|
|
1258
|
+
"react-hooks/config": "error",
|
|
1259
|
+
"react-hooks/error-boundaries": "error",
|
|
1260
|
+
"react-hooks/gating": "error",
|
|
1261
|
+
"react-hooks/globals": "error",
|
|
1262
|
+
"react-hooks/immutability": "error",
|
|
1263
|
+
"react-hooks/incompatible-library": "warn",
|
|
1264
|
+
"react-hooks/preserve-manual-memoization": "error",
|
|
1265
|
+
"react-hooks/purity": "error",
|
|
1266
|
+
"react-hooks/refs": "error",
|
|
1267
|
+
"react-hooks/set-state-in-effect": "error",
|
|
1268
|
+
"react-hooks/set-state-in-render": "error",
|
|
1269
|
+
"react-hooks/static-components": "error",
|
|
1270
|
+
"react-hooks/unsupported-syntax": "warn",
|
|
1271
|
+
"react-hooks/use-memo": "error"
|
|
1272
|
+
} : {},
|
|
1122
1273
|
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1123
1274
|
"react-refresh/only-export-components": ["warn", {
|
|
1124
1275
|
allowConstantExport: isAllowConstantExport,
|
|
@@ -1631,7 +1782,7 @@ async function typescript(options = {}) {
|
|
|
1631
1782
|
}] : [],
|
|
1632
1783
|
...erasableOnly ? [{
|
|
1633
1784
|
name: "eslint/typescript/erasable-syntax-only",
|
|
1634
|
-
plugins: { "erasable-syntax-only": await interopDefault(
|
|
1785
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("eslint-plugin-erasable-syntax-only")) },
|
|
1635
1786
|
rules: {
|
|
1636
1787
|
"erasable-syntax-only/enums": "error",
|
|
1637
1788
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -1907,77 +2058,41 @@ async function yaml(options = {}) {
|
|
|
1907
2058
|
const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
1908
2059
|
const { quotes = "single" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
|
|
1909
2060
|
const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
|
|
1910
|
-
return [
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
{
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
"yaml/
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
} : {},
|
|
1944
|
-
...overrides
|
|
1945
|
-
}
|
|
1946
|
-
},
|
|
1947
|
-
{
|
|
1948
|
-
files: ["pnpm-workspace.yaml"],
|
|
1949
|
-
name: "eslint/yaml/pnpm-workspace",
|
|
1950
|
-
rules: { "yaml/sort-keys": [
|
|
1951
|
-
"error",
|
|
1952
|
-
{
|
|
1953
|
-
order: [
|
|
1954
|
-
"packages",
|
|
1955
|
-
"overrides",
|
|
1956
|
-
"patchedDependencies",
|
|
1957
|
-
"hoistPattern",
|
|
1958
|
-
"catalog",
|
|
1959
|
-
"catalogs",
|
|
1960
|
-
"allowedDeprecatedVersions",
|
|
1961
|
-
"allowNonAppliedPatches",
|
|
1962
|
-
"configDependencies",
|
|
1963
|
-
"ignoredBuiltDependencies",
|
|
1964
|
-
"ignoredOptionalDependencies",
|
|
1965
|
-
"neverBuiltDependencies",
|
|
1966
|
-
"onlyBuiltDependencies",
|
|
1967
|
-
"onlyBuiltDependenciesFile",
|
|
1968
|
-
"packageExtensions",
|
|
1969
|
-
"peerDependencyRules",
|
|
1970
|
-
"supportedArchitectures"
|
|
1971
|
-
],
|
|
1972
|
-
pathPattern: "^$"
|
|
1973
|
-
},
|
|
1974
|
-
{
|
|
1975
|
-
order: { type: "asc" },
|
|
1976
|
-
pathPattern: ".*"
|
|
1977
|
-
}
|
|
1978
|
-
] }
|
|
2061
|
+
return [{
|
|
2062
|
+
name: "eslint/yaml/setup",
|
|
2063
|
+
plugins: { yaml: pluginYaml }
|
|
2064
|
+
}, {
|
|
2065
|
+
files,
|
|
2066
|
+
languageOptions: { parser: parserYaml },
|
|
2067
|
+
name: "eslint/yaml/rules",
|
|
2068
|
+
rules: {
|
|
2069
|
+
"style/spaced-comment": "off",
|
|
2070
|
+
"yaml/block-mapping": "error",
|
|
2071
|
+
"yaml/block-sequence": "error",
|
|
2072
|
+
"yaml/no-empty-key": "error",
|
|
2073
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
2074
|
+
"yaml/no-irregular-whitespace": "error",
|
|
2075
|
+
"yaml/plain-scalar": "error",
|
|
2076
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
2077
|
+
...stylistic$1 ? {
|
|
2078
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
2079
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
2080
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
2081
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
2082
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
2083
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
2084
|
+
"yaml/indent": ["error", 2],
|
|
2085
|
+
"yaml/key-spacing": "error",
|
|
2086
|
+
"yaml/no-tab-indent": "error",
|
|
2087
|
+
"yaml/quotes": ["error", {
|
|
2088
|
+
avoidEscape: true,
|
|
2089
|
+
prefer: quotes === "backtick" ? "single" : quotes
|
|
2090
|
+
}],
|
|
2091
|
+
"yaml/spaced-comment": "error"
|
|
2092
|
+
} : {},
|
|
2093
|
+
...overrides
|
|
1979
2094
|
}
|
|
1980
|
-
];
|
|
2095
|
+
}];
|
|
1981
2096
|
}
|
|
1982
2097
|
|
|
1983
2098
|
//#endregion
|
|
@@ -2021,7 +2136,7 @@ const defaultPluginRenaming = {
|
|
|
2021
2136
|
* 合并的 ESLint 配置
|
|
2022
2137
|
*/
|
|
2023
2138
|
function lincy(options = {}, ...userConfigs) {
|
|
2024
|
-
const { autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: ignoresList = [], imports: enableImports = true, jsx: enableJsx = true, nextjs: enableNextjs = false, overrides = {}, pnpm: enableCatalogs =
|
|
2139
|
+
const { autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: ignoresList = [], imports: enableImports = true, jsx: enableJsx = true, nextjs: enableNextjs = false, overrides = {}, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, typescript: enableTypeScript = (0, local_pkg.isPackageExists)("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => (0, local_pkg.isPackageExists)(i)) } = options;
|
|
2025
2140
|
let isInEditor = options.isInEditor;
|
|
2026
2141
|
if (isInEditor == null) {
|
|
2027
2142
|
isInEditor = isInEditorEnv();
|
|
@@ -2099,7 +2214,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2099
2214
|
overrides: getOverrides(options, "jsonc"),
|
|
2100
2215
|
stylistic: stylisticOptions
|
|
2101
2216
|
}), sortPackageJson(), sortTsconfig());
|
|
2102
|
-
if (enableCatalogs) configs$1.push(pnpm());
|
|
2217
|
+
if (enableCatalogs) configs$1.push(pnpm({ isInEditor }));
|
|
2103
2218
|
if (options.yaml ?? true) configs$1.push(yaml({
|
|
2104
2219
|
...resolveSubOptions(options, "yaml"),
|
|
2105
2220
|
overrides: getOverrides(options, "yaml"),
|
package/dist/index.d.cts
CHANGED
|
@@ -689,6 +689,11 @@ interface RuleOptions {
|
|
|
689
689
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-property-type.md#repos-sticky-header
|
|
690
690
|
*/
|
|
691
691
|
'jsdoc/require-property-type'?: Linter.RuleEntry<[]>;
|
|
692
|
+
/**
|
|
693
|
+
* Requires that Promise rejections are documented with `@rejects` tags.
|
|
694
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-rejects.md#repos-sticky-header
|
|
695
|
+
*/
|
|
696
|
+
'jsdoc/require-rejects'?: Linter.RuleEntry<JsdocRequireRejects>;
|
|
692
697
|
/**
|
|
693
698
|
* Requires that returns are documented with `@returns`.
|
|
694
699
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md#repos-sticky-header
|
|
@@ -4124,6 +4129,11 @@ interface RuleOptions {
|
|
|
4124
4129
|
* @deprecated
|
|
4125
4130
|
*/
|
|
4126
4131
|
'template-tag-spacing'?: Linter.RuleEntry<TemplateTagSpacing>;
|
|
4132
|
+
/**
|
|
4133
|
+
* enforce using `.each` or `.for` consistently
|
|
4134
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-each-for.md
|
|
4135
|
+
*/
|
|
4136
|
+
'test/consistent-each-for'?: Linter.RuleEntry<TestConsistentEachFor>;
|
|
4127
4137
|
/**
|
|
4128
4138
|
* require test file pattern
|
|
4129
4139
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
|
|
@@ -4346,7 +4356,7 @@ interface RuleOptions {
|
|
|
4346
4356
|
*/
|
|
4347
4357
|
'test/prefer-each'?: Linter.RuleEntry<[]>;
|
|
4348
4358
|
/**
|
|
4349
|
-
* enforce using the built-in
|
|
4359
|
+
* enforce using the built-in equality matchers
|
|
4350
4360
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
|
|
4351
4361
|
*/
|
|
4352
4362
|
'test/prefer-equality-matcher'?: Linter.RuleEntry<[]>;
|
|
@@ -4465,6 +4475,11 @@ interface RuleOptions {
|
|
|
4465
4475
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
4466
4476
|
*/
|
|
4467
4477
|
'test/require-hook'?: Linter.RuleEntry<TestRequireHook>;
|
|
4478
|
+
/**
|
|
4479
|
+
* require usage of import in vi.mock()
|
|
4480
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-import-vi-mock.md
|
|
4481
|
+
*/
|
|
4482
|
+
'test/require-import-vi-mock'?: Linter.RuleEntry<[]>;
|
|
4468
4483
|
/**
|
|
4469
4484
|
* require local Test Context for concurrent snapshot tests
|
|
4470
4485
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
|
|
@@ -6516,6 +6531,11 @@ interface RuleOptions {
|
|
|
6516
6531
|
* @see https://eslint.vuejs.org/rules/no-duplicate-attributes.html
|
|
6517
6532
|
*/
|
|
6518
6533
|
'vue/no-duplicate-attributes'?: Linter.RuleEntry<VueNoDuplicateAttributes>;
|
|
6534
|
+
/**
|
|
6535
|
+
* disallow duplication of class names in class attributes
|
|
6536
|
+
* @see https://eslint.vuejs.org/rules/no-duplicate-class-names.html
|
|
6537
|
+
*/
|
|
6538
|
+
'vue/no-duplicate-class-names'?: Linter.RuleEntry<[]>;
|
|
6519
6539
|
/**
|
|
6520
6540
|
* disallow the `<template>` `<script>` `<style>` block to be empty
|
|
6521
6541
|
* @see https://eslint.vuejs.org/rules/no-empty-component-block.html
|
|
@@ -7851,6 +7871,7 @@ type JsdocCheckExamples = [] | [{
|
|
|
7851
7871
|
}];
|
|
7852
7872
|
// ----- jsdoc/check-indentation -----
|
|
7853
7873
|
type JsdocCheckIndentation = [] | [{
|
|
7874
|
+
allowIndentedSections?: boolean;
|
|
7854
7875
|
excludeTags?: string[];
|
|
7855
7876
|
}];
|
|
7856
7877
|
// ----- jsdoc/check-line-alignment -----
|
|
@@ -8197,6 +8218,14 @@ type JsdocRequireParamType = [] | [{
|
|
|
8197
8218
|
defaultDestructuredRootType?: string;
|
|
8198
8219
|
setDefaultDestructuredRootType?: boolean;
|
|
8199
8220
|
}];
|
|
8221
|
+
// ----- jsdoc/require-rejects -----
|
|
8222
|
+
type JsdocRequireRejects = [] | [{
|
|
8223
|
+
contexts?: (string | {
|
|
8224
|
+
comment?: string;
|
|
8225
|
+
context?: string;
|
|
8226
|
+
})[];
|
|
8227
|
+
exemptedBy?: string[];
|
|
8228
|
+
}];
|
|
8200
8229
|
// ----- jsdoc/require-returns -----
|
|
8201
8230
|
type JsdocRequireReturns = [] | [{
|
|
8202
8231
|
checkConstructors?: boolean;
|
|
@@ -11907,6 +11936,7 @@ type ReactNoUnstableDefaultProps = [] | [{
|
|
|
11907
11936
|
}];
|
|
11908
11937
|
// ----- react/no-useless-fragment -----
|
|
11909
11938
|
type ReactNoUselessFragment = [] | [{
|
|
11939
|
+
allowEmptyFragment?: boolean;
|
|
11910
11940
|
allowExpressions?: boolean;
|
|
11911
11941
|
}];
|
|
11912
11942
|
// ----- regexp/hexadecimal-escape -----
|
|
@@ -13369,6 +13399,13 @@ type SwitchColonSpacing = [] | [{
|
|
|
13369
13399
|
type TemplateCurlySpacing = [] | [("always" | "never")];
|
|
13370
13400
|
// ----- template-tag-spacing -----
|
|
13371
13401
|
type TemplateTagSpacing = [] | [("always" | "never")];
|
|
13402
|
+
// ----- test/consistent-each-for -----
|
|
13403
|
+
type TestConsistentEachFor = [] | [{
|
|
13404
|
+
test?: ("each" | "for");
|
|
13405
|
+
it?: ("each" | "for");
|
|
13406
|
+
describe?: ("each" | "for");
|
|
13407
|
+
suite?: ("each" | "for");
|
|
13408
|
+
}];
|
|
13372
13409
|
// ----- test/consistent-test-filename -----
|
|
13373
13410
|
type TestConsistentTestFilename = [] | [{
|
|
13374
13411
|
pattern?: string;
|
|
@@ -16227,7 +16264,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
16227
16264
|
onlyEquality?: boolean;
|
|
16228
16265
|
}];
|
|
16229
16266
|
// Names of all the configs
|
|
16230
|
-
type ConfigNames = 'eslint/comments/rules' | 'eslint/formatter/setup' | 'eslint/formatter/html' | 'eslint/formatter/xml' | 'eslint/formatter/svg' | 'eslint/formatter/markdown' | 'eslint/formatter/graphql' | 'eslint/imports/rules' | 'eslint/javascript/setup' | 'eslint/javascript/rules' | 'eslint/jsdoc/rules' | 'eslint/jsonc/setup' | 'eslint/jsonc/rules' | 'eslint/markdown/setup' | 'eslint/markdown/processor' | 'eslint/markdown/parser' | 'eslint/markdown/disables' | 'eslint/node/rules' | 'eslint/perfectionist/setup' | 'eslint/react/setup' | 'eslint/react/rules' | 'eslint/regexp/rules' | 'eslint/sort/package-json' | 'eslint/stylistic/rules' | 'eslint/test/setup' | 'eslint/test/rules' | 'eslint/toml/setup' | 'eslint/toml/rules' | 'eslint/typescript/setup' | 'eslint/typescript/parser' | 'eslint/typescript/rules' | 'eslint/unicorn/rules' | 'eslint/unocss/rules' | 'eslint/vue/setup' | 'eslint/vue/rules' | 'eslint/yaml/setup' | 'eslint/yaml/rules'
|
|
16267
|
+
type ConfigNames = 'eslint/comments/rules' | 'eslint/formatter/setup' | 'eslint/formatter/html' | 'eslint/formatter/xml' | 'eslint/formatter/svg' | 'eslint/formatter/markdown' | 'eslint/formatter/graphql' | 'eslint/imports/rules' | 'eslint/javascript/setup' | 'eslint/javascript/rules' | 'eslint/jsdoc/rules' | 'eslint/jsonc/setup' | 'eslint/jsonc/rules' | 'eslint/markdown/setup' | 'eslint/markdown/processor' | 'eslint/markdown/parser' | 'eslint/markdown/disables' | 'eslint/node/rules' | 'eslint/perfectionist/setup' | 'eslint/react/setup' | 'eslint/react/rules' | 'eslint/regexp/rules' | 'eslint/sort/package-json' | 'eslint/stylistic/rules' | 'eslint/test/setup' | 'eslint/test/rules' | 'eslint/toml/setup' | 'eslint/toml/rules' | 'eslint/typescript/setup' | 'eslint/typescript/parser' | 'eslint/typescript/rules' | 'eslint/unicorn/rules' | 'eslint/unocss/rules' | 'eslint/vue/setup' | 'eslint/vue/rules' | 'eslint/yaml/setup' | 'eslint/yaml/rules';
|
|
16231
16268
|
//#endregion
|
|
16232
16269
|
//#region src/prettier.types.d.ts
|
|
16233
16270
|
/**
|
|
@@ -16385,6 +16422,9 @@ interface OptionsVue {
|
|
|
16385
16422
|
*/
|
|
16386
16423
|
sfcBlocks?: boolean | Options;
|
|
16387
16424
|
}
|
|
16425
|
+
interface OptionsReact extends OptionsFiles {
|
|
16426
|
+
reactCompiler?: boolean;
|
|
16427
|
+
}
|
|
16388
16428
|
type OptionsTypescript = (OptionsTypeScriptWithTypes & OptionsOverrides & OptionsTypeScriptErasableOnly) | (OptionsTypeScriptParserOptions & OptionsOverrides & OptionsTypeScriptErasableOnly);
|
|
16389
16429
|
interface OptionsFormatters {
|
|
16390
16430
|
/**
|
|
@@ -16649,7 +16689,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
16649
16689
|
*
|
|
16650
16690
|
* @default 根据依赖关系自动检测
|
|
16651
16691
|
*/
|
|
16652
|
-
react?: boolean |
|
|
16692
|
+
react?: boolean | OptionsReact;
|
|
16653
16693
|
/**
|
|
16654
16694
|
* 启用 nextjs 支持.
|
|
16655
16695
|
*
|
|
@@ -16816,10 +16856,10 @@ declare function node(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]
|
|
|
16816
16856
|
declare function perfectionist(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16817
16857
|
//#endregion
|
|
16818
16858
|
//#region src/configs/pnpm.d.ts
|
|
16819
|
-
declare function pnpm(): Promise<TypedFlatConfigItem[]>;
|
|
16859
|
+
declare function pnpm(options?: OptionsIsInEditor): Promise<TypedFlatConfigItem[]>;
|
|
16820
16860
|
//#endregion
|
|
16821
16861
|
//#region src/configs/react.d.ts
|
|
16822
|
-
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides &
|
|
16862
|
+
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsReact): Promise<TypedFlatConfigItem[]>;
|
|
16823
16863
|
//#endregion
|
|
16824
16864
|
//#region src/configs/regexp.d.ts
|
|
16825
16865
|
declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
@@ -16936,4 +16976,4 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
|
|
|
16936
16976
|
declare function isInEditorEnv(): boolean;
|
|
16937
16977
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
16938
16978
|
//#endregion
|
|
16939
|
-
export { Awaitable, type ConfigNames, GLOB_ALL_SRC, 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, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsProjectType, OptionsRegExp, OptionsStylistic, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, TypedFlatConfigItem, combine, comments, lincy as default, lincy, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
16979
|
+
export { Awaitable, type ConfigNames, GLOB_ALL_SRC, 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, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStylistic, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, TypedFlatConfigItem, combine, comments, lincy as default, lincy, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|