flatlint 1.80.0 → 1.81.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 +10 -0
- package/lib/types/types.js +7 -27
- package/package.json +4 -3
package/ChangeLog
CHANGED
package/lib/types/types.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as keyword from '@putout/operator-keyword';
|
|
2
|
+
|
|
1
3
|
const {isArray} = Array;
|
|
2
4
|
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
3
5
|
const isString = (a) => typeof a === 'string';
|
|
@@ -25,39 +27,17 @@ export const isStringLiteral = ({type}) => type === 'StringLiteral';
|
|
|
25
27
|
export const isNumericLiteral = ({type}) => type === 'NumericLiteral';
|
|
26
28
|
export const isNewLine = ({type}) => type === 'LineTerminatorSequence';
|
|
27
29
|
export const notWhiteSpace = (a) => !isWhiteSpace(a);
|
|
30
|
+
|
|
28
31
|
export const isKeyword = (token, name) => {
|
|
29
32
|
if (!token)
|
|
30
33
|
return false;
|
|
31
34
|
|
|
32
|
-
const
|
|
33
|
-
'as',
|
|
34
|
-
'await',
|
|
35
|
-
'const',
|
|
36
|
-
'continue',
|
|
37
|
-
'for',
|
|
38
|
-
'function',
|
|
39
|
-
'var',
|
|
40
|
-
'let',
|
|
41
|
-
'new',
|
|
42
|
-
'else',
|
|
43
|
-
'export',
|
|
44
|
-
'from',
|
|
45
|
-
'import',
|
|
46
|
-
'return',
|
|
47
|
-
'throw',
|
|
48
|
-
'of',
|
|
49
|
-
'if',
|
|
50
|
-
'yield',
|
|
51
|
-
'typeof',
|
|
52
|
-
'while',
|
|
53
|
-
];
|
|
35
|
+
const {value} = token;
|
|
54
36
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
37
|
+
if (!keyword.isKeyword(value))
|
|
38
|
+
return false;
|
|
59
39
|
|
|
60
|
-
return
|
|
40
|
+
return isIdentifier(token, name);
|
|
61
41
|
};
|
|
62
42
|
|
|
63
43
|
export const isOneOfPunctuators = (token, punctuators) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flatlint",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.81.0",
|
|
4
4
|
"description": "JavaScript tokens-based linter",
|
|
5
5
|
"main": "lib/flatlint.js",
|
|
6
6
|
"type": "module",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@putout/engine-loader": "^15.1.1",
|
|
84
|
+
"@putout/operator-keyword": "^1.0.0",
|
|
84
85
|
"debug": "^4.4.0",
|
|
85
|
-
"js-tokens": "^9.0.1"
|
|
86
|
-
"putout": "^37.0.0"
|
|
86
|
+
"js-tokens": "^9.0.1"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"montag": "^1.0.0",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"madrun": "^10.2.2",
|
|
97
97
|
"mock-require": "^3.0.3",
|
|
98
98
|
"nodemon": "^3.0.1",
|
|
99
|
+
"putout": "^37.0.0",
|
|
99
100
|
"supertape": "^10.0.0"
|
|
100
101
|
},
|
|
101
102
|
"publishConfig": {
|