@tofrankie/eslint 0.0.14 → 0.0.16

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## eslint@0.0.16 (2026-03-24)
4
+
5
+ - Add `unicorn/number-literal-case` rule
6
+ - Update `style/operator-linebreak` rule
7
+ - Disable `e18e/ban-dependencies`、`e18e/prefer-array-to-sorted`、`e18e/prefer-static-regex` rules
8
+
9
+ ## eslint@0.0.15 (2026-03-17)
10
+
11
+ - Require Node.js 20.x (`engines: ^20.0.0 || ^22.0.0 || ^24.0.0`)
12
+ - Update `@antfu/eslint-config` to `v7.7.3`
13
+
3
14
  ## eslint@0.0.14 (2026-03-14)
4
15
 
5
16
  - Move `@antfu/eslint-config` from `peerDependencies` to `dependencies`
package/README.md CHANGED
@@ -21,6 +21,28 @@ import { defineConfig } from '@tofrankie/eslint'
21
21
  export default defineConfig()
22
22
  ```
23
23
 
24
+ 更多自定义
25
+
26
+ ```js
27
+ import { defineConfig } from '@tofrankie/eslint'
28
+
29
+ export default defineConfig(
30
+ {
31
+ // antfu options... see: https://github.com/antfu/eslint-config#customization
32
+ ignores: ['node_modules', 'dist'],
33
+ typescript: true,
34
+ react: true,
35
+ rules: {
36
+ // user's custom rules...
37
+ 'no-console': 'off',
38
+ },
39
+ },
40
+ {
41
+ // user's eslint flat configs...
42
+ }
43
+ )
44
+ ```
45
+
24
46
  ## Configuration Examples
25
47
 
26
48
  ### Miniapp
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -7,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
20
16
  }
21
17
  return to;
22
18
  };
@@ -24,13 +20,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
20
  value: mod,
25
21
  enumerable: true
26
22
  }) : target, mod));
27
-
28
23
  //#endregion
29
24
  let _antfu_eslint_config = require("@antfu/eslint-config");
30
25
  let lodash_merge = require("lodash.merge");
31
26
  lodash_merge = __toESM(lodash_merge);
32
27
  let eslint_plugin_jsdoc = require("eslint-plugin-jsdoc");
33
-
34
28
  //#region src/preset-configs/jsdoc.ts
35
29
  const SHARED_RULES = {
36
30
  "jsdoc/check-syntax": "error",
@@ -49,7 +43,7 @@ const SHARED_SETTINGS = { tagNamePreference: {
49
43
  property: "prop",
50
44
  returns: "return"
51
45
  } };
52
- const JSDOC_JS_CONFIG = (0, eslint_plugin_jsdoc.jsdoc)({
46
+ const JSDOC_PRESET_CONFIG = [(0, eslint_plugin_jsdoc.jsdoc)({
53
47
  config: "flat/recommended-typescript-flavor-error",
54
48
  files: [
55
49
  "**/*.js",
@@ -62,8 +56,7 @@ const JSDOC_JS_CONFIG = (0, eslint_plugin_jsdoc.jsdoc)({
62
56
  "jsdoc/require-param-type": "warn"
63
57
  },
64
58
  settings: SHARED_SETTINGS
65
- });
66
- const JSDOC_TS_CONFIG = (0, eslint_plugin_jsdoc.jsdoc)({
59
+ }), (0, eslint_plugin_jsdoc.jsdoc)({
67
60
  config: "flat/recommended-typescript-error",
68
61
  files: [
69
62
  "**/*.ts",
@@ -76,9 +69,7 @@ const JSDOC_TS_CONFIG = (0, eslint_plugin_jsdoc.jsdoc)({
76
69
  "jsdoc/require-param-type": "off"
77
70
  },
78
71
  settings: SHARED_SETTINGS
79
- });
80
- const JSDOC_PRESET_CONFIG = [JSDOC_JS_CONFIG, JSDOC_TS_CONFIG];
81
-
72
+ })];
82
73
  //#endregion
83
74
  //#region src/preset-configs/typescript.ts
84
75
  const TYPESCRIPT_PRESET_CONFIG = {
@@ -96,7 +87,6 @@ const TYPESCRIPT_PRESET_CONFIG = {
96
87
  }]
97
88
  }
98
89
  };
99
-
100
90
  //#endregion
101
91
  //#region src/preset-rules/antfu.ts
102
92
  /**
@@ -109,7 +99,6 @@ const ANTFU_PRESET_RULES = {
109
99
  "antfu/if-newline": "off",
110
100
  "antfu/consistent-list-newline": "off"
111
101
  };
112
-
113
102
  //#endregion
114
103
  //#region src/preset-rules/base.ts
115
104
  /**
@@ -129,7 +118,18 @@ const BASE_PRESET_RULES = {
129
118
  ignoreRestSiblings: true
130
119
  }]
131
120
  };
132
-
121
+ //#endregion
122
+ //#region src/preset-rules/e8e.ts
123
+ /**
124
+ * - rule: `e8e/*`
125
+ * - plugin: `@e18e/eslint-plugin`
126
+ * @see https://github.com/e18e/eslint-plugin
127
+ */
128
+ const E8E_PRESET_RULES = {
129
+ "e18e/ban-dependencies": "off",
130
+ "e18e/prefer-array-to-sorted": "off",
131
+ "e18e/prefer-static-regex": "off"
132
+ };
133
133
  //#endregion
