flatlint 1.17.0 → 1.18.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 +5 -0
- package/README.md +11 -0
- package/lib/compare/collect-array.js +7 -1
- package/lib/plugins/remove-useless-arrow/index.js +5 -0
- package/lib/types/types.js +3 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -110,6 +110,17 @@ const a = {
|
|
|
110
110
|
|
|
111
111
|
</details>
|
|
112
112
|
|
|
113
|
+
<details><summary>Remove useless arrow</summary>
|
|
114
|
+
|
|
115
|
+
```diff
|
|
116
|
+
-function parse(source) => {
|
|
117
|
+
+function parse(source) {
|
|
118
|
+
return source;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
</details>
|
|
123
|
+
|
|
113
124
|
## Template literals
|
|
114
125
|
|
|
115
126
|
**FlatLint** uses language similar to 🐊[**PutoutScript**](https://github.com/coderaiser/putout/blob/master/docs/putout-script.md#-putoutscript).
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CloseRoundBrace,
|
|
3
|
+
Punctuator,
|
|
4
|
+
} from '#types';
|
|
2
5
|
import {equal} from './equal.js';
|
|
3
6
|
|
|
4
7
|
export const collectArray = ({currentTokenIndex, tokens, nextTemplateToken = Punctuator(';')}) => {
|
|
@@ -9,6 +12,9 @@ export const collectArray = ({currentTokenIndex, tokens, nextTemplateToken = Pun
|
|
|
9
12
|
for (; index < n; index++) {
|
|
10
13
|
const token = tokens[index];
|
|
11
14
|
|
|
15
|
+
if (equal(token, CloseRoundBrace))
|
|
16
|
+
break;
|
|
17
|
+
|
|
12
18
|
if (equal(token, nextTemplateToken))
|
|
13
19
|
break;
|
|
14
20
|
|
package/lib/types/types.js
CHANGED
|
@@ -53,3 +53,6 @@ export const isTemplateArray = (a) => a === ARRAY;
|
|
|
53
53
|
export const isTemplateExpression = (a) => a === EXPR;
|
|
54
54
|
export const isTemplateArrayToken = (a) => isIdentifier(a) && isTemplateArray(a.value);
|
|
55
55
|
export const isTemplateExpressionToken = (a) => isIdentifier(a) && isTemplateExpression(a.value);
|
|
56
|
+
|
|
57
|
+
export const OpenRoundBrace = Punctuator('(');
|
|
58
|
+
export const CloseRoundBrace = Punctuator(')');
|