flatlint 1.107.0 → 1.109.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/ChangeLog
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
openRoundBrace,
|
|
11
11
|
openSquireBrace,
|
|
12
12
|
quote,
|
|
13
|
+
semicolon,
|
|
13
14
|
spread,
|
|
14
15
|
} from '#types';
|
|
15
16
|
|
|
@@ -52,10 +53,33 @@ export const match = () => ({
|
|
|
52
53
|
if (path.isNextPunctuator())
|
|
53
54
|
return false;
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
if (path.isNextKeyword())
|
|
57
|
+
return true;
|
|
58
|
+
|
|
59
|
+
return path.isPrevKeyword();
|
|
56
60
|
},
|
|
57
|
-
'__a,': (vars, path) =>
|
|
58
|
-
|
|
61
|
+
'__a,': (vars, path) => !path.isNext(),
|
|
62
|
+
'],': (vars, path) => {
|
|
63
|
+
for (const token of path.getAllPrev()) {
|
|
64
|
+
if (isPunctuator(token, colon))
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let result = false;
|
|
69
|
+
|
|
70
|
+
for (const token of path.getAllNext()) {
|
|
71
|
+
if (isPunctuator(token, closeSquareBrace)) {
|
|
72
|
+
result = false;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (isPunctuator(token, semicolon)) {
|
|
77
|
+
result = true;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return result;
|
|
59
83
|
},
|
|
60
84
|
});
|
|
61
85
|
|
|
@@ -67,6 +91,7 @@ export const replace = () => ({
|
|
|
67
91
|
'__a.__b = __expr,': '__a.__b = __expr;',
|
|
68
92
|
'"__a",': '"__a";',
|
|
69
93
|
'__a,': '__a;',
|
|
94
|
+
'],': '];',
|
|
70
95
|
});
|
|
71
96
|
|
|
72
97
|
const check = ({__x}, path) => {
|
|
@@ -56,28 +56,6 @@ export const match = () => ({
|
|
|
56
56
|
|
|
57
57
|
return true;
|
|
58
58
|
},
|
|
59
|
-
'],': (vars, path) => {
|
|
60
|
-
for (const token of path.getAllPrev()) {
|
|
61
|
-
if (isPunctuator(token, colon))
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
let result = false;
|
|
66
|
-
|
|
67
|
-
for (const token of path.getAllNext()) {
|
|
68
|
-
if (isPunctuator(token, closeSquareBrace)) {
|
|
69
|
-
result = false;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (isPunctuator(token, semicolon)) {
|
|
74
|
-
result = true;
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return result;
|
|
80
|
-
},
|
|
81
59
|
});
|
|
82
60
|
|
|
83
61
|
export const replace = () => ({
|
|
@@ -85,5 +63,4 @@ export const replace = () => ({
|
|
|
85
63
|
'__a(__args),': '__a(__args)',
|
|
86
64
|
'},': '}',
|
|
87
65
|
'}),': '})',
|
|
88
|
-
'],': '];',
|
|
89
66
|
});
|
package/lib/runner/path.js
CHANGED
|
@@ -36,6 +36,10 @@ export const createPath = ({tokens, start, end}) => ({
|
|
|
36
36
|
tokens,
|
|
37
37
|
start,
|
|
38
38
|
}),
|
|
39
|
+
isPrevKeyword: createIsPrevKeyword({
|
|
40
|
+
tokens,
|
|
41
|
+
start,
|
|
42
|
+
}),
|
|
39
43
|
isNextKeyword: createIsNextKeyword({
|
|
40
44
|
tokens,
|
|
41
45
|
end,
|
|
@@ -101,6 +105,15 @@ const createIsInsideTemplate = ({tokens, end}) => () => {
|
|
|
101
105
|
return isTemplateMiddle(current);
|
|
102
106
|
};
|
|
103
107
|
|
|
108
|
+
const createIsPrevKeyword = ({tokens, start}) => () => {
|
|
109
|
+
const current = getPrev({
|
|
110
|
+
tokens,
|
|
111
|
+
start,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return isKeyword(current);
|
|
115
|
+
};
|
|
116
|
+
|
|
104
117
|
const createIsNextKeyword = ({tokens, end}) => () => {
|
|
105
118
|
const current = getNext({
|
|
106
119
|
tokens,
|