134
134
  //#region src/preset-rules/eslint-comments.ts
135
135
  /**
@@ -139,7 +139,6 @@ const BASE_PRESET_RULES = {
139
139
  * @see https://github.com/eslint-community/eslint-plugin-eslint-comments
140
140
  */
141
141
  const ESLINT_COMMENTS_PRESET_RULES = { "eslint-comments/no-unlimited-disable": "off" };
142
-
143
142
  //#endregion
144
143
  //#region src/preset-rules/node.ts
145
144
  /**
@@ -150,7 +149,6 @@ const ESLINT_COMMENTS_PRESET_RULES = { "eslint-comments/no-unlimited-disable": "
150
149
  * @see https://github.com/eslint-community/eslint-plugin-n
151
150
  */
152
151
  const NODE_PRESET_RULES = { "node/prefer-global/process": "off" };
153
-
154
152
  //#endregion
155
153
  //#region src/preset-rules/pnpm.ts
156
154
  /**
@@ -160,7 +158,6 @@ const NODE_PRESET_RULES = { "node/prefer-global/process": "off" };
160
158
  * @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm
161
159
  */
162
160
  const PNPM_PRESET_RULES = { "pnpm/yaml-enforce-settings": "off" };
163
-
164
161
  //#endregion
165
162
  //#region src/preset-rules/react.ts
166
163
  /**
@@ -169,7 +166,6 @@ const PNPM_PRESET_RULES = { "pnpm/yaml-enforce-settings": "off" };
169
166
  * @see https://www.npmjs.com/package/eslint-plugin-react-hooks-extra
170
167
  */
171
168
  const REACT_PRESET_RULES = { "react-hooks-extra/no-direct-set-state-in-use-effect": "off" };
172
-
173
169
  //#endregion
174
170
  //#region src/preset-rules/style.ts
175
171
  /**
@@ -205,7 +201,12 @@ const STYLE_PRESET_RULES = {
205
201
  "=": "after",
206
202
  "+": "after",
207
203
  "-": "after",
208
- "&": "after"
204
+ "*": "after",
205
+ "&": "after",
206
+ "<": "after",
207
+ "<=": "after",
208
+ ">": "after",
209
+ ">=": "after"
209
210
  } }
210
211
  ],
211
212
  "style/member-delimiter-style": ["error", {
@@ -231,7 +232,6 @@ const STYLE_PRESET_RULES = {
231
232
  "style/jsx-curly-newline": "off",
232
233
  "style/jsx-one-expression-per-line": "off"
233
234
  };
234
-
235
235
  //#endregion
236
236
  //#region src/preset-rules/test.ts
237
237
  /**
@@ -243,7 +243,14 @@ const STYLE_PRESET_RULES = {
243
243
  * @see https://github.com/levibuzolic/eslint-plugin-no-only-tests
244
244
  */
245
245
  const TEST_PRESET_RULES = { "test/prefer-lowercase-title": "off" };
246
-
246
+ //#endregion
247
+ //#region src/preset-rules/unicorn.ts
248
+ /**
249
+ * - rule: `unicorn/*`
250
+ * - plugin: `eslint-plugin-unicorn`
251
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn
252
+ */
253
+ const UNICORN_PRESET_RULES = { "unicorn/number-literal-case": ["error", { hexadecimalValue: "lowercase" }] };
247
254
  //#endregion
