@july_cm/eslint-config 2.4.2 → 2.5.1
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 +66 -57
- package/README.zh-CN.md +67 -58
- package/dist/index.cjs +274 -0
- package/dist/index.js +237 -0
- package/package.json +43 -32
- package/lib/index.cjs +0 -201
- package/lib/index.mjs +0 -201
package/lib/index.mjs
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "eslint/config";
|
|
2
|
-
import css$1 from "@eslint/css";
|
|
3
|
-
import prettier from "eslint-plugin-prettier";
|
|
4
|
-
import { tailwind4 } from "tailwind-csstree";
|
|
5
|
-
import eslintJs from "@eslint/js";
|
|
6
|
-
import eslintPluginImport from "eslint-plugin-import";
|
|
7
|
-
import recommended$1 from "eslint-plugin-prettier/recommended";
|
|
8
|
-
import eslintPluginJsonc from "eslint-plugin-jsonc";
|
|
9
|
-
import { configs } from "typescript-eslint";
|
|
10
|
-
const cssConfig = defineConfig([
|
|
11
|
-
{
|
|
12
|
-
files: ["**/*.css"],
|
|
13
|
-
plugins: { css: css$1, prettier },
|
|
14
|
-
language: "css/css",
|
|
15
|
-
languageOptions: {
|
|
16
|
-
customSyntax: tailwind4
|
|
17
|
-
},
|
|
18
|
-
rules: {
|
|
19
|
-
"css/no-empty-blocks": "error",
|
|
20
|
-
"prettier/prettier": [
|
|
21
|
-
"warn",
|
|
22
|
-
{
|
|
23
|
-
tabWidth: 2
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
usePrettierrc: false
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
]);
|
|
32
|
-
const prettierConfig = [
|
|
33
|
-
recommended$1,
|
|
34
|
-
{
|
|
35
|
-
rules: {
|
|
36
|
-
"prettier/prettier": [
|
|
37
|
-
"warn",
|
|
38
|
-
{
|
|
39
|
-
// 优先使用单引号
|
|
40
|
-
singleQuote: true,
|
|
41
|
-
printWidth: 110,
|
|
42
|
-
// 需要分号
|
|
43
|
-
semi: true,
|
|
44
|
-
// 仅在 es5 中有效的结构尾随逗号
|
|
45
|
-
trailingComma: "es5"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
// 不读取 prettier 配置文件,统一走 eslint 配置
|
|
49
|
-
usePrettierrc: false
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
];
|
|
55
|
-
const javascriptConfig = defineConfig({
|
|
56
|
-
extends: [eslintJs.configs.recommended, eslintPluginImport.flatConfigs.recommended, ...prettierConfig],
|
|
57
|
-
files: ["**/*.{js,mjs,cjs,jsx}"],
|
|
58
|
-
languageOptions: {
|
|
59
|
-
ecmaVersion: "latest"
|
|
60
|
-
},
|
|
61
|
-
rules: {
|
|
62
|
-
"import/order": [
|
|
63
|
-
"warn",
|
|
64
|
-
{
|
|
65
|
-
groups: ["builtin", "external", "internal", ["parent", "sibling"], "object", "type", "index"],
|
|
66
|
-
"newlines-between": "always",
|
|
67
|
-
pathGroupsExcludedImportTypes: ["builtin"],
|
|
68
|
-
alphabetize: { order: "asc", caseInsensitive: true },
|
|
69
|
-
pathGroups: [
|
|
70
|
-
{
|
|
71
|
-
pattern: "react**",
|
|
72
|
-
group: "external",
|
|
73
|
-
position: "before"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
pattern: "{@/**,@**}",
|
|
77
|
-
group: "internal",
|
|
78
|
-
position: "before"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
pattern: "**/*.{scss,json,svg,css,less}",
|
|
82
|
-
group: "index",
|
|
83
|
-
position: "after"
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
},
|
|
89
|
-
settings: {
|
|
90
|
-
"import/resolver": {
|
|
91
|
-
node: true,
|
|
92
|
-
/**
|
|
93
|
-
* https://github.com/import-js/eslint-plugin-import/issues/3140
|
|
94
|
-
* eslint-plugin-import-node 解析器不支持 export 字段,所以不得不使用 eslint-plugin-import-typescript
|
|
95
|
-
*/
|
|
96
|
-
typescript: true
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
const packageJsonConfig = defineConfig({
|
|
101
|
-
extends: [...eslintPluginJsonc.configs["flat/prettier"]],
|
|
102
|
-
files: ["package.json"],
|
|
103
|
-
rules: {
|
|
104
|
-
"jsonc/sort-keys": [
|
|
105
|
-
"warn",
|
|
106
|
-
{
|
|
107
|
-
pathPattern: "^$",
|
|
108
|
-
order: [
|
|
109
|
-
"name",
|
|
110
|
-
"version",
|
|
111
|
-
"author",
|
|
112
|
-
"exports",
|
|
113
|
-
"types",
|
|
114
|
-
"main",
|
|
115
|
-
"module",
|
|
116
|
-
"scripts",
|
|
117
|
-
"dependencies",
|
|
118
|
-
"devDependencies"
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
|
|
123
|
-
order: { type: "asc" }
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
pathPattern: "exports",
|
|
127
|
-
// Prefer ESM (import) before CommonJS (require)
|
|
128
|
-
order: ["types", "import", "require"]
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
const typescriptConfig = defineConfig({
|
|
134
|
-
extends: [
|
|
135
|
-
eslintJs.configs.recommended,
|
|
136
|
-
configs.stylistic,
|
|
137
|
-
eslintPluginImport.flatConfigs.recommended,
|
|
138
|
-
eslintPluginImport.flatConfigs.typescript,
|
|
139
|
-
prettierConfig
|
|
140
|
-
],
|
|
141
|
-
files: ["**/*.{ts,tsx}"],
|
|
142
|
-
rules: {
|
|
143
|
-
"import/order": [
|
|
144
|
-
"warn",
|
|
145
|
-
{
|
|
146
|
-
groups: ["builtin", "external", "internal", ["parent", "sibling"], "object", "type", "index"],
|
|
147
|
-
"newlines-between": "always",
|
|
148
|
-
pathGroupsExcludedImportTypes: ["builtin"],
|
|
149
|
-
alphabetize: { order: "asc", caseInsensitive: true },
|
|
150
|
-
pathGroups: [
|
|
151
|
-
{
|
|
152
|
-
pattern: "react**",
|
|
153
|
-
group: "external",
|
|
154
|
-
position: "before"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
pattern: "{@/**,@**}",
|
|
158
|
-
group: "internal",
|
|
159
|
-
position: "before"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
pattern: "**/*.{scss,json,svg,css,less}",
|
|
163
|
-
group: "index",
|
|
164
|
-
position: "after"
|
|
165
|
-
}
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
],
|
|
169
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
170
|
-
"error",
|
|
171
|
-
{ disallowTypeAnnotations: true, prefer: "type-imports" }
|
|
172
|
-
],
|
|
173
|
-
"@typescript-eslint/no-explicit-any": ["warn"]
|
|
174
|
-
},
|
|
175
|
-
settings: {
|
|
176
|
-
"import/resolver": {
|
|
177
|
-
node: true,
|
|
178
|
-
typescript: true
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
const recommended = defineConfig(javascriptConfig, typescriptConfig, packageJsonConfig, cssConfig);
|
|
183
|
-
const javascript = javascriptConfig;
|
|
184
|
-
const typescript = typescriptConfig;
|
|
185
|
-
const packageJson = packageJsonConfig;
|
|
186
|
-
const css = cssConfig;
|
|
187
|
-
const index = {
|
|
188
|
-
recommended,
|
|
189
|
-
javascript,
|
|
190
|
-
typescript,
|
|
191
|
-
packageJson,
|
|
192
|
-
css
|
|
193
|
-
};
|
|
194
|
-
export {
|
|
195
|
-
css,
|
|
196
|
-
index as default,
|
|
197
|
-
javascript,
|
|
198
|
-
packageJson,
|
|
199
|
-
recommended,
|
|
200
|
-
typescript
|
|
201
|
-
};
|