@lincy/eslint-config 6.1.0 → 6.3.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 +228 -166
- package/dist/index.d.cts +29 -5
- package/dist/{index.d.ts → index.d.mts} +30 -6
- package/dist/{index.js → index.mjs} +190 -150
- package/package.json +91 -81
- package/dist/chunk-DWy1uDak.cjs +0 -39
- package/dist/lib-CEKTiw7V.js +0 -11176
- package/dist/lib-DS4wQk2J.cjs +0 -11153
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
|
-
import { Linter } from "eslint";
|
|
3
2
|
import { StylisticCustomizeOptions } from "@stylistic/eslint-plugin";
|
|
4
3
|
import { ParserOptions } from "@typescript-eslint/parser";
|
|
5
4
|
import { FlatGitignoreOptions } from "eslint-config-flat-gitignore";
|
|
6
5
|
import { Options } from "eslint-processor-vue-blocks";
|
|
6
|
+
import { Linter } from "eslint";
|
|
7
7
|
|
|
8
8
|
//#region src/typegen.d.ts
|
|
9
9
|
interface RuleOptions {
|
|
@@ -387,6 +387,11 @@ interface RuleOptions {
|
|
|
387
387
|
* @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/consistent-type-specifier-style/README.md
|
|
388
388
|
*/
|
|
389
389
|
'import/consistent-type-specifier-style'?: Linter.RuleEntry<ImportConsistentTypeSpecifierStyle>;
|
|
390
|
+
/**
|
|
391
|
+
* Ensure all exports appear after other statements.
|
|
392
|
+
* @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/exports-last/README.md
|
|
393
|
+
*/
|
|
394
|
+
'import/exports-last'?: Linter.RuleEntry<[]>;
|
|
390
395
|
/**
|
|
391
396
|
* Ensure all imports appear before other statements.
|
|
392
397
|
* @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/first/README.md
|
|
@@ -4280,6 +4285,11 @@ interface RuleOptions {
|
|
|
4280
4285
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
|
|
4281
4286
|
*/
|
|
4282
4287
|
'test/no-test-return-statement'?: Linter.RuleEntry<[]>;
|
|
4288
|
+
/**
|
|
4289
|
+
* Disallow unnecessary async function wrapper for expected promises
|
|
4290
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-unneeded-async-expect-function.md
|
|
4291
|
+
*/
|
|
4292
|
+
'test/no-unneeded-async-expect-function'?: Linter.RuleEntry<[]>;
|
|
4283
4293
|
/**
|
|
4284
4294
|
* Enforce padding around `afterAll` blocks
|
|
4285
4295
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-all-blocks.md
|
|
@@ -5099,6 +5109,11 @@ interface RuleOptions {
|
|
|
5099
5109
|
* @see https://typescript-eslint.io/rules/no-useless-constructor
|
|
5100
5110
|
*/
|
|
5101
5111
|
'ts/no-useless-constructor'?: Linter.RuleEntry<[]>;
|
|
5112
|
+
/**
|
|
5113
|
+
* Disallow default values that will never be used
|
|
5114
|
+
* @see https://typescript-eslint.io/rules/no-useless-default-assignment
|
|
5115
|
+
*/
|
|
5116
|
+
'ts/no-useless-default-assignment'?: Linter.RuleEntry<[]>;
|
|
5102
5117
|
/**
|
|
5103
5118
|
* Disallow empty exports that don't change anything in a module file
|
|
5104
5119
|
* @see https://typescript-eslint.io/rules/no-useless-empty-export
|
|
@@ -16264,7 +16279,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
16264
16279
|
onlyEquality?: boolean;
|
|
16265
16280
|
}];
|
|
16266
16281
|
// Names of all the configs
|
|
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'
|
|
16282
|
+
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';
|
|
16268
16283
|
//#endregion
|
|
16269
16284
|
//#region src/prettier.types.d.ts
|
|
16270
16285
|
/**
|
|
@@ -16422,6 +16437,9 @@ interface OptionsVue {
|
|
|
16422
16437
|
*/
|
|
16423
16438
|
sfcBlocks?: boolean | Options;
|
|
16424
16439
|
}
|
|
16440
|
+
interface OptionsReact extends OptionsFiles {
|
|
16441
|
+
reactCompiler?: boolean;
|
|
16442
|
+
}
|
|
16425
16443
|
type OptionsTypescript = (OptionsTypeScriptWithTypes & OptionsOverrides & OptionsTypeScriptErasableOnly) | (OptionsTypeScriptParserOptions & OptionsOverrides & OptionsTypeScriptErasableOnly);
|
|
16426
16444
|
interface OptionsFormatters {
|
|
16427
16445
|
/**
|
|
@@ -16574,6 +16592,12 @@ interface OptionsIgnores {
|
|
|
16574
16592
|
interface OptionsIsInEditor {
|
|
16575
16593
|
isInEditor?: boolean;
|
|
16576
16594
|
}
|
|
16595
|
+
interface OptionsPnpm extends OptionsIsInEditor {
|
|
16596
|
+
/**
|
|
16597
|
+
* 需要使用目录支持?
|
|
16598
|
+
*/
|
|
16599
|
+
catalogs?: boolean;
|
|
16600
|
+
}
|
|
16577
16601
|
interface OptionsUnoCSS {
|
|
16578
16602
|
/**
|
|
16579
16603
|
* 启用 attributify 支持.
|
|
@@ -16686,7 +16710,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
16686
16710
|
*
|
|
16687
16711
|
* @default 根据依赖关系自动检测
|
|
16688
16712
|
*/
|
|
16689
|
-
react?: boolean |
|
|
16713
|
+
react?: boolean | OptionsReact;
|
|
16690
16714
|
/**
|
|
16691
16715
|
* 启用 nextjs 支持.
|
|
16692
16716
|
*
|
|
@@ -16853,10 +16877,10 @@ declare function node(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]
|
|
|
16853
16877
|
declare function perfectionist(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
16854
16878
|
//#endregion
|
|
16855
16879
|
//#region src/configs/pnpm.d.ts
|
|
16856
|
-
declare function pnpm(options?:
|
|
16880
|
+
declare function pnpm(options?: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
|
|
16857
16881
|
//#endregion
|
|
16858
16882
|
//#region src/configs/react.d.ts
|
|
16859
|
-
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides &
|
|
16883
|
+
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsReact): Promise<TypedFlatConfigItem[]>;
|
|
16860
16884
|
//#endregion
|
|
16861
16885
|
//#region src/configs/regexp.d.ts
|
|
16862
16886
|
declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
@@ -16973,4 +16997,4 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
|
|
|
16973
16997
|
declare function isInEditorEnv(): boolean;
|
|
16974
16998
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
16975
16999
|
//#endregion
|
|
16976
|
-
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 };
|
|
17000
|
+
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, OptionsPnpm, 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 };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
2
|
import process from "node:process";
|
|
3
|
+
import fs from "node:fs/promises";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import fs from "node:fs";
|
|
5
|
+
import fs$1 from "node:fs";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import { getPackageInfoSync, isPackageExists } from "local-pkg";
|
|
7
8
|
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
@@ -18,6 +19,21 @@ import { configs } from "eslint-plugin-regexp";
|
|
|
18
19
|
|
|
19
20
|
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
20
21
|
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
22
|
+
async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
23
|
+
let directory = path.resolve(toPath(cwd) ?? "");
|
|
24
|
+
const { root } = path.parse(directory);
|
|
25
|
+
stopAt = path.resolve(directory, toPath(stopAt ?? root));
|
|
26
|
+
const isAbsoluteName = path.isAbsolute(name);
|
|
27
|
+
while (directory) {
|
|
28
|
+
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
29
|
+
try {
|
|
30
|
+
const stats = await fs.stat(filePath);
|
|
31
|
+
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
32
|
+
} catch {}
|
|
33
|
+
if (directory === stopAt || directory === root) break;
|
|
34
|
+
directory = path.dirname(directory);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
21
37
|
function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
22
38
|
let directory = path.resolve(toPath(cwd) ?? "");
|
|
23
39
|
const { root } = path.parse(directory);
|
|
@@ -26,7 +42,7 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
|
26
42
|
while (directory) {
|
|
27
43
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
28
44
|
try {
|
|
29
|
-
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
45
|
+
const stats = fs$1.statSync(filePath, { throwIfNoEntry: false });
|
|
30
46
|
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
31
47
|
} catch {}
|
|
32
48
|
if (directory === stopAt || directory === root) break;
|
|
@@ -988,37 +1004,125 @@ async function perfectionist(options = {}) {
|
|
|
988
1004
|
|
|
989
1005
|
//#endregion
|
|
990
1006
|
//#region src/configs/pnpm.ts
|
|
1007
|
+
async function detectCatalogUsage() {
|
|
1008
|
+
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1009
|
+
if (!workspaceFile) return false;
|
|
1010
|
+
const yaml$1 = await fs.readFile(workspaceFile, "utf-8");
|
|
1011
|
+
return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
|
|
1012
|
+
}
|
|
991
1013
|
async function pnpm(options = {}) {
|
|
1014
|
+
const { catalogs = await detectCatalogUsage(), isInEditor = false } = options;
|
|
992
1015
|
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
993
1016
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
994
1017
|
interopDefault(import("yaml-eslint-parser")),
|
|
995
1018
|
interopDefault(import("jsonc-eslint-parser"))
|
|
996
1019
|
]);
|
|
997
|
-
return [
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
+
return [
|
|
1021
|
+
{
|
|
1022
|
+
files: ["package.json", "**/package.json"],
|
|
1023
|
+
languageOptions: { parser: jsoncParser },
|
|
1024
|
+
name: "eslint/pnpm/package-json",
|
|
1025
|
+
plugins: { pnpm: pluginPnpm },
|
|
1026
|
+
rules: {
|
|
1027
|
+
...catalogs ? { "pnpm/json-enforce-catalog": ["error", {
|
|
1028
|
+
autofix: !isInEditor,
|
|
1029
|
+
ignores: ["@types/vscode"]
|
|
1030
|
+
}] } : {},
|
|
1031
|
+
"pnpm/json-prefer-workspace-settings": ["error", { autofix: isInEditor }],
|
|
1032
|
+
"pnpm/json-valid-catalog": ["error", { autofix: isInEditor }]
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
files: ["pnpm-workspace.yaml"],
|
|
1037
|
+
languageOptions: { parser: yamlParser },
|
|
1038
|
+
name: "eslint/pnpm/pnpm-workspace-yaml",
|
|
1039
|
+
plugins: { pnpm: pluginPnpm },
|
|
1040
|
+
rules: {
|
|
1041
|
+
"pnpm/yaml-enforce-settings": ["error", { settings: {
|
|
1042
|
+
catalogMode: "prefer",
|
|
1043
|
+
shellEmulator: true
|
|
1044
|
+
} }],
|
|
1045
|
+
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
1046
|
+
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
files: ["pnpm-workspace.yaml"],
|
|
1051
|
+
name: "eslint/yaml/pnpm-workspace",
|
|
1052
|
+
rules: { "yaml/sort-keys": [
|
|
1053
|
+
"error",
|
|
1054
|
+
{
|
|
1055
|
+
order: [
|
|
1056
|
+
...[
|
|
1057
|
+
"cacheDir",
|
|
1058
|
+
"catalogMode",
|
|
1059
|
+
"cleanupUnusedCatalogs",
|
|
1060
|
+
"dedupeDirectDeps",
|
|
1061
|
+
"deployAllFiles",
|
|
1062
|
+
"enablePrePostScripts",
|
|
1063
|
+
"engineStrict",
|
|
1064
|
+
"extendNodePath",
|
|
1065
|
+
"hoist",
|
|
1066
|
+
"hoistPattern",
|
|
1067
|
+
"hoistWorkspacePackages",
|
|
1068
|
+
"ignoreCompatibilityDb",
|
|
1069
|
+
"ignoreDepScripts",
|
|
1070
|
+
"ignoreScripts",
|
|
1071
|
+
"ignoreWorkspaceRootCheck",
|
|
1072
|
+
"managePackageManagerVersions",
|
|
1073
|
+
"minimumReleaseAge",
|
|
1074
|
+
"minimumReleaseAgeExclude",
|
|
1075
|
+
"modulesDir",
|
|
1076
|
+
"nodeLinker",
|
|
1077
|
+
"nodeVersion",
|
|
1078
|
+
"optimisticRepeatInstall",
|
|
1079
|
+
"packageManagerStrict",
|
|
1080
|
+
"packageManagerStrictVersion",
|
|
1081
|
+
"preferSymlinkedExecutables",
|
|
1082
|
+
"preferWorkspacePackages",
|
|
1083
|
+
"publicHoistPattern",
|
|
1084
|
+
"registrySupportsTimeField",
|
|
1085
|
+
"requiredScripts",
|
|
1086
|
+
"resolutionMode",
|
|
1087
|
+
"savePrefix",
|
|
1088
|
+
"scriptShell",
|
|
1089
|
+
"shamefullyHoist",
|
|
1090
|
+
"shellEmulator",
|
|
1091
|
+
"stateDir",
|
|
1092
|
+
"supportedArchitectures",
|
|
1093
|
+
"symlink",
|
|
1094
|
+
"tag",
|
|
1095
|
+
"trustPolicy",
|
|
1096
|
+
"trustPolicyExclude",
|
|
1097
|
+
"updateNotifier"
|
|
1098
|
+
],
|
|
1099
|
+
"packages",
|
|
1100
|
+
"overrides",
|
|
1101
|
+
"patchedDependencies",
|
|
1102
|
+
"catalog",
|
|
1103
|
+
"catalogs",
|
|
1104
|
+
...[
|
|
1105
|
+
"allowedDeprecatedVersions",
|
|
1106
|
+
"allowNonAppliedPatches",
|
|
1107
|
+
"configDependencies",
|
|
1108
|
+
"ignoredBuiltDependencies",
|
|
1109
|
+
"ignoredOptionalDependencies",
|
|
1110
|
+
"neverBuiltDependencies",
|
|
1111
|
+
"onlyBuiltDependencies",
|
|
1112
|
+
"onlyBuiltDependenciesFile",
|
|
1113
|
+
"packageExtensions",
|
|
1114
|
+
"peerDependencyRules"
|
|
1115
|
+
]
|
|
1116
|
+
],
|
|
1117
|
+
pathPattern: "^$"
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
order: { type: "asc" },
|
|
1121
|
+
pathPattern: ".*"
|
|
1122
|
+
}
|
|
1123
|
+
] }
|
|
1020
1124
|
}
|
|
1021
|
-
|
|
1125
|
+
];
|
|
1022
1126
|
}
|
|
1023
1127
|
|
|
1024
1128
|
//#endregion
|
|
@@ -1037,8 +1141,9 @@ const ReactRouterPackages = [
|
|
|
1037
1141
|
"@react-router/dev"
|
|
1038
1142
|
];
|
|
1039
1143
|
const NextJsPackages = ["next"];
|
|
1144
|
+
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
1040
1145
|
async function react(options = {}) {
|
|
1041
|
-
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, tsconfigPath } = options;
|
|
1146
|
+
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, reactCompiler = ReactCompilerPackages.some((i) => isPackageExists(i)), tsconfigPath } = options;
|
|
1042
1147
|
await ensurePackages([
|
|
1043
1148
|
"@eslint-react/eslint-plugin",
|
|
1044
1149
|
"eslint-plugin-react-hooks",
|
|
@@ -1082,18 +1187,19 @@ async function react(options = {}) {
|
|
|
1082
1187
|
"react-dom/no-find-dom-node": "error",
|
|
1083
1188
|
"react-dom/no-flush-sync": "error",
|
|
1084
1189
|
"react-dom/no-hydrate": "error",
|
|
1085
|
-
"react-dom/no-missing-button-type": "warn",
|
|
1086
|
-
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
1087
1190
|
"react-dom/no-namespace": "error",
|
|
1088
1191
|
"react-dom/no-render": "error",
|
|
1089
1192
|
"react-dom/no-render-return-value": "error",
|
|
1090
1193
|
"react-dom/no-script-url": "warn",
|
|
1091
1194
|
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1092
|
-
"react-dom/no-unsafe-target-blank": "warn",
|
|
1093
1195
|
"react-dom/no-use-form-state": "error",
|
|
1094
1196
|
"react-dom/no-void-elements-with-children": "error",
|
|
1197
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1198
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1199
|
+
"react/jsx-key-before-spread": "warn",
|
|
1095
1200
|
"react/jsx-no-comment-textnodes": "warn",
|
|
1096
1201
|
"react/jsx-no-duplicate-props": "warn",
|
|
1202
|
+
"react/jsx-uses-react": "warn",
|
|
1097
1203
|
"react/jsx-uses-vars": "warn",
|
|
1098
1204
|
"react/no-access-state-in-setstate": "error",
|
|
1099
1205
|
"react/no-array-index-key": "warn",
|
|
@@ -1110,11 +1216,12 @@ async function react(options = {}) {
|
|
|
1110
1216
|
"react/no-create-ref": "error",
|
|
1111
1217
|
"react/no-default-props": "error",
|
|
1112
1218
|
"react/no-direct-mutation-state": "error",
|
|
1113
|
-
"react/no-duplicate-key": "
|
|
1219
|
+
"react/no-duplicate-key": "error",
|
|
1114
1220
|
"react/no-forward-ref": "warn",
|
|
1115
1221
|
"react/no-implicit-key": "warn",
|
|
1116
1222
|
"react/no-missing-key": "error",
|
|
1117
1223
|
"react/no-nested-component-definitions": "error",
|
|
1224
|
+
"react/no-nested-lazy-component-declarations": "error",
|
|
1118
1225
|
"react/no-prop-types": "error",
|
|
1119
1226
|
"react/no-redundant-should-component-update": "error",
|
|
1120
1227
|
"react/no-set-state-in-component-did-mount": "warn",
|
|
@@ -1125,14 +1232,26 @@ async function react(options = {}) {
|
|
|
1125
1232
|
"react/no-unsafe-component-will-mount": "warn",
|
|
1126
1233
|
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1127
1234
|
"react/no-unsafe-component-will-update": "warn",
|
|
1128
|
-
"react/no-unstable-context-value": "warn",
|
|
1129
|
-
"react/no-unstable-default-props": "warn",
|
|
1130
|
-
"react/no-unused-class-component-members": "warn",
|
|
1131
|
-
"react/no-unused-state": "warn",
|
|
1132
1235
|
"react/no-use-context": "warn",
|
|
1133
1236
|
"react/no-useless-forward-ref": "warn",
|
|
1134
1237
|
"react/prefer-use-state-lazy-initialization": "warn",
|
|
1135
|
-
...
|
|
1238
|
+
...reactCompiler ? {
|
|
1239
|
+
"react-hooks/component-hook-factories": "error",
|
|
1240
|
+
"react-hooks/config": "error",
|
|
1241
|
+
"react-hooks/error-boundaries": "error",
|
|
1242
|
+
"react-hooks/gating": "error",
|
|
1243
|
+
"react-hooks/globals": "error",
|
|
1244
|
+
"react-hooks/immutability": "error",
|
|
1245
|
+
"react-hooks/incompatible-library": "warn",
|
|
1246
|
+
"react-hooks/preserve-manual-memoization": "error",
|
|
1247
|
+
"react-hooks/purity": "error",
|
|
1248
|
+
"react-hooks/refs": "error",
|
|
1249
|
+
"react-hooks/set-state-in-effect": "error",
|
|
1250
|
+
"react-hooks/set-state-in-render": "error",
|
|
1251
|
+
"react-hooks/static-components": "error",
|
|
1252
|
+
"react-hooks/unsupported-syntax": "warn",
|
|
1253
|
+
"react-hooks/use-memo": "error"
|
|
1254
|
+
} : {},
|
|
1136
1255
|
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1137
1256
|
"react-refresh/only-export-components": ["warn", {
|
|
1138
1257
|
allowConstantExport: isAllowConstantExport,
|
|
@@ -1645,7 +1764,7 @@ async function typescript(options = {}) {
|
|
|
1645
1764
|
}] : [],
|
|
1646
1765
|
...erasableOnly ? [{
|
|
1647
1766
|
name: "eslint/typescript/erasable-syntax-only",
|
|
1648
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("
|
|
1767
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("eslint-plugin-erasable-syntax-only")) },
|
|
1649
1768
|
rules: {
|
|
1650
1769
|
"erasable-syntax-only/enums": "error",
|
|
1651
1770
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -1921,120 +2040,41 @@ async function yaml(options = {}) {
|
|
|
1921
2040
|
const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
1922
2041
|
const { quotes = "single" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
|
|
1923
2042
|
const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
|
|
1924
|
-
return [
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
{
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
"yaml/
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
} : {},
|
|
1958
|
-
...overrides
|
|
1959
|
-
}
|
|
1960
|
-
},
|
|
1961
|
-
{
|
|
1962
|
-
files: ["pnpm-workspace.yaml"],
|
|
1963
|
-
name: "eslint/yaml/pnpm-workspace",
|
|
1964
|
-
rules: { "yaml/sort-keys": [
|
|
1965
|
-
"error",
|
|
1966
|
-
{
|
|
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
|
-
],
|
|
2011
|
-
"packages",
|
|
2012
|
-
"overrides",
|
|
2013
|
-
"patchedDependencies",
|
|
2014
|
-
"catalog",
|
|
2015
|
-
"catalogs",
|
|
2016
|
-
...[
|
|
2017
|
-
"allowedDeprecatedVersions",
|
|
2018
|
-
"allowNonAppliedPatches",
|
|
2019
|
-
"configDependencies",
|
|
2020
|
-
"ignoredBuiltDependencies",
|
|
2021
|
-
"ignoredOptionalDependencies",
|
|
2022
|
-
"neverBuiltDependencies",
|
|
2023
|
-
"onlyBuiltDependencies",
|
|
2024
|
-
"onlyBuiltDependenciesFile",
|
|
2025
|
-
"packageExtensions",
|
|
2026
|
-
"peerDependencyRules"
|
|
2027
|
-
]
|
|
2028
|
-
],
|
|
2029
|
-
pathPattern: "^$"
|
|
2030
|
-
},
|
|
2031
|
-
{
|
|
2032
|
-
order: { type: "asc" },
|
|
2033
|
-
pathPattern: ".*"
|
|
2034
|
-
}
|
|
2035
|
-
] }
|
|
2043
|
+
return [{
|
|
2044
|
+
name: "eslint/yaml/setup",
|
|
2045
|
+
plugins: { yaml: pluginYaml }
|
|
2046
|
+
}, {
|
|
2047
|
+
files,
|
|
2048
|
+
languageOptions: { parser: parserYaml },
|
|
2049
|
+
name: "eslint/yaml/rules",
|
|
2050
|
+
rules: {
|
|
2051
|
+
"style/spaced-comment": "off",
|
|
2052
|
+
"yaml/block-mapping": "error",
|
|
2053
|
+
"yaml/block-sequence": "error",
|
|
2054
|
+
"yaml/no-empty-key": "error",
|
|
2055
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
2056
|
+
"yaml/no-irregular-whitespace": "error",
|
|
2057
|
+
"yaml/plain-scalar": "error",
|
|
2058
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
2059
|
+
...stylistic$1 ? {
|
|
2060
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
2061
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
2062
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
2063
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
2064
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
2065
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
2066
|
+
"yaml/indent": ["error", 2],
|
|
2067
|
+
"yaml/key-spacing": "error",
|
|
2068
|
+
"yaml/no-tab-indent": "error",
|
|
2069
|
+
"yaml/quotes": ["error", {
|
|
2070
|
+
avoidEscape: true,
|
|
2071
|
+
prefer: quotes === "backtick" ? "single" : quotes
|
|
2072
|
+
}],
|
|
2073
|
+
"yaml/spaced-comment": "error"
|
|
2074
|
+
} : {},
|
|
2075
|
+
...overrides
|
|
2036
2076
|
}
|
|
2037
|
-
];
|
|
2077
|
+
}];
|
|
2038
2078
|
}
|
|
2039
2079
|
|
|
2040
2080
|
//#endregion
|