248
255
  //#region src/preset-rules/vue.ts
249
256
  /**
@@ -265,18 +272,19 @@ const VUE_PRESET_RULES = {
265
272
  math: "always"
266
273
  }]
267
274
  };
268
-
269
- //#endregion
270
- //#region src/preset-rules/index.ts
271
- const ALL_PRESET_RULES = {
275
+ ({
272
276
  ...ANTFU_PRESET_RULES,
273
277
  ...BASE_PRESET_RULES,
278
+ ...E8E_PRESET_RULES,
274
279
  ...ESLINT_COMMENTS_PRESET_RULES,
275
280
  ...NODE_PRESET_RULES,
276
281
  ...PNPM_PRESET_RULES,
282
+ ...REACT_PRESET_RULES,
277
283
  ...STYLE_PRESET_RULES,
278
- ...TEST_PRESET_RULES
279
- };
284
+ ...TEST_PRESET_RULES,
285
+ ...UNICORN_PRESET_RULES,
286
+ ...VUE_PRESET_RULES
287
+ });
280
288
  const PRESET_PREDICATES = [
281
289
  { rules: BASE_PRESET_RULES },
282
290
  { rules: ESLINT_COMMENTS_PRESET_RULES },
@@ -307,7 +315,9 @@ const PRESET_PREDICATES = [
307
315
  {
308
316
  rules: REACT_PRESET_RULES,
309
317
  predicate: (options) => options.react === true
310
- }
318
+ },
319
+ { rules: E8E_PRESET_RULES },
320
+ { rules: UNICORN_PRESET_RULES }
311
321
  ];
312
322
  function buildPresetRules(resolvedOptions) {
313
323
  return PRESET_PREDICATES.reduce((acc, { rules, predicate }) => {
@@ -324,7 +334,6 @@ function buildPresetRules(resolvedOptions) {
324
334
  function notFalse(key) {
325
335
  return (options) => options[key] !== false;
326
336
  }
327
-
328
337
  //#endregion
329
338
  //#region src/config.ts
330
339
  /**
@@ -350,6 +359,5 @@ function defineConfig(antfuOptions, ...userFlatConfigs) {
350
359
  if (mergedOptions.jsdoc !== false) presetConfigs.push(...JSDOC_PRESET_CONFIG);
351
360
  return (0, _antfu_eslint_config.antfu)(resolvedOptions, ...presetConfigs, ...userFlatConfigs);
352
361
  }
353
-
354
362
  //#endregion
355
- exports.defineConfig = defineConfig;
363
+ exports.defineConfig = defineConfig;
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { antfu } from "@antfu/eslint-config";
2
2
  import merge from "lodash.merge";
3
3
  import { jsdoc } from "eslint-plugin-jsdoc";
4
-
5
4
  //#region src/preset-configs/jsdoc.ts
6
5
  const SHARED_RULES = {
7
6
  "jsdoc/check-syntax": "error",
@@ -20,7 +19,7 @@ const SHARED_SETTINGS = { tagNamePreference: {
20
19
  property: "prop",
21
20
  returns: "return"
22
21
  } };
23
- const JSDOC_JS_CONFIG = jsdoc({
22
+ const JSDOC_PRESET_CONFIG = [jsdoc({
24
23
  config: "flat/recommended-typescript-flavor-error",
25
24
  files: [
26
25
  "**/*.js",
@@ -33,8 +32,7 @@ const JSDOC_JS_CONFIG = jsdoc({
33
32
  "jsdoc/require-param-type": "warn"
34
33
  },
35
34
  settings: SHARED_SETTINGS
36
- });
37
- const JSDOC_TS_CONFIG = jsdoc({
35
+ }), jsdoc({
38
36
  config: "flat/recommended-typescript-error",
39
37
  files: [
40
38
  "**/*.ts",
@@ -47,9 +45,7 @@ const JSDOC_TS_CONFIG = jsdoc({
47
45
  "jsdoc/require-param-type": "off"
48
46
  },
49
47
  settings: SHARED_SETTINGS
50
- });
51
- const JSDOC_PRESET_CONFIG = [JSDOC_JS_CONFIG, JSDOC_TS_CONFIG];
52
-
48
+ })];
53
49
  //#endregion
