flatlint 2.14.0 → 3.0.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
@@ -1,3 +1,18 @@
1
+ 2025.03.28, v3.0.0
2
+
3
+ feature:
4
+ - 7e4ae06 flatlint: drop support of node < 20
5
+ - 5e7e24d flatlint: supertape v11.0.4
6
+ - 04fd6b1 flatlint: putout v39.3.0
7
+ - f2e31d6 flatlint: madrun v11.0.0
8
+ - 597f18b flatlint: eslint-plugin-putout v26.1.0
9
+ - 0e57f96 flatlint: @putout/test v13.0.0
10
+
11
+ 2025.03.18, v2.14.1
12
+
13
+ feature:
14
+ - d646ef5 isOneOfPunctuators -> isPunctuator
15
+
1
16
  2025.03.18, v2.14.0
2
17
 
3
18
  feature:
@@ -2,7 +2,7 @@ import {
2
2
  closeCurlyBrace,
3
3
  closeRoundBrace,
4
4
  isNewLine,
5
- isOneOfPunctuators,
5
+ isPunctuator,
6
6
  NOT_OK,
7
7
  OK,
8
8
  openCurlyBrace,
@@ -19,7 +19,7 @@ export const collectArgs = ({currentTokenIndex, tokens}) => {
19
19
  const n = tokens.length;
20
20
  const currentToken = tokens[index];
21
21
 
22
- if (isOneOfPunctuators(currentToken, NOT_OK_PUNCTUATORS))
22
+ if (isPunctuator(currentToken, NOT_OK_PUNCTUATORS))
23
23
  return [NOT_OK];
24
24
 
25
25
  let curlyBracesBalance = 0;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  colon,
3
3
  isIdentifier,
4
- isOneOfKeywords,
4
+ isOneOfIdentifiers,
5
5
  isPunctuator,
6
6
  openCurlyBrace,
7
7
  } from '#types';
@@ -12,7 +12,7 @@ export const match = () => ({
12
12
  '(__args) {': (vars, path) => {
13
13
  const current = path.getPrev();
14
14
 
15
- if (isOneOfKeywords(current, ['if', 'function']))
15
+ if (isOneOfIdentifiers(current, ['if', 'function']))
16
16
  return false;
17
17
 
18
18
  if (isIdentifier(current))
@@ -2,7 +2,7 @@ import {
2
2
  assign,
3
3
  isDeclarationKeyword,
4
4
  isKeyword,
5
- isOneOfPunctuators,
5
+ isPunctuator,
6
6
  semicolon,
7
7
  } from '#types';
8
8
 
@@ -18,13 +18,13 @@ export const match = () => ({
18
18
  if (!isDeclarationKeyword(__x))
19
19
  return false;
20
20
 
21
- return !isOneOfPunctuators(assign, __expr);
21
+ return !isPunctuator(assign, __expr);
22
22
  },
23
23
  '__a.__b __expr': ({__expr}, path) => {
24
24
  if (path.isNextPunctuator() && !path.isNextPunctuator(semicolon))
25
25
  return false;
26
26
 
27
- return !isOneOfPunctuators(assign, __expr);
27
+ return !isPunctuator(assign, __expr);
28
28
  },
29
29
  });
30
30
 
@@ -3,8 +3,7 @@ import {
3
3
  closeRoundBrace,
4
4
  closeSquareBrace,
5
5
  colon,
6
- isOneOfKeywords,
7
- isOneOfPunctuators,
6
+ isOneOfIdentifiers,
8
7
  isPunctuator,
9
8
  openCurlyBrace,
10
9
  openRoundBrace,
@@ -23,7 +22,7 @@ export const match = () => ({
23
22
  return false;
24
23
 
25
24
  for (const token of path.getAllPrev()) {
26
- if (isOneOfPunctuators(token, punctuators))
25
+ if (isPunctuator(token, punctuators))
27
26
  return false;
28
27
  }
29
28
 
@@ -98,7 +97,7 @@ export const replace = () => ({
98
97
  });
99
98
 
100
99
  const check = ({__x}, path) => {
101
- if (!isOneOfKeywords(__x, ['var', 'let', 'const']))
100
+ if (!isOneOfIdentifiers(__x, ['var', 'let', 'const']))
102
101
  return false;
103
102
 
104
103
  if (!path.isNext())
@@ -3,7 +3,7 @@ import {
3
3
  colon,
4
4
  dot,
5
5
  isKeyword,
6
- isOneOfKeywords,
6
+ isOneOfIdentifiers,
7
7
  isPunctuator,
8
8
  semicolon,
9
9
  assign,
@@ -34,7 +34,7 @@ export const match = () => ({
34
34
  if (isPunctuator(token, semicolon))
35
35
  return false;
36
36
 
37
- if (isOneOfKeywords(token, keywords))
37
+ if (isOneOfIdentifiers(token, keywords))
38
38
  return false;
39
39
  }
40
40
 
@@ -50,7 +50,7 @@ export const match = () => ({
50
50
  return false;
51
51
 
52
52
  for (const token of path.getAllPrev())
53
- if (isOneOfKeywords(token, keywords))
53
+ if (isOneOfIdentifiers(token, keywords))
54
54
  return false;
55
55
 
56
56
  return true;
@@ -65,7 +65,7 @@ export const match = () => ({
65
65
  const isNextCall = path.isNextCompare('__a.__b(');
66
66
 
67
67
  for (const token of path.getAllPrev()) {
68
- if (isOneOfKeywords(token, keywords))
68
+ if (isOneOfIdentifiers(token, keywords))
69
69
  return false;
70
70
 
71
71
  if (isPunctuator(token, [
@@ -74,16 +74,7 @@ export const isDeclarationKeyword = (token, name) => {
74
74
  return isIdentifier(token, name);
75
75
  };
76
76
 
77
- export const isOneOfPunctuators = (token, punctuators) => {
78
- for (const punctuator of punctuators) {
79
- if (isPunctuator(token, punctuator))
80
- return true;
81
- }
82
-
83
- return false;
84
- };
85
-
86
- export const isOneOfKeywords = (token, keywords) => {
77
+ export const isOneOfIdentifiers = (token, keywords) => {
87
78
  for (const keyword of keywords) {
88
79
  if (isIdentifier(token, keyword))
89
80
  return true;
@@ -190,7 +181,7 @@ export const hasRoundBraces = (tokens) => {
190
181
  const roundBraces = [openRoundBrace, closeRoundBrace];
191
182
 
192
183
  for (const token of tokens) {
193
- if (isOneOfPunctuators(token, roundBraces))
184
+ if (isPunctuator(token, roundBraces))
194
185
  return true;
195
186
  }
196
187
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "2.14.0",
3
+ "version": "3.0.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",
@@ -76,9 +76,6 @@
76
76
  },
77
77
  "homepage": "https://github.com/coderaiser/flatlint",
78
78
  "license": "MIT",
79
- "engines": {
80
- "node": ">=18"
81
- },
82
79
  "dependencies": {
83
80
  "@putout/engine-loader": "^15.1.1",
84
81
  "@putout/operator-keyword": "^2.0.0",
@@ -87,16 +84,19 @@
87
84
  },
88
85
  "devDependencies": {
89
86
  "@putout/formatter-json": "^2.0.0",
90
- "@putout/test": "^12.0.1",
87
+ "@putout/test": "^13.0.0",
91
88
  "c8": "^10.1.2",
92
89
  "eslint": "^9.7.0",
93
- "eslint-plugin-putout": "^25.0.2",
94
- "madrun": "^10.2.2",
90
+ "eslint-plugin-putout": "^26.1.0",
91
+ "madrun": "^11.0.0",
95
92
  "mock-require": "^3.0.3",
96
93
  "montag": "^1.0.0",
97
94
  "nodemon": "^3.0.1",
98
- "putout": "^38.0.0",
99
- "supertape": "^10.0.0"
95
+ "putout": "^39.3.0",
96
+ "supertape": "^11.0.4"
97
+ },
98
+ "engines": {
99
+ "node": ">=20"
100
100
  },
101
101
  "publishConfig": {
102
102
  "access": "public"