@vida0905/eslint-config 2.9.0 → 2.10.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.
File without changes
@@ -6,7 +6,7 @@ import path from "node:path";
6
6
  import { styleText } from "node:util";
7
7
 
8
8
  //#region package.json
9
- var version = "2.9.0";
9
+ var version = "2.10.0";
10
10
 
11
11
  //#endregion
12
12
  //#region src/cli/constants.ts
package/dist/index.d.mts CHANGED
@@ -36,6 +36,10 @@ interface RuleOptions {
36
36
  * Prefer Array.from(iterable, mapper) over [...iterable].map(mapper) to avoid intermediate array allocation
37
37
  */
38
38
  'e18e/prefer-array-from-map'?: Linter.RuleEntry<[]>;
39
+ /**
40
+ * Prefer Array.some() over Array.find() when checking for element existence
41
+ */
42
+ 'e18e/prefer-array-some'?: Linter.RuleEntry<[]>;
39
43
  /**
40
44
  * Prefer Array.prototype.toReversed() over copying and reversing arrays
41
45
  */
@@ -101,8 +105,7 @@ type E18EBanDependencies = [] | [{
101
105
  presets?: string[];
102
106
  modules?: string[];
103
107
  allowed?: string[];
104
- }];
105
- // Names of all the configs
108
+ }]; // Names of all the configs
106
109
  //#endregion
107
110
  //#region src/types.d.ts
108
111
  interface Rules extends RuleOptions {}
package/dist/index.mjs CHANGED
@@ -1,25 +1,17 @@
1
1
  import antfu, { GLOB_SRC, ensurePackages, interopDefault } from "@antfu/eslint-config";
2
2
  import { isPackageExists } from "local-pkg";
3
-
4
- export * from "@antfu/eslint-config"
5
-
6
- //#region node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
3
+ export * from "@antfu/eslint-config";
7
4
  function isPrimitive(value) {
8
5
  return value == null || typeof value !== "object" && typeof value !== "function";
9
6
  }
10
-
11
- //#endregion
12
- //#region node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
13
7
  function isTypedArray(x) {
14
8
  return ArrayBuffer.isView(x) && !(x instanceof DataView);
15
9
  }
