@lincy/eslint-config 6.0.1 → 6.1.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 +98 -22
- package/dist/index.d.cts +39 -2
- package/dist/{index.d.mts → index.d.ts} +39 -2
- package/dist/{index.mjs → index.js} +90 -21
- package/dist/{lib-D3OsxTXr.mjs → lib-CEKTiw7V.js} +459 -440
- package/dist/{lib-BJFVxmuP.cjs → lib-DS4wQk2J.cjs} +440 -440
- package/package.json +28 -32
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk-DWy1uDak.cjs');
|
|
3
3
|
let eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
4
|
+
eslint_flat_config_utils = require_chunk.__toESM(eslint_flat_config_utils);
|
|
5
|
+
let node_process = require("node:process");
|
|
6
|
+
node_process = require_chunk.__toESM(node_process);
|
|
7
|
+
let node_url = require("node:url");
|
|
8
|
+
node_url = require_chunk.__toESM(node_url);
|
|
9
|
+
let node_fs = require("node:fs");
|
|
10
|
+
node_fs = require_chunk.__toESM(node_fs);
|
|
11
|
+
let node_path = require("node:path");
|
|
12
|
+
node_path = require_chunk.__toESM(node_path);
|
|
4
13
|
let local_pkg = require("local-pkg");
|
|
14
|
+
local_pkg = require_chunk.__toESM(local_pkg);
|
|
5
15
|
let __eslint_community_eslint_plugin_eslint_comments = require("@eslint-community/eslint-plugin-eslint-comments");
|
|
6
16
|
__eslint_community_eslint_plugin_eslint_comments = require_chunk.__toESM(__eslint_community_eslint_plugin_eslint_comments);
|
|
7
17
|
let eslint_plugin_antfu = require("eslint-plugin-antfu");
|
|
@@ -16,16 +26,34 @@ let eslint_plugin_unicorn = require("eslint-plugin-unicorn");
|
|
|
16
26
|
eslint_plugin_unicorn = require_chunk.__toESM(eslint_plugin_unicorn);
|
|
17
27
|
let eslint_plugin_unused_imports = require("eslint-plugin-unused-imports");
|
|
18
28
|
eslint_plugin_unused_imports = require_chunk.__toESM(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");
|
|
22
29
|
let globals = require("globals");
|
|
23
30
|
globals = require_chunk.__toESM(globals);
|
|
24
31
|
let eslint_merge_processors = require("eslint-merge-processors");
|
|
32
|
+
eslint_merge_processors = require_chunk.__toESM(eslint_merge_processors);
|
|
25
33
|
let eslint_parser_plain = require("eslint-parser-plain");
|
|
26
34
|
eslint_parser_plain = require_chunk.__toESM(eslint_parser_plain);
|
|
27
35
|
let eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
36
|
+
eslint_plugin_regexp = require_chunk.__toESM(eslint_plugin_regexp);
|
|
28
37
|
|
|
38
|
+
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
39
|
+
const toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, node_url.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
40
|
+
function findUpSync(name, { cwd = node_process.default.cwd(), type = "file", stopAt } = {}) {
|
|
41
|
+
let directory = node_path.default.resolve(toPath(cwd) ?? "");
|
|
42
|
+
const { root } = node_path.default.parse(directory);
|
|
43
|
+
stopAt = node_path.default.resolve(directory, toPath(stopAt) ?? root);
|
|
44
|
+
const isAbsoluteName = node_path.default.isAbsolute(name);
|
|
45
|
+
while (directory) {
|
|
46
|
+
const filePath = isAbsoluteName ? name : node_path.default.join(directory, name);
|
|
47
|
+
try {
|
|
48
|
+
const stats = node_fs.default.statSync(filePath, { throwIfNoEntry: false });
|
|
49
|
+
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
50
|
+
} catch {}
|
|
51
|
+
if (directory === stopAt || directory === root) break;
|
|
52
|
+
directory = node_path.default.dirname(directory);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
29
57
|
//#region src/configs/comments.ts
|
|
30
58
|
async function comments(options = {}) {
|
|
31
59
|
const { overrides = {} } = options;
|
|
@@ -979,7 +1007,7 @@ async function perfectionist(options = {}) {
|
|
|
979
1007
|
|
|
980
1008
|
//#endregion
|
|
981
1009
|
//#region src/configs/pnpm.ts
|
|
982
|
-
async function pnpm() {
|
|
1010
|
+
async function pnpm(options = {}) {
|
|
983
1011
|
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
984
1012
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
985
1013
|
interopDefault(import("yaml-eslint-parser")),
|
|
@@ -991,9 +1019,9 @@ async function pnpm() {
|
|
|
991
1019
|
name: "eslint/pnpm/package-json",
|
|
992
1020
|
plugins: { pnpm: pluginPnpm },
|
|
993
1021
|
rules: {
|
|
994
|
-
"pnpm/json-enforce-catalog": "error",
|
|
995
|
-
"pnpm/json-prefer-workspace-settings": "error",
|
|
996
|
-
"pnpm/json-valid-catalog": "error"
|
|
1022
|
+
"pnpm/json-enforce-catalog": ["error", { autofix: !options.isInEditor }],
|
|
1023
|
+
"pnpm/json-prefer-workspace-settings": ["error", { autofix: !options.isInEditor }],
|
|
1024
|
+
"pnpm/json-valid-catalog": ["error", { autofix: !options.isInEditor }]
|
|
997
1025
|
}
|
|
998
1026
|
}, {
|
|
999
1027
|
files: ["pnpm-workspace.yaml"],
|
|
@@ -1001,6 +1029,11 @@ async function pnpm() {
|
|
|
1001
1029
|
name: "eslint/pnpm/pnpm-workspace-yaml",
|
|
1002
1030
|
plugins: { pnpm: pluginPnpm },
|
|
1003
1031
|
rules: {
|
|
1032
|
+
"pnpm/yaml-enforce-settings": ["error", { settings: {
|
|
1033
|
+
catalogMode: "prefer",
|
|
1034
|
+
cleanupUnusedCatalogs: true,
|
|
1035
|
+
shellEmulator: true
|
|
1036
|
+
} }],
|
|
1004
1037
|
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
1005
1038
|
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1006
1039
|
}
|
|
@@ -1631,7 +1664,7 @@ async function typescript(options = {}) {
|
|
|
1631
1664
|
}] : [],
|
|
1632
1665
|
...erasableOnly ? [{
|
|
1633
1666
|
name: "eslint/typescript/erasable-syntax-only",
|
|
1634
|
-
plugins: { "erasable-syntax-only": await interopDefault(Promise.resolve().then(() => require("./lib-
|
|
1667
|
+
plugins: { "erasable-syntax-only": await interopDefault(Promise.resolve().then(() => require("./lib-DS4wQk2J.cjs"))) },
|
|
1635
1668
|
rules: {
|
|
1636
1669
|
"erasable-syntax-only/enums": "error",
|
|
1637
1670
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -1951,23 +1984,66 @@ async function yaml(options = {}) {
|
|
|
1951
1984
|
"error",
|
|
1952
1985
|
{
|
|
1953
1986
|
order: [
|
|
1987
|
+
...[
|
|
1988
|
+
"cacheDir",
|
|
1989
|
+
"catalogMode",
|
|
1990
|
+
"cleanupUnusedCatalogs",
|
|
1991
|
+
"dedupeDirectDeps",
|
|
1992
|
+
"deployAllFiles",
|
|
1993
|
+
"enablePrePostScripts",
|
|
1994
|
+
"engineStrict",
|
|
1995
|
+
"extendNodePath",
|
|
1996
|
+
"hoist",
|
|
1997
|
+
"hoistPattern",
|
|
1998
|
+
"hoistWorkspacePackages",
|
|
1999
|
+
"ignoreCompatibilityDb",
|
|
2000
|
+
"ignoreDepScripts",
|
|
2001
|
+
"ignoreScripts",
|
|
2002
|
+
"ignoreWorkspaceRootCheck",
|
|
2003
|
+
"managePackageManagerVersions",
|
|
2004
|
+
"minimumReleaseAge",
|
|
2005
|
+
"minimumReleaseAgeExclude",
|
|
2006
|
+
"modulesDir",
|
|
2007
|
+
"nodeLinker",
|
|
2008
|
+
"nodeVersion",
|
|
2009
|
+
"optimisticRepeatInstall",
|
|
2010
|
+
"packageManagerStrict",
|
|
2011
|
+
"packageManagerStrictVersion",
|
|
2012
|
+
"preferSymlinkedExecutables",
|
|
2013
|
+
"preferWorkspacePackages",
|
|
2014
|
+
"publicHoistPattern",
|
|
2015
|
+
"registrySupportsTimeField",
|
|
2016
|
+
"requiredScrpts",
|
|
2017
|
+
"resolutionMode",
|
|
2018
|
+
"savePrefix",
|
|
2019
|
+
"scriptShell",
|
|
2020
|
+
"shamefullyHoist",
|
|
2021
|
+
"shellEmulator",
|
|
2022
|
+
"stateDir",
|
|
2023
|
+
"supportedArchitectures",
|
|
2024
|
+
"symlink",
|
|
2025
|
+
"tag",
|
|
2026
|
+
"trustPolicy",
|
|
2027
|
+
"trustPolicyExclude",
|
|
2028
|
+
"updateNotifier"
|
|
2029
|
+
],
|
|
1954
2030
|
"packages",
|
|
1955
2031
|
"overrides",
|
|
1956
2032
|
"patchedDependencies",
|
|
1957
|
-
"hoistPattern",
|
|
1958
2033
|
"catalog",
|
|
1959
2034
|
"catalogs",
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
2035
|
+
...[
|
|
2036
|
+
"allowedDeprecatedVersions",
|
|
2037
|
+
"allowNonAppliedPatches",
|
|
2038
|
+
"configDependencies",
|
|
2039
|
+
"ignoredBuiltDependencies",
|
|
2040
|
+
"ignoredOptionalDependencies",
|
|
2041
|
+
"neverBuiltDependencies",
|
|
2042
|
+
"onlyBuiltDependencies",
|
|
2043
|
+
"onlyBuiltDependenciesFile",
|
|
2044
|
+
"packageExtensions",
|
|
2045
|
+
"peerDependencyRules"
|
|
2046
|
+
]
|
|
1971
2047
|
],
|
|
1972
2048
|
pathPattern: "^$"
|
|
1973
2049
|
},
|
|
@@ -2021,7 +2097,7 @@ const defaultPluginRenaming = {
|
|
|
2021
2097
|
* 合并的 ESLint 配置
|
|
2022
2098
|
*/
|
|
2023
2099
|
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 =
|
|
2100
|
+
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
2101
|
let isInEditor = options.isInEditor;
|
|
2026
2102
|
if (isInEditor == null) {
|
|
2027
2103
|
isInEditor = isInEditorEnv();
|
|
@@ -2099,7 +2175,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2099
2175
|
overrides: getOverrides(options, "jsonc"),
|
|
2100
2176
|
stylistic: stylisticOptions
|
|
2101
2177
|
}), sortPackageJson(), sortTsconfig());
|
|
2102
|
-
if (enableCatalogs) configs$1.push(pnpm());
|
|
2178
|
+
if (enableCatalogs) configs$1.push(pnpm({ isInEditor }));
|
|
2103
2179
|
if (options.yaml ?? true) configs$1.push(yaml({
|
|
2104
2180
|
...resolveSubOptions(options, "yaml"),
|
|
2105
2181
|
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;
|
|
@@ -16816,7 +16853,7 @@ declare function node(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]
|
|
|
16816
16853
|
declare function perfectionist(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16817
16854
|
//#endregion
|
|
16818
16855
|
//#region src/configs/pnpm.d.ts
|
|
16819
|
-
declare function pnpm(): Promise<TypedFlatConfigItem[]>;
|
|
16856
|
+
declare function pnpm(options?: OptionsIsInEditor): Promise<TypedFlatConfigItem[]>;
|
|
16820
16857
|
//#endregion
|
|
16821
16858
|
//#region src/configs/react.d.ts
|
|
16822
16859
|
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
@@ -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;
|
|
@@ -16816,7 +16853,7 @@ declare function node(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]
|
|
|
16816
16853
|
declare function perfectionist(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16817
16854
|
//#endregion
|
|
16818
16855
|
//#region src/configs/pnpm.d.ts
|
|
16819
|
-
declare function pnpm(): Promise<TypedFlatConfigItem[]>;
|
|
16856
|
+
declare function pnpm(options?: OptionsIsInEditor): Promise<TypedFlatConfigItem[]>;
|
|
16820
16857
|
//#endregion
|
|
16821
16858
|
//#region src/configs/react.d.ts
|
|
16822
16859
|
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
2
6
|
import { getPackageInfoSync, isPackageExists } from "local-pkg";
|
|
3
7
|
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
4
8
|
import pluginAntfu from "eslint-plugin-antfu";
|
|
@@ -7,13 +11,30 @@ import pluginNode from "eslint-plugin-n";
|
|
|
7
11
|
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
8
12
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
9
13
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
10
|
-
import process from "node:process";
|
|
11
|
-
import { fileURLToPath } from "node:url";
|
|
12
14
|
import globals from "globals";
|
|
13
15
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
14
16
|
import * as parserPlain$1 from "eslint-parser-plain";
|
|
15
17
|
import { configs } from "eslint-plugin-regexp";
|
|
16
18
|
|
|
19
|
+
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
20
|
+
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
21
|
+
function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
22
|
+
let directory = path.resolve(toPath(cwd) ?? "");
|
|
23
|
+
const { root } = path.parse(directory);
|
|
24
|
+
stopAt = path.resolve(directory, toPath(stopAt) ?? root);
|
|
25
|
+
const isAbsoluteName = path.isAbsolute(name);
|
|
26
|
+
while (directory) {
|
|
27
|
+
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
28
|
+
try {
|
|
29
|
+
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
30
|
+
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
31
|
+
} catch {}
|
|
32
|
+
if (directory === stopAt || directory === root) break;
|
|
33
|
+
directory = path.dirname(directory);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
17
38
|
//#region src/configs/comments.ts
|
|
18
39
|
async function comments(options = {}) {
|
|
19
40
|
const { overrides = {} } = options;
|
|
@@ -967,7 +988,7 @@ async function perfectionist(options = {}) {
|
|
|
967
988
|
|
|
968
989
|
//#endregion
|
|
969
990
|
//#region src/configs/pnpm.ts
|
|
970
|
-
async function pnpm() {
|
|
991
|
+
async function pnpm(options = {}) {
|
|
971
992
|
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
972
993
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
973
994
|
interopDefault(import("yaml-eslint-parser")),
|
|
@@ -979,9 +1000,9 @@ async function pnpm() {
|
|
|
979
1000
|
name: "eslint/pnpm/package-json",
|
|
980
1001
|
plugins: { pnpm: pluginPnpm },
|
|
981
1002
|
rules: {
|
|
982
|
-
"pnpm/json-enforce-catalog": "error",
|
|
983
|
-
"pnpm/json-prefer-workspace-settings": "error",
|
|
984
|
-
"pnpm/json-valid-catalog": "error"
|
|
1003
|
+
"pnpm/json-enforce-catalog": ["error", { autofix: !options.isInEditor }],
|
|
1004
|
+
"pnpm/json-prefer-workspace-settings": ["error", { autofix: !options.isInEditor }],
|
|
1005
|
+
"pnpm/json-valid-catalog": ["error", { autofix: !options.isInEditor }]
|
|
985
1006
|
}
|
|
986
1007
|
}, {
|
|
987
1008
|
files: ["pnpm-workspace.yaml"],
|
|
@@ -989,6 +1010,11 @@ async function pnpm() {
|
|
|
989
1010
|
name: "eslint/pnpm/pnpm-workspace-yaml",
|
|
990
1011
|
plugins: { pnpm: pluginPnpm },
|
|
991
1012
|
rules: {
|
|
1013
|
+
"pnpm/yaml-enforce-settings": ["error", { settings: {
|
|
1014
|
+
catalogMode: "prefer",
|
|
1015
|
+
cleanupUnusedCatalogs: true,
|
|
1016
|
+
shellEmulator: true
|
|
1017
|
+
} }],
|
|
992
1018
|
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
993
1019
|
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
994
1020
|
}
|
|
@@ -1619,7 +1645,7 @@ async function typescript(options = {}) {
|
|
|
1619
1645
|
}] : [],
|
|
1620
1646
|
...erasableOnly ? [{
|
|
1621
1647
|
name: "eslint/typescript/erasable-syntax-only",
|
|
1622
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
1648
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-CEKTiw7V.js")) },
|
|
1623
1649
|
rules: {
|
|
1624
1650
|
"erasable-syntax-only/enums": "error",
|
|
1625
1651
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -1939,23 +1965,66 @@ async function yaml(options = {}) {
|
|
|
1939
1965
|
"error",
|
|
1940
1966
|
{
|
|
1941
1967
|
order: [
|
|
1968
|
+
...[
|
|
1969
|
+
"cacheDir",
|
|
1970
|
+
"catalogMode",
|
|
1971
|
+
"cleanupUnusedCatalogs",
|
|
1972
|
+
"dedupeDirectDeps",
|
|
1973
|
+
"deployAllFiles",
|
|
1974
|
+
"enablePrePostScripts",
|
|
1975
|
+
"engineStrict",
|
|
1976
|
+
"extendNodePath",
|
|
1977
|
+
"hoist",
|
|
1978
|
+
"hoistPattern",
|
|
1979
|
+
"hoistWorkspacePackages",
|
|
1980
|
+
"ignoreCompatibilityDb",
|
|
1981
|
+
"ignoreDepScripts",
|
|
1982
|
+
"ignoreScripts",
|
|
1983
|
+
"ignoreWorkspaceRootCheck",
|
|
1984
|
+
"managePackageManagerVersions",
|
|
1985
|
+
"minimumReleaseAge",
|
|
1986
|
+
"minimumReleaseAgeExclude",
|
|
1987
|
+
"modulesDir",
|
|
1988
|
+
"nodeLinker",
|
|
1989
|
+
"nodeVersion",
|
|
1990
|
+
"optimisticRepeatInstall",
|
|
1991
|
+
"packageManagerStrict",
|
|
1992
|
+
"packageManagerStrictVersion",
|
|
1993
|
+
"preferSymlinkedExecutables",
|
|
1994
|
+
"preferWorkspacePackages",
|
|
1995
|
+
"publicHoistPattern",
|
|
1996
|
+
"registrySupportsTimeField",
|
|
1997
|
+
"requiredScrpts",
|
|
1998
|
+
"resolutionMode",
|
|
1999
|
+
"savePrefix",
|
|
2000
|
+
"scriptShell",
|
|
2001
|
+
"shamefullyHoist",
|
|
2002
|
+
"shellEmulator",
|
|
2003
|
+
"stateDir",
|
|
2004
|
+
"supportedArchitectures",
|
|
2005
|
+
"symlink",
|
|
2006
|
+
"tag",
|
|
2007
|
+
"trustPolicy",
|
|
2008
|
+
"trustPolicyExclude",
|
|
2009
|
+
"updateNotifier"
|
|
2010
|
+
],
|
|
1942
2011
|
"packages",
|
|
1943
2012
|
"overrides",
|
|
1944
2013
|
"patchedDependencies",
|
|
1945
|
-
"hoistPattern",
|
|
1946
2014
|
"catalog",
|
|
1947
2015
|
"catalogs",
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2016
|
+
...[
|
|
2017
|
+
"allowedDeprecatedVersions",
|
|
2018
|
+
"allowNonAppliedPatches",
|
|
2019
|
+
"configDependencies",
|
|
2020
|
+
"ignoredBuiltDependencies",
|
|
2021
|
+
"ignoredOptionalDependencies",
|
|
2022
|
+
"neverBuiltDependencies",
|
|
2023
|
+
"onlyBuiltDependencies",
|
|
2024
|
+
"onlyBuiltDependenciesFile",
|
|
2025
|
+
"packageExtensions",
|
|
2026
|
+
"peerDependencyRules"
|
|
2027
|
+
]
|
|
1959
2028
|
],
|
|
1960
2029
|
pathPattern: "^$"
|
|
1961
2030
|
},
|
|
@@ -2009,7 +2078,7 @@ const defaultPluginRenaming = {
|
|
|
2009
2078
|
* 合并的 ESLint 配置
|
|
2010
2079
|
*/
|
|
2011
2080
|
function lincy(options = {}, ...userConfigs) {
|
|
2012
|
-
const { autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: ignoresList = [], imports: enableImports = true, jsx: enableJsx = true, nextjs: enableNextjs = false, overrides = {}, pnpm: enableCatalogs =
|
|
2081
|
+
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 = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2013
2082
|
let isInEditor = options.isInEditor;
|
|
2014
2083
|
if (isInEditor == null) {
|
|
2015
2084
|
isInEditor = isInEditorEnv();
|
|
@@ -2087,7 +2156,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2087
2156
|
overrides: getOverrides(options, "jsonc"),
|
|
2088
2157
|
stylistic: stylisticOptions
|
|
2089
2158
|
}), sortPackageJson(), sortTsconfig());
|
|
2090
|
-
if (enableCatalogs) configs$1.push(pnpm());
|
|
2159
|
+
if (enableCatalogs) configs$1.push(pnpm({ isInEditor }));
|
|
2091
2160
|
if (options.yaml ?? true) configs$1.push(yaml({
|
|
2092
2161
|
...resolveSubOptions(options, "yaml"),
|
|
2093
2162
|
overrides: getOverrides(options, "yaml"),
|