flatlint 1.78.0 → 1.80.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,13 @@
1
+ 2025.01.22, v1.80.0
2
+
3
+ feature:
4
+ - 5cc2029 flatlint: add-missing-assing: exclude for
5
+
6
+ 2025.01.22, v1.79.0
7
+
8
+ feature:
9
+ - 3af1666 flatlint: convert-comma-to-semicolon: exclude: openCurlyBrace
10
+
1
11
  2025.01.22, v1.78.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
 
@@ -6,6 +6,7 @@ import {
6
6
  isOneOfKeywords,
7
7
  isOneOfPunctuators,
8
8
  isPunctuator,
9
+ openCurlyBrace,
9
10
  openRoundBrace,
10
11
  openSquireBrace,
11
12
  quote,
@@ -38,9 +39,7 @@ export const match = () => ({
38
39
 
39
40
  return !path.isNextPunctuator(quote);
40
41
  },
41
- '__a.__b = __expr,': ({__expr}, path) => {
42
- return !path.isNextPunctuator(quote);
43
- },
42
+ '__a.__b = __expr,': ({}, path) => !path.isNextPunctuator([quote, openCurlyBrace]),
44
43
  });
45
44
 
46
45
  export const replace = () => ({
@@ -52,7 +51,7 @@ export const replace = () => ({
52
51
  '__a.__b = __expr,': '__a.__b = __expr;',
53
52
  });
54
53
 
55
- const check = ({__x, __a}, path) => {
54
+ const check = ({__x}, path) => {
56
55
  if (!isOneOfKeywords(__x, ['var', 'let', 'const']))
57
56
  return false;
58
57
 
@@ -64,4 +63,3 @@ const check = ({__x, __a}, path) => {
64
63
 
65
64
  return path.isNextKeyword() && !path.isNextIdentifier('new');
66
65
  };
67
-
@@ -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) => {
@@ -25,7 +25,10 @@ export const isStringLiteral = ({type}) => type === 'StringLiteral';
25
25
  export const isNumericLiteral = ({type}) => type === 'NumericLiteral';
26
26
  export const isNewLine = ({type}) => type === 'LineTerminatorSequence';
27
27
  export const notWhiteSpace = (a) => !isWhiteSpace(a);
28
- export const isKeyword = (token) => {
28
+ export const isKeyword = (token, name) => {
29
+ if (!token)
30
+ return false;
31
+
29
32
  const keywords = [
30
33
  'as',
31
34
  'await',
@@ -200,3 +203,4 @@ export const isBalancedRoundBraces = (tokens) => {
200
203
 
201
204
  return !roundBalance;
202
205
  };
206
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.78.0",
3
+ "version": "1.80.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",