@tofrankie/eslint 0.0.8 → 0.0.9
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/index.cjs +27 -7
- package/dist/index.d.cts +0 -7
- package/dist/index.d.mts +0 -7
- package/dist/index.mjs +27 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## eslint@0.0.9 (2026-02-22)
|
|
4
|
+
|
|
5
|
+
- Disable `vue/singleline-html-element-content-newline`, `vue/html-closing-bracket-newline`, `vue/html-indent` to avoid conflicts with Prettier
|
|
6
|
+
- Add `vue/html-self-closing` for consistency with Prettier
|
|
7
|
+
- Add `style/quote-props` for consistency with Prettier
|
|
8
|
+
|
|
3
9
|
## eslint@0.0.8 (2026-02-21)
|
|
4
10
|
|
|
5
11
|
- Update `style/quotes` rule
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @tofrankie/eslint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A shared ESLint configuration based on [@antfu/eslint-config](https://github.com/antfu/eslint-config), with preset rules tailored to personal preferences.
|
|
4
4
|
|
|
5
5
|
> [!IMPORTANT]
|
|
6
6
|
> Rule presets are not yet stable and may change.
|
package/dist/index.cjs
CHANGED
|
@@ -178,6 +178,7 @@ const STYLE_PRESET_RULES = {
|
|
|
178
178
|
allowTemplateLiterals: "avoidEscape"
|
|
179
179
|
}
|
|
180
180
|
],
|
|
181
|
+
"style/quote-props": ["error", "as-needed"],
|
|
181
182
|
"style/arrow-parens": ["error", "as-needed"],
|
|
182
183
|
"style/brace-style": [
|
|
183
184
|
"error",
|
|
@@ -208,6 +209,28 @@ const STYLE_PRESET_RULES = {
|
|
|
208
209
|
*/
|
|
209
210
|
const TEST_PRESET_RULES = { "test/prefer-lowercase-title": "off" };
|
|
210
211
|
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/preset-rules/vue.ts
|
|
214
|
+
/**
|
|
215
|
+
* - rule: `vue/*`
|
|
216
|
+
* - plugin: `eslint-plugin-vue`
|
|
217
|
+
* @see https://eslint.vuejs.org/rules/
|
|
218
|
+
*/
|
|
219
|
+
const VUE_PRESET_RULES = {
|
|
220
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
221
|
+
"vue/html-closing-bracket-newline": "off",
|
|
222
|
+
"vue/html-indent": "off",
|
|
223
|
+
"vue/html-self-closing": ["warn", {
|
|
224
|
+
html: {
|
|
225
|
+
void: "always",
|
|
226
|
+
normal: "always",
|
|
227
|
+
component: "always"
|
|
228
|
+
},
|
|
229
|
+
svg: "always",
|
|
230
|
+
math: "always"
|
|
231
|
+
}]
|
|
232
|
+
};
|
|
233
|
+
|
|
211
234
|
//#endregion
|
|
212
235
|
//#region src/preset-rules/index.ts
|
|
213
236
|
const ALL_PRESET_RULES = {
|
|
@@ -241,6 +264,10 @@ const PRESET_PREDICATES = [
|
|
|
241
264
|
{
|
|
242
265
|
rules: PNPM_PRESET_RULES,
|
|
243
266
|
predicate: notFalse("pnpm")
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
rules: VUE_PRESET_RULES,
|
|
270
|
+
predicate: (options) => options.vue === true
|
|
244
271
|
}
|
|
245
272
|
];
|
|
246
273
|
function buildPresetRules(resolvedOptions) {
|
|
@@ -264,13 +291,6 @@ function notFalse(key) {
|
|
|
264
291
|
/**
|
|
265
292
|
* @param antfuOptions Configures for antfu's config.
|
|
266
293
|
* @param userFlatConfigs From the second arguments they are ESLint Flat Configs, you can have multiple configs.
|
|
267
|
-
*
|
|
268
|
-
* 前提:用户预设优于内置预设,若有相同的 key,则进行覆盖。
|
|
269
|
-
* 1. 排除 rules 的前提下,合并 baseOptions 与 userOptions,得到 mergedOptions
|
|
270
|
-
* 2. 根据 mergedOptions 取预设规则 presetRules,不对用户 rules 作错误兼容
|
|
271
|
-
* 3. 将 presetRules 与 userRules 合并,得到 mergedRules
|
|
272
|
-
* 4. 将 mergedOptions 与 { rules: mergedRules } 合并,得到 resolvedOptions
|
|
273
|
-
* 5. 将 resolvedOptions 作为 antfu 第一个参数
|
|
274
294
|
*/
|
|
275
295
|
function defineConfig(antfuOptions, ...userFlatConfigs) {
|
|
276
296
|
const { rules: userRules, ...userOptionsWithoutRules } = antfuOptions ?? {};
|
package/dist/index.d.cts
CHANGED
|
@@ -10,13 +10,6 @@ type Config = ReturnType<typeof antfu>;
|
|
|
10
10
|
/**
|
|
11
11
|
* @param antfuOptions Configures for antfu's config.
|
|
12
12
|
* @param userFlatConfigs From the second arguments they are ESLint Flat Configs, you can have multiple configs.
|
|
13
|
-
*
|
|
14
|
-
* 前提:用户预设优于内置预设,若有相同的 key,则进行覆盖。
|
|
15
|
-
* 1. 排除 rules 的前提下,合并 baseOptions 与 userOptions,得到 mergedOptions
|
|
16
|
-
* 2. 根据 mergedOptions 取预设规则 presetRules,不对用户 rules 作错误兼容
|
|
17
|
-
* 3. 将 presetRules 与 userRules 合并,得到 mergedRules
|
|
18
|
-
* 4. 将 mergedOptions 与 { rules: mergedRules } 合并,得到 resolvedOptions
|
|
19
|
-
* 5. 将 resolvedOptions 作为 antfu 第一个参数
|
|
20
13
|
*/
|
|
21
14
|
declare function defineConfig(antfuOptions?: AntfuOptions, ...userFlatConfigs: UserFlatConfig[]): Config;
|
|
22
15
|
//#endregion
|
package/dist/index.d.mts
CHANGED
|
@@ -10,13 +10,6 @@ type Config = ReturnType<typeof antfu>;
|
|
|
10
10
|
/**
|
|
11
11
|
* @param antfuOptions Configures for antfu's config.
|
|
12
12
|
* @param userFlatConfigs From the second arguments they are ESLint Flat Configs, you can have multiple configs.
|
|
13
|
-
*
|
|
14
|
-
* 前提:用户预设优于内置预设,若有相同的 key,则进行覆盖。
|
|
15
|
-
* 1. 排除 rules 的前提下,合并 baseOptions 与 userOptions,得到 mergedOptions
|
|
16
|
-
* 2. 根据 mergedOptions 取预设规则 presetRules,不对用户 rules 作错误兼容
|
|
17
|
-
* 3. 将 presetRules 与 userRules 合并,得到 mergedRules
|
|
18
|
-
* 4. 将 mergedOptions 与 { rules: mergedRules } 合并,得到 resolvedOptions
|
|
19
|
-
* 5. 将 resolvedOptions 作为 antfu 第一个参数
|
|
20
13
|
*/
|
|
21
14
|
declare function defineConfig(antfuOptions?: AntfuOptions, ...userFlatConfigs: UserFlatConfig[]): Config;
|
|
22
15
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -149,6 +149,7 @@ const STYLE_PRESET_RULES = {
|
|
|
149
149
|
allowTemplateLiterals: "avoidEscape"
|
|
150
150
|
}
|
|
151
151
|
],
|
|
152
|
+
"style/quote-props": ["error", "as-needed"],
|
|
152
153
|
"style/arrow-parens": ["error", "as-needed"],
|
|
153
154
|
"style/brace-style": [
|
|
154
155
|
"error",
|
|
@@ -179,6 +180,28 @@ const STYLE_PRESET_RULES = {
|
|
|
179
180
|
*/
|
|
180
181
|
const TEST_PRESET_RULES = { "test/prefer-lowercase-title": "off" };
|
|
181
182
|
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/preset-rules/vue.ts
|
|
185
|
+
/**
|
|
186
|
+
* - rule: `vue/*`
|
|
187
|
+
* - plugin: `eslint-plugin-vue`
|
|
188
|
+
* @see https://eslint.vuejs.org/rules/
|
|
189
|
+
*/
|
|
190
|
+
const VUE_PRESET_RULES = {
|
|
191
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
192
|
+
"vue/html-closing-bracket-newline": "off",
|
|
193
|
+
"vue/html-indent": "off",
|
|
194
|
+
"vue/html-self-closing": ["warn", {
|
|
195
|
+
html: {
|
|
196
|
+
void: "always",
|
|
197
|
+
normal: "always",
|
|
198
|
+
component: "always"
|
|
199
|
+
},
|
|
200
|
+
svg: "always",
|
|
201
|
+
math: "always"
|
|
202
|
+
}]
|
|
203
|
+
};
|
|
204
|
+
|
|
182
205
|
//#endregion
|
|
183
206
|
//#region src/preset-rules/index.ts
|
|
184
207
|
const ALL_PRESET_RULES = {
|
|
@@ -212,6 +235,10 @@ const PRESET_PREDICATES = [
|
|
|
212
235
|
{
|
|
213
236
|
rules: PNPM_PRESET_RULES,
|
|
214
237
|
predicate: notFalse("pnpm")
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
rules: VUE_PRESET_RULES,
|
|
241
|
+
predicate: (options) => options.vue === true
|
|
215
242
|
}
|
|
216
243
|
];
|
|
217
244
|
function buildPresetRules(resolvedOptions) {
|
|
@@ -235,13 +262,6 @@ function notFalse(key) {
|
|
|
235
262
|
/**
|
|
236
263
|
* @param antfuOptions Configures for antfu's config.
|
|
237
264
|
* @param userFlatConfigs From the second arguments they are ESLint Flat Configs, you can have multiple configs.
|
|
238
|
-
*
|
|
239
|
-
* 前提:用户预设优于内置预设,若有相同的 key,则进行覆盖。
|
|
240
|
-
* 1. 排除 rules 的前提下,合并 baseOptions 与 userOptions,得到 mergedOptions
|
|
241
|
-
* 2. 根据 mergedOptions 取预设规则 presetRules,不对用户 rules 作错误兼容
|
|
242
|
-
* 3. 将 presetRules 与 userRules 合并,得到 mergedRules
|
|
243
|
-
* 4. 将 mergedOptions 与 { rules: mergedRules } 合并,得到 resolvedOptions
|
|
244
|
-
* 5. 将 resolvedOptions 作为 antfu 第一个参数
|
|
245
265
|
*/
|
|
246
266
|
function defineConfig(antfuOptions, ...userFlatConfigs) {
|
|
247
267
|
const { rules: userRules, ...userOptionsWithoutRules } = antfuOptions ?? {};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tofrankie/eslint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"description": "Shared ESLint configuration
|
|
4
|
+
"version": "0.0.9",
|
|
5
|
+
"description": "Shared ESLint configuration",
|
|
6
6
|
"author": "Frankie <1426203851@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://github.com/tofrankie/config/tree/main/packages/eslint",
|