@jacksontian/equation-resolver 1.0.0 → 1.1.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.
- package/LICENSE +22 -0
- package/README.md +8 -2
- package/lib/evaluator.js +206 -7
- package/lib/fraction.js +10 -1
- package/package.json +18 -6
- package/.github/workflows/nodejs.yml +0 -31
- package/eslint.config.js +0 -63
- package/test/evaluator.test.js +0 -230
- package/test/fraction.test.js +0 -435
- package/test/lexer.test.js +0 -418
- package/test/parser.test.js +0 -264
- package/test/semantic-checker.test.js +0 -45
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jackson Tian
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
# 方程求解器
|
|
2
2
|
|
|
3
|
+
[](https://github.com/JacksonTian/equation-resolver/actions/workflows/nodejs.yml)
|
|
4
|
+
[](https://codecov.io/gh/JacksonTian/equation-resolver)
|
|
3
5
|
[](https://www.npmjs.com/package/@jacksontian/equation-resolver)
|
|
4
6
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://nodejs.org/)
|
|
6
|
-
[](https://github.com/JacksonTian/equation-resolver)
|
|
7
7
|
|
|
8
8
|
一个使用词法分析、语法分析和语义分析实现的方程求解程序。
|
|
9
9
|
|
|
10
|
+
## 介绍
|
|
11
|
+
|
|
12
|
+
当你发现豆包等人工智能工具无法正确识别、无法正确计算结果,导致批改作业费时费力,你需要本方程求解器给你快速的得到确定性的答案。
|
|
13
|
+
|
|
14
|
+
只要在本程序中输入方程,即可得到解答。快速批改作业,回归亲子时光。
|
|
15
|
+
|
|
10
16
|
## 功能特性
|
|
11
17
|
|
|
12
18
|
- 支持线性方程求解
|
package/lib/evaluator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fraction } from './fraction.js';
|
|
2
2
|
|
|
3
3
|
// 单方程求值器
|
|
4
|
-
class EquationEvaluator {
|
|
4
|
+
export class EquationEvaluator {
|
|
5
5
|
constructor(ast) {
|
|
6
6
|
this.ast = ast;
|
|
7
7
|
}
|
|
@@ -71,10 +71,178 @@ class EquationEvaluator {
|
|
|
71
71
|
throw new Error(`Unknown node type: ${node.type}`);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
// 检查 AST 节点是否包含直接除以指定变量的项(不包括除以 2x 等情况)
|
|
75
|
+
containsDivisionByVariable(node, variable) {
|
|
76
|
+
if (node.type === 'BINARY_OP' && node.op === '/') {
|
|
77
|
+
// 只检查右操作数是否直接是变量(不包括 2x 等情况)
|
|
78
|
+
if (node.right.type === 'VARIABLE' && node.right.name === variable) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
// 递归检查左右子树
|
|
82
|
+
return this.containsDivisionByVariable(node.left, variable) ||
|
|
83
|
+
this.containsDivisionByVariable(node.right, variable);
|
|
84
|
+
} else if (node.type === 'BINARY_OP') {
|
|
85
|
+
return this.containsDivisionByVariable(node.left, variable) ||
|
|
86
|
+
this.containsDivisionByVariable(node.right, variable);
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 检查 AST 节点是否包含除以包含指定变量的表达式(如 3x, 2x 等)
|
|
92
|
+
containsDivisionByVariableExpression(node, variable) {
|
|
93
|
+
if (node.type === 'BINARY_OP' && node.op === '/') {
|
|
94
|
+
// 检查右操作数是否包含变量
|
|
95
|
+
if (this.containsVariable(node.right, variable)) {
|
|
96
|
+
return { found: true, divisor: node.right };
|
|
97
|
+
}
|
|
98
|
+
// 递归检查左右子树
|
|
99
|
+
const leftResult = this.containsDivisionByVariableExpression(node.left, variable);
|
|
100
|
+
if (leftResult.found) return leftResult;
|
|
101
|
+
const rightResult = this.containsDivisionByVariableExpression(node.right, variable);
|
|
102
|
+
if (rightResult.found) return rightResult;
|
|
103
|
+
} else if (node.type === 'BINARY_OP') {
|
|
104
|
+
const leftResult = this.containsDivisionByVariableExpression(node.left, variable);
|
|
105
|
+
if (leftResult.found) return leftResult;
|
|
106
|
+
const rightResult = this.containsDivisionByVariableExpression(node.right, variable);
|
|
107
|
+
if (rightResult.found) return rightResult;
|
|
108
|
+
}
|
|
109
|
+
return { found: false, divisor: null };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// 检查 AST 节点是否包含指定变量
|
|
113
|
+
containsVariable(node, variable) {
|
|
114
|
+
if (node.type === 'VARIABLE') {
|
|
115
|
+
return node.name === variable;
|
|
116
|
+
} else if (node.type === 'BINARY_OP') {
|
|
117
|
+
return this.containsVariable(node.left, variable) ||
|
|
118
|
+
this.containsVariable(node.right, variable);
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// 将表达式乘以另一个表达式(用于消除除以包含变量的表达式)
|
|
124
|
+
multiplyByExpression(node, expression) {
|
|
125
|
+
if (node.type === 'NUMBER') {
|
|
126
|
+
return {
|
|
127
|
+
type: 'BINARY_OP',
|
|
128
|
+
op: '*',
|
|
129
|
+
left: node,
|
|
130
|
+
right: expression
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (node.type === 'VARIABLE') {
|
|
134
|
+
return {
|
|
135
|
+
type: 'BINARY_OP',
|
|
136
|
+
op: '*',
|
|
137
|
+
left: node,
|
|
138
|
+
right: expression
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
if (node.type === 'BINARY_OP') {
|
|
142
|
+
if (node.op === '/') {
|
|
143
|
+
// 如果除以表达式,直接返回左操作数(不需要再乘以表达式)
|
|
144
|
+
// 这里需要深度比较,简化处理:如果右操作数结构相同,直接返回左操作数
|
|
145
|
+
// 为了简化,我们假设如果右操作数包含变量,就认为匹配
|
|
146
|
+
if (this.isSameExpression(node.right, expression)) {
|
|
147
|
+
return node.left;
|
|
148
|
+
}
|
|
149
|
+
// 否则,左操作数乘以表达式,右操作数保持不变
|
|
150
|
+
return {
|
|
151
|
+
type: 'BINARY_OP',
|
|
152
|
+
op: node.op,
|
|
153
|
+
left: this.multiplyByExpression(node.left, expression),
|
|
154
|
+
right: node.right
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
// 对于其他操作符(+、-、*),递归处理左右子树
|
|
158
|
+
return {
|
|
159
|
+
type: 'BINARY_OP',
|
|
160
|
+
op: node.op,
|
|
161
|
+
left: this.multiplyByExpression(node.left, expression),
|
|
162
|
+
right: this.multiplyByExpression(node.right, expression)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return node;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// 简化版的表达式比较(用于判断两个表达式是否相同)
|
|
169
|
+
isSameExpression(expr1, expr2) {
|
|
170
|
+
// 简单的深度比较
|
|
171
|
+
return JSON.stringify(expr1) === JSON.stringify(expr2);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// 将表达式乘以变量(用于消除除以变量的项)
|
|
175
|
+
multiplyByVariable(node, variable) {
|
|
176
|
+
if (node.type === 'NUMBER') {
|
|
177
|
+
return {
|
|
178
|
+
type: 'BINARY_OP',
|
|
179
|
+
op: '*',
|
|
180
|
+
left: node,
|
|
181
|
+
right: { type: 'VARIABLE', name: variable }
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (node.type === 'VARIABLE') {
|
|
185
|
+
return {
|
|
186
|
+
type: 'BINARY_OP',
|
|
187
|
+
op: '*',
|
|
188
|
+
left: node,
|
|
189
|
+
right: { type: 'VARIABLE', name: variable }
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (node.type === 'BINARY_OP') {
|
|
193
|
+
if (node.op === '/') {
|
|
194
|
+
// 如果除以变量,直接返回左操作数(不需要再乘以变量)
|
|
195
|
+
if (node.right.type === 'VARIABLE' && node.right.name === variable) {
|
|
196
|
+
return node.left;
|
|
197
|
+
}
|
|
198
|
+
// 否则,左操作数乘以变量,右操作数保持不变
|
|
199
|
+
return {
|
|
200
|
+
type: 'BINARY_OP',
|
|
201
|
+
op: node.op,
|
|
202
|
+
left: this.multiplyByVariable(node.left, variable),
|
|
203
|
+
right: node.right
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
// 对于其他操作符(+、-、*),递归处理左右子树
|
|
207
|
+
return {
|
|
208
|
+
type: 'BINARY_OP',
|
|
209
|
+
op: node.op,
|
|
210
|
+
left: this.multiplyByVariable(node.left, variable),
|
|
211
|
+
right: this.multiplyByVariable(node.right, variable)
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
return node;
|
|
215
|
+
}
|
|
216
|
+
|
|
74
217
|
// 获取指定变量的系数(支持多变量方程),返回 Fraction
|
|
75
218
|
getVariableCoefficientFraction(variable, allVariables) {
|
|
76
219
|
const standardForm = this.toStandardForm();
|
|
77
220
|
|
|
221
|
+
// 检查整个表达式是否包含除法,如果有则统一处理
|
|
222
|
+
let formToUse = standardForm;
|
|
223
|
+
let hasAnyDivision = false;
|
|
224
|
+
|
|
225
|
+
// 检查是否包含除以任何变量的项
|
|
226
|
+
for (const varName of allVariables) {
|
|
227
|
+
if (this.containsDivisionByVariable(standardForm, varName)) {
|
|
228
|
+
formToUse = this.multiplyByVariable(standardForm, varName);
|
|
229
|
+
hasAnyDivision = true;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// 如果没有直接除以变量的项,检查是否包含除以包含变量的表达式
|
|
235
|
+
if (!hasAnyDivision) {
|
|
236
|
+
for (const varName of allVariables) {
|
|
237
|
+
const divisionResult = this.containsDivisionByVariableExpression(standardForm, varName);
|
|
238
|
+
if (divisionResult.found) {
|
|
239
|
+
formToUse = this.multiplyByExpression(standardForm, divisionResult.divisor);
|
|
240
|
+
hasAnyDivision = true;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
78
246
|
// 使用两个不同的变量值来计算系数
|
|
79
247
|
const values1 = {};
|
|
80
248
|
const values0 = {};
|
|
@@ -89,9 +257,10 @@ class EquationEvaluator {
|
|
|
89
257
|
}
|
|
90
258
|
});
|
|
91
259
|
|
|
92
|
-
const val1 = this.evaluateWithValues(
|
|
93
|
-
const val0 = this.evaluateWithValues(
|
|
260
|
+
const val1 = this.evaluateWithValues(formToUse, values1);
|
|
261
|
+
const val0 = this.evaluateWithValues(formToUse, values0);
|
|
94
262
|
|
|
263
|
+
// 如果 val0 是 Infinity,使用 x=1 和 x=2 来计算系数
|
|
95
264
|
if (val0 === Infinity || !val0.isFinite()) {
|
|
96
265
|
const values2 = {};
|
|
97
266
|
allVariables.forEach(v => {
|
|
@@ -101,8 +270,13 @@ class EquationEvaluator {
|
|
|
101
270
|
values2[v] = 0;
|
|
102
271
|
}
|
|
103
272
|
});
|
|
104
|
-
const val2 = this.evaluateWithValues(
|
|
105
|
-
|
|
273
|
+
const val2 = this.evaluateWithValues(formToUse, values2);
|
|
274
|
+
if (val2 !== Infinity && val2.isFinite() && val1 !== Infinity && val1.isFinite()) {
|
|
275
|
+
// 使用 val2 - val1 来计算系数
|
|
276
|
+
return val2.subtract(val1);
|
|
277
|
+
}
|
|
278
|
+
// 如果仍然有问题,返回 0(不应该到达这里)
|
|
279
|
+
return new Fraction(0, 1);
|
|
106
280
|
}
|
|
107
281
|
|
|
108
282
|
return val1.subtract(val0);
|
|
@@ -117,19 +291,44 @@ class EquationEvaluator {
|
|
|
117
291
|
getConstantTermFraction(allVariables) {
|
|
118
292
|
const standardForm = this.toStandardForm();
|
|
119
293
|
|
|
294
|
+
// 检查整个表达式是否包含除法,如果有则统一处理
|
|
295
|
+
let formToUse = standardForm;
|
|
296
|
+
let hasAnyDivision = false;
|
|
297
|
+
|
|
298
|
+
// 检查是否包含除以任何变量的项
|
|
299
|
+
for (const variable of allVariables) {
|
|
300
|
+
if (this.containsDivisionByVariable(standardForm, variable)) {
|
|
301
|
+
formToUse = this.multiplyByVariable(standardForm, variable);
|
|
302
|
+
hasAnyDivision = true;
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// 如果没有直接除以变量的项,检查是否包含除以包含变量的表达式
|
|
308
|
+
if (!hasAnyDivision) {
|
|
309
|
+
for (const variable of allVariables) {
|
|
310
|
+
const divisionResult = this.containsDivisionByVariableExpression(standardForm, variable);
|
|
311
|
+
if (divisionResult.found) {
|
|
312
|
+
formToUse = this.multiplyByExpression(standardForm, divisionResult.divisor);
|
|
313
|
+
hasAnyDivision = true;
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
120
319
|
const values = {};
|
|
121
320
|
allVariables.forEach(v => {
|
|
122
321
|
values[v] = 0;
|
|
123
322
|
});
|
|
124
323
|
|
|
125
|
-
const val0 = this.evaluateWithValues(
|
|
324
|
+
const val0 = this.evaluateWithValues(formToUse, values);
|
|
126
325
|
|
|
127
326
|
if (val0 === Infinity || !val0.isFinite()) {
|
|
128
327
|
const values1 = {};
|
|
129
328
|
allVariables.forEach(v => {
|
|
130
329
|
values1[v] = 1;
|
|
131
330
|
});
|
|
132
|
-
const val1 = this.evaluateWithValues(
|
|
331
|
+
const val1 = this.evaluateWithValues(formToUse, values1);
|
|
133
332
|
|
|
134
333
|
// 计算所有变量的系数和
|
|
135
334
|
let totalCoeff = new Fraction(0, 1);
|
package/lib/fraction.js
CHANGED
|
@@ -19,8 +19,17 @@ class Fraction {
|
|
|
19
19
|
|
|
20
20
|
// 最大公约数
|
|
21
21
|
gcd(a, b) {
|
|
22
|
+
// 处理 Infinity 和 NaN
|
|
23
|
+
if (!isFinite(a) || !isFinite(b)) {
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
22
26
|
if (b === 0) return a;
|
|
23
|
-
|
|
27
|
+
const remainder = a % b;
|
|
28
|
+
// 如果 remainder 是 NaN 或 Infinity,返回 1
|
|
29
|
+
if (!isFinite(remainder)) {
|
|
30
|
+
return 1;
|
|
31
|
+
}
|
|
32
|
+
return this.gcd(b, remainder);
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
// 从字符串创建分数(支持整数和小数)
|
package/package.json
CHANGED
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacksontian/equation-resolver",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "解方程程序",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"solve": "
|
|
8
|
+
"solve": "bin/cli.js"
|
|
9
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"lib",
|
|
12
|
+
"bin"
|
|
13
|
+
],
|
|
10
14
|
"scripts": {
|
|
11
15
|
"dev": "node --test",
|
|
12
16
|
"test": "node --test test/*.test.js",
|
|
13
|
-
"test:cov": "c8 --reporter=html --reporter=text npm run test",
|
|
17
|
+
"test:cov": "c8 --reporter=html --reporter=lcov --reporter=text npm run test",
|
|
14
18
|
"dev:cov": "c8 --reporter=html --reporter=text npm run dev",
|
|
15
19
|
"lint": "eslint .",
|
|
16
20
|
"lint:fix": "eslint . --fix"
|
|
17
21
|
},
|
|
18
22
|
"keywords": [
|
|
19
23
|
"equation",
|
|
20
|
-
"solver"
|
|
24
|
+
"solver",
|
|
25
|
+
"math",
|
|
26
|
+
"algebra"
|
|
21
27
|
],
|
|
22
28
|
"author": "Jackson Tian",
|
|
23
29
|
"repository": {
|
|
24
30
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/JacksonTian/equation-resolver.git"
|
|
31
|
+
"url": "git+https://github.com/JacksonTian/equation-resolver.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/JacksonTian/equation-resolver/issues"
|
|
26
35
|
},
|
|
27
|
-
"homepage": "https://github.com/JacksonTian/equation-resolver",
|
|
36
|
+
"homepage": "https://github.com/JacksonTian/equation-resolver#readme",
|
|
28
37
|
"license": "MIT",
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"registry": "https://registry.npmjs.org/"
|
|
40
|
+
},
|
|
29
41
|
"devDependencies": {
|
|
30
42
|
"@eslint/js": "^9.39.1",
|
|
31
43
|
"c8": "^8.0.1",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
3
|
-
|
|
4
|
-
name: Node.js CI
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ "main" ]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [ "main" ]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build:
|
|
14
|
-
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
|
|
17
|
-
strategy:
|
|
18
|
-
matrix:
|
|
19
|
-
node-version: [18.x, 20.x, 22.x, 24.x]
|
|
20
|
-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
21
|
-
|
|
22
|
-
steps:
|
|
23
|
-
- uses: actions/checkout@v4
|
|
24
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
25
|
-
uses: actions/setup-node@v4
|
|
26
|
-
with:
|
|
27
|
-
node-version: ${{ matrix.node-version }}
|
|
28
|
-
cache: 'npm'
|
|
29
|
-
- run: npm ci
|
|
30
|
-
- run: npm run build --if-present
|
|
31
|
-
- run: npm test
|
package/eslint.config.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
|
|
3
|
-
export default [
|
|
4
|
-
js.configs.recommended,
|
|
5
|
-
{
|
|
6
|
-
languageOptions: {
|
|
7
|
-
ecmaVersion: 2024,
|
|
8
|
-
sourceType: 'module',
|
|
9
|
-
globals: {
|
|
10
|
-
console: 'readonly',
|
|
11
|
-
process: 'readonly',
|
|
12
|
-
Buffer: 'readonly',
|
|
13
|
-
__dirname: 'readonly',
|
|
14
|
-
__filename: 'readonly',
|
|
15
|
-
global: 'readonly',
|
|
16
|
-
module: 'readonly',
|
|
17
|
-
require: 'readonly',
|
|
18
|
-
exports: 'readonly',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
'no-unused-vars': ['error', {
|
|
23
|
-
argsIgnorePattern: '^_',
|
|
24
|
-
varsIgnorePattern: '^_',
|
|
25
|
-
}],
|
|
26
|
-
'no-console': 'off',
|
|
27
|
-
'no-undef': 'error',
|
|
28
|
-
'no-redeclare': 'error',
|
|
29
|
-
'no-constant-condition': 'error',
|
|
30
|
-
'no-empty': 'error',
|
|
31
|
-
'no-extra-semi': 'error',
|
|
32
|
-
'no-func-assign': 'error',
|
|
33
|
-
'no-inner-declarations': 'error',
|
|
34
|
-
'no-sparse-arrays': 'error',
|
|
35
|
-
'no-unreachable': 'error',
|
|
36
|
-
'use-isnan': 'error',
|
|
37
|
-
'valid-typeof': 'error',
|
|
38
|
-
'no-var': 'error',
|
|
39
|
-
'prefer-const': 'error',
|
|
40
|
-
'prefer-arrow-callback': 'error',
|
|
41
|
-
'arrow-body-style': ['error', 'as-needed'],
|
|
42
|
-
'no-duplicate-imports': 'error',
|
|
43
|
-
'no-useless-constructor': 'error',
|
|
44
|
-
'no-useless-return': 'error',
|
|
45
|
-
'prefer-template': 'error',
|
|
46
|
-
'prefer-destructuring': ['error', {
|
|
47
|
-
array: false,
|
|
48
|
-
object: true,
|
|
49
|
-
}],
|
|
50
|
-
'object-shorthand': 'error',
|
|
51
|
-
'prefer-rest-params': 'error',
|
|
52
|
-
'prefer-spread': 'error',
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
ignores: [
|
|
57
|
-
'node_modules/**',
|
|
58
|
-
'coverage/**',
|
|
59
|
-
'*.min.js',
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
];
|
|
63
|
-
|