16
-
17
- //#endregion
18
- //#region node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/object/clone.mjs
19
10
  function clone(obj) {
20
11
  if (isPrimitive(obj)) return obj;
21
12
  if (Array.isArray(obj) || isTypedArray(obj) || obj instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && obj instanceof SharedArrayBuffer) return obj.slice(0);
22
13
  const prototype = Object.getPrototypeOf(obj);
14
+ if (prototype == null) return Object.assign(Object.create(prototype), obj);
23
15
  const Constructor = prototype.constructor;
24
16
  if (obj instanceof Date || obj instanceof Map || obj instanceof Set) return new Constructor(obj);
25
17
  if (obj instanceof RegExp) {
@@ -29,10 +21,11 @@ function clone(obj) {
29
21
  }
30
22
  if (obj instanceof DataView) return new Constructor(obj.buffer.slice(0));
31
23
  if (obj instanceof Error) {
32
- const newError = new Constructor(obj.message);
24
+ let newError;
25
+ if (obj instanceof AggregateError) newError = new Constructor(obj.errors, obj.message, { cause: obj.cause });
26
+ else newError = new Constructor(obj.message, { cause: obj.cause });
33
27
  newError.stack = obj.stack;
34
- newError.name = obj.name;
35
- newError.cause = obj.cause;
28
+ Object.assign(newError, obj);
36
29
  return newError;
37
30
  }
38
31
  if (typeof File !== "undefined" && obj instanceof File) return new Constructor([obj], obj.name, {
@@ -45,24 +38,15 @@ function clone(obj) {
45
38
  }
46
39
  return obj;
47
40
  }
48
-
49
- //#endregion
50
- //#region node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
51
41
  function isPlainObject(value) {
52
42
  if (!value || typeof value !== "object") return false;
53
43
  const proto = Object.getPrototypeOf(value);
54
44
  if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
55
45
  return Object.prototype.toString.call(value) === "[object Object]";
56
46
  }
57
-
58
- //#endregion
59
- //#region node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
60
47
  function isUnsafeProperty(key) {
61
48
  return key === "__proto__";
62
49
  }
63
-
64
- //#endregion
65
- //#region node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/object/mergeWith.mjs
66
50
  function mergeWith(target, source, merge) {
67
51
  const sourceKeys = Object.keys(source);
68
52
  for (let i = 0; i < sourceKeys.length; i++) {
@@ -80,9 +64,6 @@ function mergeWith(target, source, merge) {
80
64
  }
81
65
  return target;
82
66
  }
83
-
84
- //#endregion
85
- //#region node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/object/toMerged.mjs
86
67
  function toMerged(target, source) {
87
68
  return mergeWith(clone(target), source, function mergeRecursively(targetValue, sourceValue) {
88
69
  if (Array.isArray(sourceValue)) if (Array.isArray(targetValue)) return mergeWith(clone(targetValue), sourceValue, mergeRecursively);
@@ -91,9 +72,6 @@ function toMerged(target, source) {
91
72
  else return mergeWith({}, sourceValue, mergeRecursively);
92
73
  });
93
74
  }
94
-
95
- //#endregion
96
- //#region src/configs/de-morgan.ts
97
75
  async function deMorgan(options = {}) {
98
76
  const { files = [GLOB_SRC] } = options;
99
77
  return [{
@@ -102,9 +80,6 @@ async function deMorgan(options = {}) {
102
80
  ...(await interopDefault(import("eslint-plugin-de-morgan"))).configs.recommended
103
81
  }];
104
82
  }
105
-
106
- //#endregion
107
- //#region src/configs/e18e.ts
108
83
  async function e18e(options = {}) {
109
84
  const { files = [GLOB_SRC], overrides } = options;
110
85
  const recommendedConfig = (await interopDefault(import("@e18e/eslint-plugin"))).configs.recommended;
@@ -118,9 +93,6 @@ async function e18e(options = {}) {
118
93
  }
119
94
  }];
120
95
  }
121
-
122
- //#endregion
123
- //#region src/configs/nuxt.ts
124
96
  async function nuxt(options = {}) {
125
97
  const { files = [GLOB_SRC], overrides = {} } = options;
126
98
  await ensurePackages(["@nuxt/eslint-plugin"]);
@@ -138,88 +110,66 @@ async function nuxt(options = {}) {
138
110
  }
139
111
  }];
140
112
  }
141
-
142
- //#endregion
143
- //#region src/overrides/javascript.ts
144
- const javascript = { overrides: {
145
- "arrow-body-style": ["error", "as-needed"],
146
- "no-unused-private-class-members": "error",
147
- "require-atomic-updates": ["error", { allowProperties: true }]
148
- } };
149
-
150
- //#endregion
151
- //#region src/overrides/stylistic.ts
152
- const stylistic = {
153
- indent: 2,
154
- quotes: "single",
155
- semi: false,
156
- overrides: {
157
- "style/indent": [
158
- "error",
159
- 2,
160
- {
161
- SwitchCase: 1,
162
- VariableDeclarator: "first",
163
- outerIIFEBody: 1,
164
- MemberExpression: 1,
165
- FunctionDeclaration: {
166
- parameters: 1,
167
- body: 1
168
- },
169
- FunctionExpression: {
170
- parameters: 1,
171
- body: 1
172
- },
173
- StaticBlock: { body: 1 },
174
- CallExpression: { arguments: 1 },
175
- ArrayExpression: 1,
176
- ObjectExpression: 1,
177
- ImportDeclaration: 1,
178
- flatTernaryExpressions: true,
179
- offsetTernaryExpressions: true,
180
- ignoreComments: false,
181
- tabLength: 2
182
- }
183
- ],
184
- "style/quotes": [
185
- "error",
186
- "single",
187
- {
188
- avoidEscape: true,
189
- allowTemplateLiterals: "avoidEscape"
190
- }
191
- ],
192
- "style/arrow-parens": ["error", "always"],
193
- "style/brace-style": [
194
- "error",
195
- "1tbs",
196
- { allowSingleLine: true }
197
- ]
198
- }
199
- };
200
-
201
- //#endregion
202
- //#region src/overrides/typescript.ts
203
- const typescript = { overrides: { "ts/array-type": "error" } };
204
-
205
- //#endregion
206
- //#region src/overrides/vue.ts
207
- const vue = { overrides: {
208
- "vue/max-attributes-per-line": ["error", { multiline: 1 }],
209
- "vue/prefer-use-template-ref": ["error"]
210
- } };
211
-
212
- //#endregion
213
- //#region src/overrides/index.ts
214
113
  const antfuOverrides = Object.freeze({
215
- javascript,
216
- stylistic,
217
- typescript,
218
- vue
114
+ javascript: { overrides: {
115
+ "arrow-body-style": ["error", "as-needed"],
116
+ "no-unused-private-class-members": "error",
117
+ "require-atomic-updates": ["error", { allowProperties: true }]
118
+ } },
119
+ stylistic: {
120
+ indent: 2,
121
+ quotes: "single",
122
+ semi: false,
123
+ overrides: {
124
+ "style/indent": [
125
+ "error",
126
+ 2,
127
+ {
128
+ SwitchCase: 1,
129
+ VariableDeclarator: "first",
130
+ outerIIFEBody: 1,
131
+ MemberExpression: 1,
132
+ FunctionDeclaration: {
133
+ parameters: 1,
134
+ body: 1
135
+ },
136
+ FunctionExpression: {
137
+ parameters: 1,
138
+ body: 1
139
+ },
140
+ StaticBlock: { body: 1 },
141
+ CallExpression: { arguments: 1 },
142
+ ArrayExpression: 1,
143
+ ObjectExpression: 1,
144
+ ImportDeclaration: 1,
145
+ flatTernaryExpressions: true,
146
+ offsetTernaryExpressions: true,
147
+ ignoreComments: false,
148
+ tabLength: 2
149
+ }
150
+ ],
151
+ "style/quotes": [
152
+ "error",
153
+ "single",
154
+ {
155
+ avoidEscape: true,
156
+ allowTemplateLiterals: "avoidEscape"
157
+ }
158
+ ],
159
+ "style/arrow-parens": ["error", "always"],
160
+ "style/brace-style": [
161
+ "error",
162
+ "1tbs",
163
+ { allowSingleLine: true }
164
+ ]
165
+ }
166
+ },
167
+ typescript: { overrides: { "ts/array-type": "error" } },
168
+ vue: { overrides: {
169
+ "vue/max-attributes-per-line": ["error", { multiline: 1 }],
170
+ "vue/prefer-use-template-ref": ["error"]
171
+ } }
219
172
  });
220
-
221
- //#endregion
222
- //#region src/index.ts
223
173
  const defaultOptions = {
224
174
  deMorgan: true,
225
175
  e18e: true,
@@ -251,6 +201,4 @@ function applyOptions(options) {
251
201
  return options;
252
202
  }
253
203
  var src_default = defineConfig;
254
-
255
- //#endregion
256
- export { applyOptions, src_default as default, defineConfig };
204
+ export { applyOptions, src_default as default, defineConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vida0905/eslint-config",
3
3
  "type": "module",
4
- "version": "2.9.0",
4
+ "version": "2.10.0",
5
5
  "description": "Vida Xie's ESLint Config",
6
6
  "author": "Vida Xie <vida_2020@163.com> (https://github.com/9romise/)",
7
7
  "license": "MIT",
@@ -17,9 +17,9 @@
17
17
  "eslint-config"
18
18
  ],
19
19
  "exports": {
20
- ".": "./dist/index.mjs"
20
+ ".": "./dist/index.mjs",
21
+ "./package.json": "./package.json"
21
22
  },
22
- "main": "./dits/index.mjs",
23
23
  "types": "./dist/index.d.mts",
24
24
  "bin": "./bin/index.mjs",
25
25
  "files": [
@@ -40,24 +40,24 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
- "@antfu/eslint-config": "^6.7.3",
44
- "@e18e/eslint-plugin": "^0.1.3",
43
+ "@antfu/eslint-config": "^7.2.0",
44
+ "@e18e/eslint-plugin": "^0.1.4",
45
45
  "cac": "^6.7.14",
46
- "eslint-flat-config-utils": "^2.1.4",
46
+ "eslint-flat-config-utils": "^3.0.0",
47
47
  "eslint-plugin-de-morgan": "^2.0.0",
48
48
  "local-pkg": "^1.1.2"
49
49
  },
50
50
  "devDependencies": {
51
- "@types/node": "^25.0.3",
52
- "es-toolkit": "^1.43.0",
51
+ "@types/node": "^25.2.0",
52
+ "es-toolkit": "^1.44.0",
53
53
  "eslint": "^9.39.2",
54
54
  "eslint-typegen": "^2.3.0",
55
55
  "husky": "^9.1.7",
56
56
  "nano-staged": "^0.9.0",
57
- "tsdown": "^0.18.3",
57
+ "tsdown": "^0.20.1",
58
58
  "tsx": "^4.21.0",
59
59
  "typescript": "^5.9.3",
60
- "vitest": "^4.0.16"
60
+ "vitest": "^4.0.18"
61
61
  },
62
62
  "nano-staged": {
63
63
  "*": "eslint --fix"
@@ -70,6 +70,7 @@
70
70
  "test": "vitest",
71
71
  "lint": "eslint .",
72
72
  "check": "npm run typecheck && npm run lint",
73
- "inspect": "npx eslint --inspect-config --config eslint-inspector.config.ts"
73
+ "inspect": "npx eslint --inspect-config --config eslint-inspector.config.ts",
74
+ "release": "npx bumpp"
74
75
  }
75
76
  }