54
50
  //#region src/preset-configs/typescript.ts
55
51
  const TYPESCRIPT_PRESET_CONFIG = {
@@ -67,7 +63,6 @@ const TYPESCRIPT_PRESET_CONFIG = {
67
63
  }]
68
64
  }
69
65
  };
70
-
71
66
  //#endregion
72
67
  //#region src/preset-rules/antfu.ts
73
68
  /**
@@ -80,7 +75,6 @@ const ANTFU_PRESET_RULES = {
80
75
  "antfu/if-newline": "off",
81
76
  "antfu/consistent-list-newline": "off"
82
77
  };
83
-
84
78
  //#endregion
85
79
  //#region src/preset-rules/base.ts
86
80
  /**
@@ -100,7 +94,18 @@ const BASE_PRESET_RULES = {
100
94
  ignoreRestSiblings: true
101
95
  }]
102
96
  };
103
-
97
+ //#endregion
98
+ //#region src/preset-rules/e8e.ts
99
+ /**
100
+ * - rule: `e8e/*`
101
+ * - plugin: `@e18e/eslint-plugin`
102
+ * @see https://github.com/e18e/eslint-plugin
103
+ */
104
+ const E8E_PRESET_RULES = {
105
+ "e18e/ban-dependencies": "off",
106
+ "e18e/prefer-array-to-sorted": "off",
107
+ "e18e/prefer-static-regex": "off"
108
+ };
104
109
  //#endregion
105
110
  //#region src/preset-rules/eslint-comments.ts
106
111
  /**
@@ -110,7 +115,6 @@ const BASE_PRESET_RULES = {
110
115
  * @see https://github.com/eslint-community/eslint-plugin-eslint-comments
111
116
  */
112
117
  const ESLINT_COMMENTS_PRESET_RULES = { "eslint-comments/no-unlimited-disable": "off" };
113
-
114
118
  //#endregion
115
119
  //#region src/preset-rules/node.ts
116
120
  /**
@@ -121,7 +125,6 @@ const ESLINT_COMMENTS_PRESET_RULES = { "eslint-comments/no-unlimited-disable": "
121
125
  * @see https://github.com/eslint-community/eslint-plugin-n
122
126
  */
123
127
  const NODE_PRESET_RULES = { "node/prefer-global/process": "off" };
124
-
125
128
  //#endregion
126
129
  //#region src/preset-rules/pnpm.ts
127
130
  /**
@@ -131,7 +134,6 @@ const NODE_PRESET_RULES = { "node/prefer-global/process": "off" };
131
134
  * @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm
132
135
  */
133
136
  const PNPM_PRESET_RULES = { "pnpm/yaml-enforce-settings": "off" };
134
-
135
137
  //#endregion
136
138
  //#region src/preset-rules/react.ts
137
139
  /**
@@ -140,7 +142,6 @@ const PNPM_PRESET_RULES = { "pnpm/yaml-enforce-settings": "off" };
140
142
  * @see https://www.npmjs.com/package/eslint-plugin-react-hooks-extra
141
143
  */
142
144
  const REACT_PRESET_RULES = { "react-hooks-extra/no-direct-set-state-in-use-effect": "off" };
143
-
144
145
  //#endregion
145
146
  //#region src/preset-rules/style.ts
146
147
  /**
@@ -176,7 +177,12 @@ const STYLE_PRESET_RULES = {
176
177
  "=": "after",
177
178
  "+": "after",
178
179
  "-": "after",
179
- "&": "after"
180
+ "*": "after",
181
+ "&": "after",
182
+ "<": "after",
183
+ "<=": "after",
184
+ ">": "after",
185
+ ">=": "after"
180
186
  } }
181
187
  ],
182
188
  "style/member-delimiter-style": ["error", {
@@ -202,7 +208,6 @@ const STYLE_PRESET_RULES = {
202
208
  "style/jsx-curly-newline": "off",
203
209
  "style/jsx-one-expression-per-line": "off"
204
210
  };
205
-
206
211
  //#endregion
207
212
  //#region src/preset-rules/test.ts
208
213
  /**
@@ -214,7 +219,14 @@ const STYLE_PRESET_RULES = {
214
219
  * @see https://github.com/levibuzolic/eslint-plugin-no-only-tests
215
220
  */
216
221
  const TEST_PRESET_RULES = { "test/prefer-lowercase-title": "off" };
