@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.d.mts
CHANGED
|
@@ -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 {
|
|
@@ -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 };
|
package/dist/index.mjs
CHANGED
|
@@ -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,32 +988,115 @@ 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")),
|
|
974
995
|
interopDefault(import("jsonc-eslint-parser"))
|
|
975
996
|
]);
|
|
976
|
-
return [
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
997
|
+
return [
|
|
998
|
+
{
|
|
999
|
+
files: ["package.json", "**/package.json"],
|
|
1000
|
+
languageOptions: { parser: jsoncParser },
|
|
1001
|
+
name: "eslint/pnpm/package-json",
|
|
1002
|
+
plugins: { pnpm: pluginPnpm },
|
|
1003
|
+
rules: {
|
|
1004
|
+
"pnpm/json-enforce-catalog": ["error", { autofix: !options.isInEditor }],
|
|
1005
|
+
"pnpm/json-prefer-workspace-settings": ["error", { autofix: !options.isInEditor }],
|
|
1006
|
+
"pnpm/json-valid-catalog": ["error", { autofix: !options.isInEditor }]
|
|
1007
|
+
}
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
files: ["pnpm-workspace.yaml"],
|
|
1011
|
+
languageOptions: { parser: yamlParser },
|
|
1012
|
+
name: "eslint/pnpm/pnpm-workspace-yaml",
|
|
1013
|
+
plugins: { pnpm: pluginPnpm },
|
|
1014
|
+
rules: {
|
|
1015
|
+
"pnpm/yaml-enforce-settings": ["error", { settings: {
|
|
1016
|
+
catalogMode: "prefer",
|
|
1017
|
+
shellEmulator: true
|
|
1018
|
+
} }],
|
|
1019
|
+
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
1020
|
+
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1021
|
+
}
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
files: ["pnpm-workspace.yaml"],
|
|
1025
|
+
name: "eslint/yaml/pnpm-workspace",
|
|
1026
|
+
rules: { "yaml/sort-keys": [
|
|
1027
|
+
"error",
|
|
1028
|
+
{
|
|
1029
|
+
order: [
|
|
1030
|
+
...[
|
|
1031
|
+
"cacheDir",
|
|
1032
|
+
"catalogMode",
|
|
1033
|
+
"cleanupUnusedCatalogs",
|
|
1034
|
+
"dedupeDirectDeps",
|
|
1035
|
+
"deployAllFiles",
|
|
1036
|
+
"enablePrePostScripts",
|
|
1037
|
+
"engineStrict",
|
|
1038
|
+
"extendNodePath",
|
|
1039
|
+
"hoist",
|
|
1040
|
+
"hoistPattern",
|
|
1041
|
+
"hoistWorkspacePackages",
|
|
1042
|
+
"ignoreCompatibilityDb",
|
|
1043
|
+
"ignoreDepScripts",
|
|
1044
|
+
"ignoreScripts",
|
|
1045
|
+
"ignoreWorkspaceRootCheck",
|
|
1046
|
+
"managePackageManagerVersions",
|
|
1047
|
+
"minimumReleaseAge",
|
|
1048
|
+
"minimumReleaseAgeExclude",
|
|
1049
|
+
"modulesDir",
|
|
1050
|
+
"nodeLinker",
|
|
1051
|
+
"nodeVersion",
|
|
1052
|
+
"optimisticRepeatInstall",
|
|
1053
|
+
"packageManagerStrict",
|
|
1054
|
+
"packageManagerStrictVersion",
|
|
1055
|
+
"preferSymlinkedExecutables",
|
|
1056
|
+
"preferWorkspacePackages",
|
|
1057
|
+
"publicHoistPattern",
|
|
1058
|
+
"registrySupportsTimeField",
|
|
1059
|
+
"requiredScripts",
|
|
1060
|
+
"resolutionMode",
|
|
1061
|
+
"savePrefix",
|
|
1062
|
+
"scriptShell",
|
|
1063
|
+
"shamefullyHoist",
|
|
1064
|
+
"shellEmulator",
|
|
1065
|
+
"stateDir",
|
|
1066
|
+
"supportedArchitectures",
|
|
1067
|
+
"symlink",
|
|
1068
|
+
"tag",
|
|
1069
|
+
"trustPolicy",
|
|
1070
|
+
"trustPolicyExclude",
|
|
1071
|
+
"updateNotifier"
|
|
1072
|
+
],
|
|
1073
|
+
"packages",
|
|
1074
|
+
"overrides",
|
|
1075
|
+
"patchedDependencies",
|
|
1076
|
+
"catalog",
|
|
1077
|
+
"catalogs",
|
|
1078
|
+
...[
|
|
1079
|
+
"allowedDeprecatedVersions",
|
|
1080
|
+
"allowNonAppliedPatches",
|
|
1081
|
+
"configDependencies",
|
|
1082
|
+
"ignoredBuiltDependencies",
|
|
1083
|
+
"ignoredOptionalDependencies",
|
|
1084
|
+
"neverBuiltDependencies",
|
|
1085
|
+
"onlyBuiltDependencies",
|
|
1086
|
+
"onlyBuiltDependenciesFile",
|
|
1087
|
+
"packageExtensions",
|
|
1088
|
+
"peerDependencyRules"
|
|
1089
|
+
]
|
|
1090
|
+
],
|
|
1091
|
+
pathPattern: "^$"
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
order: { type: "asc" },
|
|
1095
|
+
pathPattern: ".*"
|
|
1096
|
+
}
|
|
1097
|
+
] }
|
|
994
1098
|
}
|
|
995
|
-
|
|
1099
|
+
];
|
|
996
1100
|
}
|
|
997
1101
|
|
|
998
1102
|
//#endregion
|
|
@@ -1011,8 +1115,9 @@ const ReactRouterPackages = [
|
|
|
1011
1115
|
"@react-router/dev"
|
|
1012
1116
|
];
|
|
1013
1117
|
const NextJsPackages = ["next"];
|
|
1118
|
+
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
1014
1119
|
async function react(options = {}) {
|
|
1015
|
-
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, tsconfigPath } = options;
|
|
1120
|
+
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, reactCompiler = ReactCompilerPackages.some((i) => isPackageExists(i)), tsconfigPath } = options;
|
|
1016
1121
|
await ensurePackages([
|
|
1017
1122
|
"@eslint-react/eslint-plugin",
|
|
1018
1123
|
"eslint-plugin-react-hooks",
|
|
@@ -1066,6 +1171,8 @@ async function react(options = {}) {
|
|
|
1066
1171
|
"react-dom/no-unsafe-target-blank": "warn",
|
|
1067
1172
|
"react-dom/no-use-form-state": "error",
|
|
1068
1173
|
"react-dom/no-void-elements-with-children": "error",
|
|
1174
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1175
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1069
1176
|
"react/jsx-no-comment-textnodes": "warn",
|
|
1070
1177
|
"react/jsx-no-duplicate-props": "warn",
|
|
1071
1178
|
"react/jsx-uses-vars": "warn",
|
|
@@ -1106,7 +1213,23 @@ async function react(options = {}) {
|
|
|
1106
1213
|
"react/no-use-context": "warn",
|
|
1107
1214
|
"react/no-useless-forward-ref": "warn",
|
|
1108
1215
|
"react/prefer-use-state-lazy-initialization": "warn",
|
|
1109
|
-
...
|
|
1216
|
+
...reactCompiler ? {
|
|
1217
|
+
"react-hooks/component-hook-factories": "error",
|
|
1218
|
+
"react-hooks/config": "error",
|
|
1219
|
+
"react-hooks/error-boundaries": "error",
|
|
1220
|
+
"react-hooks/gating": "error",
|
|
1221
|
+
"react-hooks/globals": "error",
|
|
1222
|
+
"react-hooks/immutability": "error",
|
|
1223
|
+
"react-hooks/incompatible-library": "warn",
|
|
1224
|
+
"react-hooks/preserve-manual-memoization": "error",
|
|
1225
|
+
"react-hooks/purity": "error",
|
|
1226
|
+
"react-hooks/refs": "error",
|
|
1227
|
+
"react-hooks/set-state-in-effect": "error",
|
|
1228
|
+
"react-hooks/set-state-in-render": "error",
|
|
1229
|
+
"react-hooks/static-components": "error",
|
|
1230
|
+
"react-hooks/unsupported-syntax": "warn",
|
|
1231
|
+
"react-hooks/use-memo": "error"
|
|
1232
|
+
} : {},
|
|
1110
1233
|
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1111
1234
|
"react-refresh/only-export-components": ["warn", {
|
|
1112
1235
|
allowConstantExport: isAllowConstantExport,
|
|
@@ -1619,7 +1742,7 @@ async function typescript(options = {}) {
|
|
|
1619
1742
|
}] : [],
|
|
1620
1743
|
...erasableOnly ? [{
|
|
1621
1744
|
name: "eslint/typescript/erasable-syntax-only",
|
|
1622
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("
|
|
1745
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("eslint-plugin-erasable-syntax-only")) },
|
|
1623
1746
|
rules: {
|
|
1624
1747
|
"erasable-syntax-only/enums": "error",
|
|
1625
1748
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -1895,77 +2018,41 @@ async function yaml(options = {}) {
|
|
|
1895
2018
|
const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
1896
2019
|
const { quotes = "single" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
|
|
1897
2020
|
const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
|
|
1898
|
-
return [
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
{
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
"yaml/
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
} : {},
|
|
1932
|
-
...overrides
|
|
1933
|
-
}
|
|
1934
|
-
},
|
|
1935
|
-
{
|
|
1936
|
-
files: ["pnpm-workspace.yaml"],
|
|
1937
|
-
name: "eslint/yaml/pnpm-workspace",
|
|
1938
|
-
rules: { "yaml/sort-keys": [
|
|
1939
|
-
"error",
|
|
1940
|
-
{
|
|
1941
|
-
order: [
|
|
1942
|
-
"packages",
|
|
1943
|
-
"overrides",
|
|
1944
|
-
"patchedDependencies",
|
|
1945
|
-
"hoistPattern",
|
|
1946
|
-
"catalog",
|
|
1947
|
-
"catalogs",
|
|
1948
|
-
"allowedDeprecatedVersions",
|
|
1949
|
-
"allowNonAppliedPatches",
|
|
1950
|
-
"configDependencies",
|
|
1951
|
-
"ignoredBuiltDependencies",
|
|
1952
|
-
"ignoredOptionalDependencies",
|
|
1953
|
-
"neverBuiltDependencies",
|
|
1954
|
-
"onlyBuiltDependencies",
|
|
1955
|
-
"onlyBuiltDependenciesFile",
|
|
1956
|
-
"packageExtensions",
|
|
1957
|
-
"peerDependencyRules",
|
|
1958
|
-
"supportedArchitectures"
|
|
1959
|
-
],
|
|
1960
|
-
pathPattern: "^$"
|
|
1961
|
-
},
|
|
1962
|
-
{
|
|
1963
|
-
order: { type: "asc" },
|
|
1964
|
-
pathPattern: ".*"
|
|
1965
|
-
}
|
|
1966
|
-
] }
|
|
2021
|
+
return [{
|
|
2022
|
+
name: "eslint/yaml/setup",
|
|
2023
|
+
plugins: { yaml: pluginYaml }
|
|
2024
|
+
}, {
|
|
2025
|
+
files,
|
|
2026
|
+
languageOptions: { parser: parserYaml },
|
|
2027
|
+
name: "eslint/yaml/rules",
|
|
2028
|
+
rules: {
|
|
2029
|
+
"style/spaced-comment": "off",
|
|
2030
|
+
"yaml/block-mapping": "error",
|
|
2031
|
+
"yaml/block-sequence": "error",
|
|
2032
|
+
"yaml/no-empty-key": "error",
|
|
2033
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
2034
|
+
"yaml/no-irregular-whitespace": "error",
|
|
2035
|
+
"yaml/plain-scalar": "error",
|
|
2036
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
2037
|
+
...stylistic$1 ? {
|
|
2038
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
2039
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
2040
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
2041
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
2042
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
2043
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
2044
|
+
"yaml/indent": ["error", 2],
|
|
2045
|
+
"yaml/key-spacing": "error",
|
|
2046
|
+
"yaml/no-tab-indent": "error",
|
|
2047
|
+
"yaml/quotes": ["error", {
|
|
2048
|
+
avoidEscape: true,
|
|
2049
|
+
prefer: quotes === "backtick" ? "single" : quotes
|
|
2050
|
+
}],
|
|
2051
|
+
"yaml/spaced-comment": "error"
|
|
2052
|
+
} : {},
|
|
2053
|
+
...overrides
|
|
1967
2054
|
}
|
|
1968
|
-
];
|
|
2055
|
+
}];
|
|
1969
2056
|
}
|
|
1970
2057
|
|
|
1971
2058
|
//#endregion
|
|
@@ -2009,7 +2096,7 @@ const defaultPluginRenaming = {
|
|
|
2009
2096
|
* 合并的 ESLint 配置
|
|
2010
2097
|
*/
|
|
2011
2098
|
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 =
|
|
2099
|
+
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
2100
|
let isInEditor = options.isInEditor;
|
|
2014
2101
|
if (isInEditor == null) {
|
|
2015
2102
|
isInEditor = isInEditorEnv();
|
|
@@ -2087,7 +2174,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2087
2174
|
overrides: getOverrides(options, "jsonc"),
|
|
2088
2175
|
stylistic: stylisticOptions
|
|
2089
2176
|
}), sortPackageJson(), sortTsconfig());
|
|
2090
|
-
if (enableCatalogs) configs$1.push(pnpm());
|
|
2177
|
+
if (enableCatalogs) configs$1.push(pnpm({ isInEditor }));
|
|
2091
2178
|
if (options.yaml ?? true) configs$1.push(yaml({
|
|
2092
2179
|
...resolveSubOptions(options, "yaml"),
|
|
2093
2180
|
overrides: getOverrides(options, "yaml"),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincy/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.0
|
|
4
|
+
"version": "6.2.0",
|
|
5
5
|
"description": "LinCenYing's ESLint config",
|
|
6
6
|
"author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -11,13 +11,14 @@
|
|
|
11
11
|
],
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
}
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
15
|
+
"import": "./dist/index.mjs"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
17
18
|
},
|
|
18
19
|
"main": "./dist/index.cjs",
|
|
19
20
|
"module": "./dist/index.mjs",
|
|
20
|
-
"types": "./dist/index.d.
|
|
21
|
+
"types": "./dist/index.d.cts",
|
|
21
22
|
"files": [
|
|
22
23
|
"dist"
|
|
23
24
|
],
|
|
@@ -60,69 +61,71 @@
|
|
|
60
61
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
61
62
|
"@eslint/markdown": "^7.5.1",
|
|
62
63
|
"@stylistic/eslint-plugin": "^5.6.1",
|
|
63
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
64
|
-
"@typescript-eslint/parser": "^8.
|
|
65
|
-
"@vitest/eslint-plugin": "^1.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^8.49.0",
|
|
65
|
+
"@typescript-eslint/parser": "^8.49.0",
|
|
66
|
+
"@vitest/eslint-plugin": "^1.5.2",
|
|
66
67
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
67
68
|
"eslint-flat-config-utils": "^2.1.4",
|
|
68
69
|
"eslint-merge-processors": "^2.0.0",
|
|
69
70
|
"eslint-parser-plain": "^0.1.1",
|
|
70
71
|
"eslint-plugin-antfu": "^3.1.1",
|
|
72
|
+
"eslint-plugin-erasable-syntax-only": "^0.4.0",
|
|
71
73
|
"eslint-plugin-import-lite": "^0.3.0",
|
|
72
|
-
"eslint-plugin-jsdoc": "^61.
|
|
74
|
+
"eslint-plugin-jsdoc": "^61.5.0",
|
|
73
75
|
"eslint-plugin-jsonc": "^2.21.0",
|
|
74
76
|
"eslint-plugin-n": "^17.23.1",
|
|
75
77
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
76
78
|
"eslint-plugin-perfectionist": "^4.15.1",
|
|
77
|
-
"eslint-plugin-pnpm": "^1.
|
|
79
|
+
"eslint-plugin-pnpm": "^1.4.2",
|
|
78
80
|
"eslint-plugin-regexp": "^2.10.0",
|
|
79
81
|
"eslint-plugin-toml": "^0.12.0",
|
|
80
82
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
81
83
|
"eslint-plugin-unused-imports": "^4.3.0",
|
|
82
|
-
"eslint-plugin-vue": "^10.
|
|
84
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
83
85
|
"eslint-plugin-yml": "^1.19.0",
|
|
84
86
|
"eslint-processor-vue-blocks": "^2.0.0",
|
|
85
87
|
"globals": "^16.5.0",
|
|
86
|
-
"jsonc-eslint-parser": "^2.4.
|
|
88
|
+
"jsonc-eslint-parser": "^2.4.2",
|
|
87
89
|
"local-pkg": "^1.1.2",
|
|
88
|
-
"
|
|
89
|
-
"toml-eslint-parser": "^0.10.0",
|
|
90
|
+
"toml-eslint-parser": "^0.10.1",
|
|
90
91
|
"vue-eslint-parser": "^10.2.0",
|
|
91
|
-
"yaml-eslint-parser": "^1.3.
|
|
92
|
+
"yaml-eslint-parser": "^1.3.2"
|
|
92
93
|
},
|
|
93
94
|
"devDependencies": {
|
|
94
|
-
"@antfu/ni": "^
|
|
95
|
-
"@eslint-react/eslint-plugin": "^2.3.
|
|
96
|
-
"@eslint
|
|
97
|
-
"@eslint-
|
|
98
|
-
"@eslint/config-inspector": "^1.4.1",
|
|
99
|
-
"@next/eslint-plugin-next": "^16.0.3",
|
|
95
|
+
"@antfu/ni": "^28.0.0",
|
|
96
|
+
"@eslint-react/eslint-plugin": "^2.3.12",
|
|
97
|
+
"@eslint/config-inspector": "^1.4.2",
|
|
98
|
+
"@next/eslint-plugin-next": "^16.0.8",
|
|
100
99
|
"@prettier/plugin-xml": "^3.4.2",
|
|
101
100
|
"@stylistic/eslint-plugin-migrate": "^4.4.1",
|
|
102
|
-
"@types/node": "^24.10.
|
|
103
|
-
"@types/react": "^19.2.
|
|
104
|
-
"@unocss/eslint-plugin": "^66.5.
|
|
105
|
-
"bumpp": "^10.3.
|
|
101
|
+
"@types/node": "^24.10.2",
|
|
102
|
+
"@types/react": "^19.2.7",
|
|
103
|
+
"@unocss/eslint-plugin": "^66.5.10",
|
|
104
|
+
"bumpp": "^10.3.2",
|
|
106
105
|
"eslint": "^9.39.1",
|
|
107
|
-
"eslint-plugin-
|
|
108
|
-
"eslint-plugin-format": "^1.0.2",
|
|
106
|
+
"eslint-plugin-format": "^1.1.0",
|
|
109
107
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
110
108
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
111
109
|
"eslint-typegen": "^2.3.0",
|
|
112
110
|
"esno": "^4.8.0",
|
|
113
|
-
"execa": "^9.6.
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
111
|
+
"execa": "^9.6.1",
|
|
112
|
+
"find-up-simple": "^1.0.1",
|
|
113
|
+
"lint-staged": "^16.2.7",
|
|
114
|
+
"prettier": "^3.7.4",
|
|
115
|
+
"react": "^19.2.1",
|
|
118
116
|
"simple-open-url": "^3.0.1",
|
|
119
|
-
"sucrase": "^3.35.0",
|
|
120
117
|
"tinyglobby": "^0.2.15",
|
|
121
|
-
"tsdown": "^0.
|
|
118
|
+
"tsdown": "^0.17.2",
|
|
122
119
|
"typescript": "^5.9.3",
|
|
123
|
-
"vitest": "^4.0.
|
|
124
|
-
"vue": "^3.5.
|
|
125
|
-
"@lincy/eslint-config": "6.0
|
|
120
|
+
"vitest": "^4.0.15",
|
|
121
|
+
"vue": "^3.5.25",
|
|
122
|
+
"@lincy/eslint-config": "6.2.0"
|
|
123
|
+
},
|
|
124
|
+
"resolutions": {
|
|
125
|
+
"@eslint-community/eslint-utils": "catalog:peer",
|
|
126
|
+
"@typescript-eslint/utils": "catalog:peer",
|
|
127
|
+
"eslint": "catalog:peer",
|
|
128
|
+
"tsx": "catalog:peer"
|
|
126
129
|
},
|
|
127
130
|
"simple-git-hooks[-del]": {
|
|
128
131
|
"pre-commit": "npx lint-staged"
|