@tofrankie/eslint 0.0.7 → 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 +10 -0
- package/README.md +1 -1
- package/dist/index.cjs +31 -8
- package/dist/index.d.cts +0 -7
- package/dist/index.d.mts +0 -7
- package/dist/index.mjs +31 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
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
|
+
|
|
9
|
+
## eslint@0.0.8 (2026-02-21)
|
|
10
|
+
|
|
11
|
+
- Update `style/quotes` rule
|
|
12
|
+
|
|
3
13
|
## eslint@0.0.7 (2026-02-21)
|
|
4
14
|
|
|
5
15
|
- Update `style/operator-linebreak` 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
|
@@ -173,8 +173,12 @@ const STYLE_PRESET_RULES = {
|
|
|
173
173
|
"style/quotes": [
|
|
174
174
|
"error",
|
|
175
175
|
"single",
|
|
176
|
-
{
|
|
176
|
+
{
|
|
177
|
+
avoidEscape: true,
|
|
178
|
+
allowTemplateLiterals: "avoidEscape"
|
|
179
|
+
}
|
|
177
180
|
],
|
|
181
|
+
"style/quote-props": ["error", "as-needed"],
|
|
178
182
|
"style/arrow-parens": ["error", "as-needed"],
|
|
179
183
|
"style/brace-style": [
|
|
180
184
|
"error",
|
|
@@ -205,6 +209,28 @@ const STYLE_PRESET_RULES = {
|
|
|
205
209
|
*/
|
|
206
210
|
const TEST_PRESET_RULES = { "test/prefer-lowercase-title": "off" };
|
|
207
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
|
+
|
|
208
234
|
//#endregion
|
|
209
235
|
//#region src/preset-rules/index.ts
|
|
210
236
|
const ALL_PRESET_RULES = {
|
|
@@ -238,6 +264,10 @@ const PRESET_PREDICATES = [
|
|
|
238
264
|
{
|
|
239
265
|
rules: PNPM_PRESET_RULES,
|
|
240
266
|
predicate: notFalse("pnpm")
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
rules: VUE_PRESET_RULES,
|
|
270
|
+
predicate: (options) => options.vue === true
|
|
241
271
|
}
|
|
242
272
|
];
|
|
243
273
|
function buildPresetRules(resolvedOptions) {
|
|
@@ -261,13 +291,6 @@ function notFalse(key) {
|
|
|
261
291
|
/**
|
|
262
292
|
* @param antfuOptions Configures for antfu's config.
|
|
263
293
|
* @param userFlatConfigs From the second arguments they are ESLint Flat Configs, you can have multiple configs.
|
|
264
|
-
*
|
|
265
|
-
* 前提:用户预设优于内置预设,若有相同的 key,则进行覆盖。
|
|
266
|
-
* 1. 排除 rules 的前提下,合并 baseOptions 与 userOptions,得到 mergedOptions
|
|
267
|
-
* 2. 根据 mergedOptions 取预设规则 presetRules,不对用户 rules 作错误兼容
|
|
268
|
-
* 3. 将 presetRules 与 userRules 合并,得到 mergedRules
|
|
269
|
-
* 4. 将 mergedOptions 与 { rules: mergedRules } 合并,得到 resolvedOptions
|
|
270
|
-
* 5. 将 resolvedOptions 作为 antfu 第一个参数
|
|
271
294
|
*/
|
|
272
295
|
function defineConfig(antfuOptions, ...userFlatConfigs) {
|
|
273
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
|
@@ -144,8 +144,12 @@ const STYLE_PRESET_RULES = {
|
|
|
144
144
|
"style/quotes": [
|
|
145
145
|
"error",
|
|
146
146
|
"single",
|
|
147
|
-
{
|
|
147
|
+
{
|
|
148
|
+
avoidEscape: true,
|
|
149
|
+
allowTemplateLiterals: "avoidEscape"
|
|
150
|
+
}
|
|
148
151
|
],
|
|
152
|
+
"style/quote-props": ["error", "as-needed"],
|
|
149
153
|
"style/arrow-parens": ["error", "as-needed"],
|
|
150
154
|
"style/brace-style": [
|
|
151
155
|
"error",
|
|
@@ -176,6 +180,28 @@ const STYLE_PRESET_RULES = {
|
|
|
176
180
|
*/
|
|
177
181
|
const TEST_PRESET_RULES = { "test/prefer-lowercase-title": "off" };
|
|
178
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
|
+
|
|
179
205
|
//#endregion
|
|
180
206
|
//#region src/preset-rules/index.ts
|
|
181
207
|
const ALL_PRESET_RULES = {
|
|
@@ -209,6 +235,10 @@ const PRESET_PREDICATES = [
|
|
|
209
235
|
{
|
|
210
236
|
rules: PNPM_PRESET_RULES,
|
|
211
237
|
predicate: notFalse("pnpm")
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
rules: VUE_PRESET_RULES,
|
|
241
|
+
predicate: (options) => options.vue === true
|
|
212
242
|
}
|
|
213
243
|
];
|
|
214
244
|
function buildPresetRules(resolvedOptions) {
|
|
@@ -232,13 +262,6 @@ function notFalse(key) {
|
|
|
232
262
|
/**
|
|
233
263
|
* @param antfuOptions Configures for antfu's config.
|
|
234
264
|
* @param userFlatConfigs From the second arguments they are ESLint Flat Configs, you can have multiple configs.
|
|
235
|
-
*
|
|
236
|
-
* 前提:用户预设优于内置预设,若有相同的 key,则进行覆盖。
|
|
237
|
-
* 1. 排除 rules 的前提下,合并 baseOptions 与 userOptions,得到 mergedOptions
|
|
238
|
-
* 2. 根据 mergedOptions 取预设规则 presetRules,不对用户 rules 作错误兼容
|
|
239
|
-
* 3. 将 presetRules 与 userRules 合并,得到 mergedRules
|
|
240
|
-
* 4. 将 mergedOptions 与 { rules: mergedRules } 合并,得到 resolvedOptions
|
|
241
|
-
* 5. 将 resolvedOptions 作为 antfu 第一个参数
|
|
242
265
|
*/
|
|
243
266
|
function defineConfig(antfuOptions, ...userFlatConfigs) {
|
|
244
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",
|