flatlint 1.40.0 → 1.42.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.13, v1.42.0
2
+
3
+ feature:
4
+ - 1a4e041 flatlint: add-missing-comma: exclude: as, from
5
+
6
+ 2025.01.13, v1.41.0
7
+
8
+ feature:
9
+ - 677b162 flatlint: add-missing-semicolon: exclude template tail
10
+
1
11
  2025.01.13, v1.40.0
2
12
 
3
13
  feature:
@@ -7,6 +7,9 @@ export const match = () => ({
7
7
  if (isKeyword(__a))
8
8
  return false;
9
9
 
10
+ if (path.isNextKeyword())
11
+ return false;
12
+
10
13
  return !path.isNextPunctuator();
11
14
  },
12
15
  });
@@ -14,4 +17,3 @@ export const match = () => ({
14
17
  export const replace = () => ({
15
18
  __a: '__a,',
16
19
  });
17
-
@@ -41,6 +41,9 @@ export const match = () => ({
41
41
  if (path.isNextPunctuator(punctuators))
42
42
  return false;
43
43
 
44
+ if (path.isNextTemplateTail())
45
+ return false;
46
+
44
47
  return !path.isPrevIdentifier('function');
45
48
  },
46
49
  '})': (vars, path) => {
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  colon,
3
- isKeyword,
4
3
  isOneOfKeywords,
5
4
  isPunctuator,
6
5
  quote,
@@ -4,6 +4,7 @@ import {
4
4
  isKeyword,
5
5
  isPunctuator,
6
6
  isWhiteSpace,
7
+ isTemplateTail,
7
8
  } from '#types';
8
9
 
9
10
  const {isArray} = Array;
@@ -33,6 +34,10 @@ export const createPath = ({tokens, start, end}) => ({
33
34
  tokens,
34
35
  end,
35
36
  }),
37
+ isNextTemplateTail: createIsNextTemplateTail({
38
+ tokens,
39
+ end,
40
+ }),
36
41
  isNext: createIsNext({
37
42
  tokens,
38
43
  end,
@@ -103,6 +108,15 @@ const createIsNextIdentifier = ({tokens, end}) => (value) => {
103
108
  return isIdentifier(current, value);
104
109
  };
105
110
 
111
+ const createIsNextTemplateTail = ({tokens, end}) => () => {
112
+ const current = next({
113
+ tokens,
114
+ end,
115
+ });
116
+
117
+ return isTemplateTail(current);
118
+ };
119
+
106
120
  const createIsNextKeyword = ({tokens, end}) => () => {
107
121
  const current = next({
108
122
  tokens,
@@ -1,7 +1,6 @@
1
- const {isArray} = Array;
2
- const maybeArray = (a) => isArray(a) ? a : [a];
3
1
  const isString = (a) => typeof a === 'string';
4
2
 
3
+ export const isTemplateTail = (a) => a?.type === 'TemplateTail';
5
4
  export const isWhiteSpace = ({type}) => type === 'WhiteSpace';
6
5
  export const isIdentifier = (token, value = token.value) => {
7
6
  const {type} = token;
@@ -19,6 +18,7 @@ export const isNewLine = ({type}) => type === 'LineTerminatorSequence';
19
18
  export const notWhiteSpace = (a) => !isWhiteSpace(a);
20
19
  export const isKeyword = (token) => {
21
20
  const keywords = [
21
+ 'as',
22
22
  'await',
23
23
  'var',
24
24
  'let',
@@ -126,4 +126,3 @@ export const quote = Punctuator(`'`);
126
126
 
127
127
  export const OK = true;
128
128
  export const NOT_OK = false;
129
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.40.0",
3
+ "version": "1.42.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",