flatlint 1.50.0 → 1.52.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.15, v1.52.0
2
+
3
+ feature:
4
+ - b488e9f flatlint: isNextTemplateTail -> isInsideTemplate
5
+
6
+ 2025.01.14, v1.51.0
7
+
8
+ feature:
9
+ - 840fd6f flatlint: add-missing-comma: exclude: yield
10
+
1
11
  2025.01.14, v1.50.0
2
12
 
3
13
  feature:
@@ -10,7 +10,7 @@ export const match = () => ({
10
10
  if (path.isNextKeyword())
11
11
  return false;
12
12
 
13
- if (path.isNextTemplateTail())
13
+ if (path.isInsideTemplate())
14
14
  return false;
15
15
 
16
16
  return !path.isNextPunctuator();
@@ -46,7 +46,7 @@ export const match = () => ({
46
46
  if (path.isNextPunctuator(punctuators))
47
47
  return false;
48
48
 
49
- if (path.isNextTemplateTail())
49
+ if (path.isInsideTemplate())
50
50
  return false;
51
51
 
52
52
  return !path.isPrevIdentifier('function');
@@ -5,6 +5,7 @@ import {
5
5
  isPunctuator,
6
6
  isWhiteSpace,
7
7
  isTemplateTail,
8
+ isTemplateMiddle,
8
9
  } from '#types';
9
10
 
10
11
  const {isArray} = Array;
@@ -34,7 +35,7 @@ export const createPath = ({tokens, start, end}) => ({
34
35
  tokens,
35
36
  end,
36
37
  }),
37
- isNextTemplateTail: createIsNextTemplateTail({
38
+ isInsideTemplate: createIsInsideTemplate({
38
39
  tokens,
39
40
  end,
40
41
  }),
@@ -108,13 +109,16 @@ const createIsNextIdentifier = ({tokens, end}) => (value) => {
108
109
  return isIdentifier(current, value);
109
110
  };
110
111
 
111
- const createIsNextTemplateTail = ({tokens, end}) => () => {
112
+ const createIsInsideTemplate = ({tokens, end}) => () => {
112
113
  const current = next({
113
114
  tokens,
114
115
  end,
115
116
  });
116
117
 
117
- return isTemplateTail(current);
118
+ if (isTemplateTail(current))
119
+ return true;
120
+
121
+ return isTemplateMiddle(current);
118
122
  };
119
123
 
120
124
  const createIsNextKeyword = ({tokens, end}) => () => {
@@ -2,6 +2,7 @@ const {isArray} = Array;
2
2
  const maybeArray = (a) => isArray(a) ? a : [a];
3
3
  const isString = (a) => typeof a === 'string';
4
4
 
5
+ export const isTemplateMiddle = (a) => a?.type === 'TemplateMiddle';
5
6
  export const isTemplateTail = (a) => a?.type === 'TemplateTail';
6
7
  export const isWhiteSpace = ({type}) => type === 'WhiteSpace';
7
8
  export const isIdentifier = (token, newToken) => {
@@ -36,6 +37,7 @@ export const isKeyword = (token) => {
36
37
  'return',
37
38
  'function',
38
39
  'of',
40
+ 'yield',
39
41
  'typeof',
40
42
  ];
41
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.50.0",
3
+ "version": "1.52.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",