217
-
222
+ //#endregion
223
+ //#region src/preset-rules/unicorn.ts
224
+ /**
225
+ * - rule: `unicorn/*`
226
+ * - plugin: `eslint-plugin-unicorn`
227
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn
228
+ */
229
+ const UNICORN_PRESET_RULES = { "unicorn/number-literal-case": ["error", { hexadecimalValue: "lowercase" }] };
218
230
  //#endregion
219
231
  //#region src/preset-rules/vue.ts
220
232
  /**
@@ -236,18 +248,19 @@ const VUE_PRESET_RULES = {
236
248
  math: "always"
237
249
  }]
238
250
  };
239
-
240
- //#endregion
241
- //#region src/preset-rules/index.ts
242
- const ALL_PRESET_RULES = {
251
+ ({
243
252
  ...ANTFU_PRESET_RULES,
244
253
  ...BASE_PRESET_RULES,
254
+ ...E8E_PRESET_RULES,
245
255
  ...ESLINT_COMMENTS_PRESET_RULES,
246
256
  ...NODE_PRESET_RULES,
247
257
  ...PNPM_PRESET_RULES,
258
+ ...REACT_PRESET_RULES,
248
259
  ...STYLE_PRESET_RULES,
249
- ...TEST_PRESET_RULES
250
- };
260
+ ...TEST_PRESET_RULES,
261
+ ...UNICORN_PRESET_RULES,
262
+ ...VUE_PRESET_RULES
263
+ });
251
264
  const PRESET_PREDICATES = [
252
265
  { rules: BASE_PRESET_RULES },
253
266
  { rules: ESLINT_COMMENTS_PRESET_RULES },
@@ -278,7 +291,9 @@ const PRESET_PREDICATES = [
278
291
  {
279
292
  rules: REACT_PRESET_RULES,
280
293
  predicate: (options) => options.react === true
281
- }
294
+ },
295
+ { rules: E8E_PRESET_RULES },
296
+ { rules: UNICORN_PRESET_RULES }
282
297
  ];
283
298
  function buildPresetRules(resolvedOptions) {
284
299
  return PRESET_PREDICATES.reduce((acc, { rules, predicate }) => {
@@ -295,7 +310,6 @@ function buildPresetRules(resolvedOptions) {
295
310
  function notFalse(key) {
296
311
  return (options) => options[key] !== false;
297
312
  }
298
-
299
313
  //#endregion
300
314
  //#region src/config.ts
301
315
  /**
@@ -321,6 +335,5 @@ function defineConfig(antfuOptions, ...userFlatConfigs) {
321
335
  if (mergedOptions.jsdoc !== false) presetConfigs.push(...JSDOC_PRESET_CONFIG);
322
336
  return antfu(resolvedOptions, ...presetConfigs, ...userFlatConfigs);
323
337
  }
324
-
325
338
  //#endregion
326
- export { defineConfig };
339
+ export { defineConfig };
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@tofrankie/eslint",
3
3
  "type": "module",
4
- "version": "0.0.14",
4
+ "version": "0.0.16",
5
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",
9
- "repository": "github:tofrankie/config",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/tofrankie/config.git",
12
+ "directory": "packages/eslint"
13
+ },
10
14
  "bugs": "https://github.com/tofrankie/config/issues",
11
15
  "keywords": [
12
16
  "eslint",
@@ -38,13 +42,13 @@
38
42
  "access": "public"
39
43
  },
40
44
  "engines": {
41
- "node": ">=18"
45
+ "node": "^20.0.0 || ^22.0.0 || ^24.0.0"
42
46
  },
43
47
  "peerDependencies": {
44
48
  "eslint": "^9.10.0 || ^10.0.0"
45
49
  },
46
50
  "dependencies": {
47
- "@antfu/eslint-config": "^7.7.2",
51
+ "@antfu/eslint-config": "^7.7.3",
48
52
  "@eslint-react/eslint-plugin": "^2.13.0",
49
53
  "eslint-plugin-format": "^2.0.1",
50
54
  "eslint-plugin-jsdoc": "^62.8.0",
@@ -57,6 +61,7 @@
57
61
  "eslint": "^9.39.4"
58
62
  },
59
63
  "scripts": {
64
+ "dev": "tsdown --watch",
60
65
  "build": "tsdown",
61
66
  "publint": "publint"
62
67
  }