@lincy/eslint-config 5.7.0 → 5.8.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/README.md +73 -44
- package/dist/index.cjs +41 -12
- package/dist/index.d.cts +302 -187
- package/dist/index.d.ts +302 -187
- package/dist/index.js +41 -13
- package/package.json +28 -23
package/dist/index.js
CHANGED
|
@@ -858,6 +858,34 @@ async function markdown(options = {}) {
|
|
|
858
858
|
];
|
|
859
859
|
}
|
|
860
860
|
|
|
861
|
+
//#endregion
|
|
862
|
+
//#region src/configs/nextjs.ts
|
|
863
|
+
function normalizeRules(rules) {
|
|
864
|
+
return Object.fromEntries(Object.entries(rules).map(([key, value]) => [key, typeof value === "string" ? [value] : value]));
|
|
865
|
+
}
|
|
866
|
+
async function nextjs(options = {}) {
|
|
867
|
+
const { files = [GLOB_SRC], overrides = {} } = options;
|
|
868
|
+
await ensurePackages(["@next/eslint-plugin-next"]);
|
|
869
|
+
const pluginNextJS = await interopDefault(import("@next/eslint-plugin-next"));
|
|
870
|
+
return [{
|
|
871
|
+
name: "eslint/nextjs/setup",
|
|
872
|
+
plugins: { next: pluginNextJS }
|
|
873
|
+
}, {
|
|
874
|
+
files,
|
|
875
|
+
languageOptions: {
|
|
876
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
877
|
+
sourceType: "module"
|
|
878
|
+
},
|
|
879
|
+
name: "eslint/nextjs/rules",
|
|
880
|
+
rules: {
|
|
881
|
+
...normalizeRules(pluginNextJS.configs.recommended.rules),
|
|
882
|
+
...normalizeRules(pluginNextJS.configs["core-web-vitals"].rules),
|
|
883
|
+
...overrides
|
|
884
|
+
},
|
|
885
|
+
settings: { react: { version: "detect" } }
|
|
886
|
+
}];
|
|
887
|
+
}
|
|
888
|
+
|
|
861
889
|
//#endregion
|
|
862
890
|
//#region src/configs/node.ts
|
|
863
891
|
async function node(options = {}) {
|
|
@@ -1255,7 +1283,7 @@ async function sortPackageJson() {
|
|
|
1255
1283
|
*/
|
|
1256
1284
|
function sortTsconfig() {
|
|
1257
1285
|
return [{
|
|
1258
|
-
files: ["**/
|
|
1286
|
+
files: ["**/[jt]sconfig.json", "**/[jt]sconfig.*.json"],
|
|
1259
1287
|
name: "eslint/sort/tsconfig",
|
|
1260
1288
|
rules: { "jsonc/sort-keys": [
|
|
1261
1289
|
"error",
|
|
@@ -1589,11 +1617,12 @@ async function typescript(options = {}) {
|
|
|
1589
1617
|
//#endregion
|
|
1590
1618
|
//#region src/configs/unicorn.ts
|
|
1591
1619
|
async function unicorn(options = {}) {
|
|
1620
|
+
const { allRecommended = false, overrides = {} } = options;
|
|
1592
1621
|
return [{
|
|
1593
1622
|
name: "eslint/unicorn/rules",
|
|
1594
1623
|
plugins: { unicorn: pluginUnicorn },
|
|
1595
1624
|
rules: {
|
|
1596
|
-
...
|
|
1625
|
+
...allRecommended ? pluginUnicorn.configs.recommended.rules : {
|
|
1597
1626
|
"unicorn/consistent-empty-array-spread": "error",
|
|
1598
1627
|
"unicorn/error-message": "error",
|
|
1599
1628
|
"unicorn/escape-case": "error",
|
|
@@ -1610,7 +1639,7 @@ async function unicorn(options = {}) {
|
|
|
1610
1639
|
"unicorn/prefer-type-error": "error",
|
|
1611
1640
|
"unicorn/throw-new-error": "error"
|
|
1612
1641
|
},
|
|
1613
|
-
...
|
|
1642
|
+
...overrides
|
|
1614
1643
|
}
|
|
1615
1644
|
}];
|
|
1616
1645
|
}
|
|
@@ -1945,6 +1974,7 @@ const defaultPluginRenaming = {
|
|
|
1945
1974
|
"@eslint-react/dom": "react-dom",
|
|
1946
1975
|
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
1947
1976
|
"@eslint-react/naming-convention": "react-naming-convention",
|
|
1977
|
+
"@next/next": "next",
|
|
1948
1978
|
"@stylistic": "style",
|
|
1949
1979
|
"@typescript-eslint": "ts",
|
|
1950
1980
|
"import-lite": "import",
|
|
@@ -1963,7 +1993,7 @@ const defaultPluginRenaming = {
|
|
|
1963
1993
|
* 合并的 ESLint 配置
|
|
1964
1994
|
*/
|
|
1965
1995
|
function lincy(options = {}, ...userConfigs) {
|
|
1966
|
-
const { autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: ignoresList = [], imports: enableImports = true, jsx: enableJsx = true, overrides = {}, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
1996
|
+
const { autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: ignoresList = [], imports: enableImports = true, jsx: enableJsx = true, nextjs: enableNextjs = false, overrides = {}, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
1967
1997
|
let isInEditor = options.isInEditor;
|
|
1968
1998
|
if (isInEditor == null) {
|
|
1969
1999
|
isInEditor = isInEditorEnv();
|
|
@@ -1985,19 +2015,16 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1985
2015
|
configs$1.push(ignores({ ignores: [...overrides.ignores || [], ...ignoresList] }), javascript({
|
|
1986
2016
|
isInEditor,
|
|
1987
2017
|
overrides: getOverrides(options, "javascript")
|
|
1988
|
-
}), comments({ overrides:
|
|
1989
|
-
overrides:
|
|
1990
|
-
stylistic: stylisticOptions
|
|
1991
|
-
}), imports({
|
|
1992
|
-
overrides: overrides.imports,
|
|
2018
|
+
}), comments({ overrides: getOverrides(options, "comments") }), node({ overrides: getOverrides(options, "node") }), jsdoc({
|
|
2019
|
+
overrides: getOverrides(options, "jsdoc"),
|
|
1993
2020
|
stylistic: stylisticOptions
|
|
1994
|
-
}), perfectionist({ overrides:
|
|
2021
|
+
}), perfectionist({ overrides: getOverrides(options, "perfectionist") }));
|
|
1995
2022
|
if (enableUnicorn) configs$1.push(unicorn({
|
|
1996
2023
|
...enableUnicorn === true ? {} : enableUnicorn,
|
|
1997
|
-
overrides:
|
|
2024
|
+
overrides: getOverrides(options, "unicorn")
|
|
1998
2025
|
}));
|
|
1999
2026
|
if (enableImports) configs$1.push(imports({
|
|
2000
|
-
overrides:
|
|
2027
|
+
overrides: getOverrides(options, "imports"),
|
|
2001
2028
|
stylistic: stylisticOptions
|
|
2002
2029
|
}));
|
|
2003
2030
|
if (enableVue) componentExts.push("vue");
|
|
@@ -2034,6 +2061,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2034
2061
|
overrides: getOverrides(options, "react"),
|
|
2035
2062
|
tsconfigPath
|
|
2036
2063
|
}));
|
|
2064
|
+
if (enableNextjs) configs$1.push(nextjs({ overrides: getOverrides(options, "nextjs") }));
|
|
2037
2065
|
if (enableUnoCSS) configs$1.push(unocss({
|
|
2038
2066
|
...resolveSubOptions(options, "unocss"),
|
|
2039
2067
|
overrides: getOverrides(options, "unocss")
|
|
@@ -2092,4 +2120,4 @@ function getOverrides(options, key) {
|
|
|
2092
2120
|
var src_default = lincy;
|
|
2093
2121
|
|
|
2094
2122
|
//#endregion
|
|
2095
|
-
export { 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, StylisticConfigDefaults, combine, comments, src_default as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, lincy, markdown, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
2123
|
+
export { 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, StylisticConfigDefaults, combine, comments, src_default as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, lincy, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincy/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.8.0",
|
|
5
5
|
"description": "LinCenYing's ESLint config",
|
|
6
6
|
"author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@eslint-react/eslint-plugin": "^1.15.0",
|
|
26
|
+
"@next/eslint-plugin-next": "^15.4.0-canary.115",
|
|
26
27
|
"@prettier/plugin-xml": "^3.4.1",
|
|
27
28
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
28
29
|
"eslint": ">=9.5.0",
|
|
@@ -34,6 +35,9 @@
|
|
|
34
35
|
"@eslint-react/eslint-plugin": {
|
|
35
36
|
"optional": true
|
|
36
37
|
},
|
|
38
|
+
"@next/eslint-plugin-next": {
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
37
41
|
"@prettier/plugin-xml": {
|
|
38
42
|
"optional": true
|
|
39
43
|
},
|
|
@@ -54,69 +58,70 @@
|
|
|
54
58
|
"@antfu/install-pkg": "^1.1.0",
|
|
55
59
|
"@clack/prompts": "^0.11.0",
|
|
56
60
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
57
|
-
"@eslint/markdown": "^
|
|
58
|
-
"@stylistic/eslint-plugin": "^5.
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
60
|
-
"@typescript-eslint/parser": "^8.
|
|
61
|
-
"@vitest/eslint-plugin": "^1.
|
|
61
|
+
"@eslint/markdown": "^7.1.0",
|
|
62
|
+
"@stylistic/eslint-plugin": "^5.2.2",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
64
|
+
"@typescript-eslint/parser": "^8.38.0",
|
|
65
|
+
"@vitest/eslint-plugin": "^1.3.4",
|
|
62
66
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
63
67
|
"eslint-flat-config-utils": "^2.1.0",
|
|
64
68
|
"eslint-merge-processors": "^2.0.0",
|
|
65
69
|
"eslint-parser-plain": "^0.1.1",
|
|
66
70
|
"eslint-plugin-antfu": "^3.1.1",
|
|
67
71
|
"eslint-plugin-import-lite": "^0.3.0",
|
|
68
|
-
"eslint-plugin-jsdoc": "^51.
|
|
72
|
+
"eslint-plugin-jsdoc": "^51.4.1",
|
|
69
73
|
"eslint-plugin-jsonc": "^2.20.1",
|
|
70
|
-
"eslint-plugin-n": "^17.
|
|
74
|
+
"eslint-plugin-n": "^17.21.0",
|
|
71
75
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
72
76
|
"eslint-plugin-perfectionist": "^4.15.0",
|
|
73
|
-
"eslint-plugin-pnpm": "^
|
|
77
|
+
"eslint-plugin-pnpm": "^1.1.0",
|
|
74
78
|
"eslint-plugin-regexp": "^2.9.0",
|
|
75
79
|
"eslint-plugin-toml": "^0.12.0",
|
|
76
|
-
"eslint-plugin-unicorn": "^
|
|
80
|
+
"eslint-plugin-unicorn": "^60.0.0",
|
|
77
81
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
78
|
-
"eslint-plugin-vue": "^10.
|
|
82
|
+
"eslint-plugin-vue": "^10.3.0",
|
|
79
83
|
"eslint-plugin-yml": "^1.18.0",
|
|
80
84
|
"eslint-processor-vue-blocks": "^2.0.0",
|
|
81
|
-
"globals": "^16.
|
|
85
|
+
"globals": "^16.3.0",
|
|
82
86
|
"jsonc-eslint-parser": "^2.4.0",
|
|
83
87
|
"local-pkg": "^1.1.1",
|
|
84
88
|
"prompts": "^2.4.2",
|
|
85
89
|
"toml-eslint-parser": "^0.10.0",
|
|
86
|
-
"vue-eslint-parser": "^10.
|
|
90
|
+
"vue-eslint-parser": "^10.2.0",
|
|
87
91
|
"yaml-eslint-parser": "^1.3.0"
|
|
88
92
|
},
|
|
89
93
|
"devDependencies": {
|
|
90
94
|
"@antfu/ni": "^25.0.0",
|
|
91
|
-
"@eslint-react/eslint-plugin": "^1.52.
|
|
95
|
+
"@eslint-react/eslint-plugin": "^1.52.3",
|
|
92
96
|
"@eslint-types/typescript-eslint": "^7.5.0",
|
|
93
97
|
"@eslint-types/unicorn": "^52.0.0",
|
|
94
98
|
"@eslint/config-inspector": "^1.1.0",
|
|
95
|
-
"@
|
|
99
|
+
"@next/eslint-plugin-next": "^15.4.3",
|
|
100
|
+
"@prettier/plugin-xml": "^3.4.2",
|
|
96
101
|
"@stylistic/eslint-plugin-migrate": "^4.4.1",
|
|
97
|
-
"@types/node": "^24.0
|
|
102
|
+
"@types/node": "^24.1.0",
|
|
98
103
|
"@types/react": "^19.1.8",
|
|
99
|
-
"@unocss/eslint-plugin": "^66.
|
|
104
|
+
"@unocss/eslint-plugin": "^66.3.3",
|
|
100
105
|
"bumpp": "^10.2.0",
|
|
101
|
-
"eslint": "^9.
|
|
106
|
+
"eslint": "^9.31.0",
|
|
102
107
|
"eslint-plugin-format": "^1.0.1",
|
|
103
108
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
104
109
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
105
|
-
"eslint-typegen": "^2.2.
|
|
110
|
+
"eslint-typegen": "^2.2.1",
|
|
106
111
|
"esno": "^4.8.0",
|
|
107
112
|
"execa": "^9.6.0",
|
|
108
113
|
"lint-staged": "^16.1.2",
|
|
109
|
-
"prettier": "^3.
|
|
114
|
+
"prettier": "^3.6.2",
|
|
110
115
|
"react": "^19.1.0",
|
|
111
116
|
"simple-git-hooks": "^2.13.0",
|
|
112
117
|
"simple-open-url": "^3.0.1",
|
|
113
118
|
"sucrase": "^3.35.0",
|
|
114
119
|
"tinyglobby": "^0.2.14",
|
|
115
|
-
"tsdown": "^0.
|
|
120
|
+
"tsdown": "^0.13.0",
|
|
116
121
|
"typescript": "^5.8.3",
|
|
117
122
|
"vitest": "^3.2.4",
|
|
118
|
-
"vue": "^3.5.
|
|
119
|
-
"@lincy/eslint-config": "5.
|
|
123
|
+
"vue": "^3.5.18",
|
|
124
|
+
"@lincy/eslint-config": "5.8.0"
|
|
120
125
|
},
|
|
121
126
|
"simple-git-hooks": {
|
|
122
127
|
"pre-commit": "npx lint-staged"
|