eslint-plugin-better-codes 1.2.12 → 1.4.11
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/README.md
CHANGED
|
@@ -19,6 +19,21 @@ module.exports = {
|
|
|
19
19
|
return {
|
|
20
20
|
MemberExpression(node) {
|
|
21
21
|
try {
|
|
22
|
+
// 如果当前成员表达式出现在赋值语句 `=` 的左侧,则跳过校验
|
|
23
|
+
// 向上遍历祖先节点,若遇到使当前节点位于 AssignmentExpression.left 的 '=' 赋值,则直接返回
|
|
24
|
+
let anc = node;
|
|
25
|
+
while (anc && anc.parent) {
|
|
26
|
+
const p = anc.parent;
|
|
27
|
+
if (
|
|
28
|
+
p.type === "AssignmentExpression" &&
|
|
29
|
+
p.operator === "=" &&
|
|
30
|
+
p.left === anc
|
|
31
|
+
) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
anc = p;
|
|
35
|
+
}
|
|
36
|
+
|
|
22
37
|
// 只在最外层的 member 表达式上检查一次,避免重复报告
|
|
23
38
|
const parent = node.parent;
|
|
24
39
|
if (
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "eslint-plugin-better-codes",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"main": "index.js",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "npx eslint ./test.js"
|
|
7
|
-
},
|
|
8
|
-
"keywords": [
|
|
9
|
-
"eslint",
|
|
10
|
-
"eslint-plugin"
|
|
11
|
-
],
|
|
12
|
-
"author": "",
|
|
13
|
-
"license": "MIT",
|
|
14
|
-
"description": "eslint代码规范校验自定义插件合集,提升代码质量"
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-plugin-better-codes",
|
|
3
|
+
"version": "1.4.11",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "npx eslint ./test.js"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"eslint",
|
|
10
|
+
"eslint-plugin"
|
|
11
|
+
],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"description": "eslint代码规范校验自定义插件合集,提升代码质量"
|
|
15
15
|
}
|