flatlint 1.79.0 → 1.80.1

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
@@ -1,3 +1,13 @@
1
+ 2025.01.22, v1.80.1
2
+
3
+ feature:
4
+ - 3ec4b7a flatlint: move out keywords
5
+
6
+ 2025.01.22, v1.80.0
7
+
8
+ feature:
9
+ - 5cc2029 flatlint: add-missing-assing: exclude for
10
+
1
11
  2025.01.22, v1.79.0
2
12
 
3
13
  feature:
@@ -9,6 +9,9 @@ export const report = () => 'Add missing assign';
9
9
 
10
10
  export const match = () => ({
11
11
  '__x __a __expr': ({__expr, __x}, path) => {
12
+ if (path.isNextKeyword())
13
+ return false;
14
+
12
15
  if (path.isNextPunctuator(assign))
13
16
  return false;
14
17
 
@@ -103,7 +103,7 @@ const createIsNextKeyword = ({tokens, end}) => (name) => {
103
103
  end,
104
104
  });
105
105
 
106
- return isKeyword(current, name);
106
+ return isKeyword(current);
107
107
  };
108
108
 
109
109
  const createIsNextPunctuator = ({tokens, end}) => (punctuators) => {
@@ -0,0 +1,22 @@
1
+ export const keywords = [
2
+ 'as',
3
+ 'await',
4
+ 'const',
5
+ 'continue',
6
+ 'for',
7
+ 'function',
8
+ 'var',
9
+ 'let',
10
+ 'new',
11
+ 'else',
12
+ 'export',
13
+ 'from',
14
+ 'import',
15
+ 'return',
16
+ 'throw',
17
+ 'of',
18
+ 'if',
19
+ 'yield',
20
+ 'typeof',
21
+ 'while',
22
+ ];
@@ -1,3 +1,5 @@
1
+ import {keywords} from './keywords.js';
2
+
1
3
  const {isArray} = Array;
2
4
  const maybeArray = (a) => isArray(a) ? a : [a];
3
5
  const isString = (a) => typeof a === 'string';
@@ -25,29 +27,10 @@ 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);
28
- export const isKeyword = (token) => {
29
- const keywords = [
30
- 'as',
31
- 'await',
32
- 'const',
33
- 'continue',
34
- 'for',
35
- 'function',
36
- 'var',
37
- 'let',
38
- 'new',
39
- 'else',
40
- 'export',
41
- 'from',
42
- 'import',
43
- 'return',
44
- 'throw',
45
- 'of',
46
- 'if',
47
- 'yield',
48
- 'typeof',
49
- 'while',
50
- ];
30
+
31
+ export const isKeyword = (token, name) => {
32
+ if (!token)
33
+ return false;
51
34
 
52
35
  for (const keyword of keywords) {
53
36
  if (isIdentifier(token, keyword))
@@ -200,3 +183,4 @@ export const isBalancedRoundBraces = (tokens) => {
200
183
 
201
184
  return !roundBalance;
202
185
  };
186
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.79.0",
3
+ "version": "1.80.1",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",
@@ -82,8 +82,7 @@
82
82
  "dependencies": {
83
83
  "@putout/engine-loader": "^15.1.1",
84
84
  "debug": "^4.4.0",
85
- "js-tokens": "^9.0.1",
86
- "putout": "^37.0.0"
85
+ "js-tokens": "^9.0.1"
87
86
  },
88
87
  "devDependencies": {
89
88
  "montag": "^1.0.0",
@@ -96,6 +95,7 @@
96
95
  "madrun": "^10.2.2",
97
96
  "mock-require": "^3.0.3",
98
97
  "nodemon": "^3.0.1",
98
+ "putout": "^37.0.0",
99
99
  "supertape": "^10.0.0"
100
100
  },
101
101
  "publishConfig": {