flatlint 1.39.0 → 1.39.2
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 +10 -0
- package/lib/compare/values.js +0 -1
- package/lib/plugins/add-missing-comma/index.js +2 -14
- package/lib/plugins.js +3 -1
- package/lib/runner/path.js +3 -0
- package/lib/types/types.js +4 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/lib/compare/values.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
comma,
|
|
3
|
-
isPunctuator,
|
|
4
|
-
semicolon,
|
|
5
|
-
arrow,
|
|
6
|
-
openCurlyBrace,
|
|
7
|
-
closeRoundBrace,
|
|
8
|
-
dot,
|
|
9
|
-
isIdentifier,
|
|
10
|
-
isOperator,
|
|
11
|
-
} from '#types';
|
|
1
|
+
import {isIdentifier, isOperator} from '#types';
|
|
12
2
|
|
|
13
3
|
export const report = () => 'Add missing comma';
|
|
14
4
|
|
|
@@ -20,12 +10,10 @@ export const match = () => ({
|
|
|
20
10
|
if (isOperator(__a))
|
|
21
11
|
return false;
|
|
22
12
|
|
|
23
|
-
return !path.isNextPunctuator(
|
|
13
|
+
return !path.isNextPunctuator();
|
|
24
14
|
},
|
|
25
15
|
});
|
|
26
16
|
|
|
27
17
|
export const replace = () => ({
|
|
28
18
|
__a: '__a,',
|
|
29
19
|
});
|
|
30
|
-
|
|
31
|
-
|
package/lib/plugins.js
CHANGED
|
@@ -3,18 +3,20 @@ import * as addMissingRoundBraces from './plugins/add-missing-round-braces/index
|
|
|
3
3
|
import * as addMissingSquireBrace from './plugins/add-missing-square-brace/index.js';
|
|
4
4
|
import * as addMissingQuote from './plugins/add-missing-quote/index.js';
|
|
5
5
|
import * as addMissingSemicolon from './plugins/add-missing-semicolon/index.js';
|
|
6
|
+
import * as addMissingComma from './plugins/add-missing-comma/index.js';
|
|
7
|
+
import * as addConstToExport from './plugins/add-const-to-export/index.js';
|
|
6
8
|
import * as convertCommaToSemicolon from './plugins/convert-comma-to-semicolon/index.js';
|
|
7
9
|
import * as convertFromToRequire from './plugins/convert-from-to-require/index.js';
|
|
8
10
|
import * as removeUselessRoundBrace from './plugins/remove-useless-round-brace/index.js';
|
|
9
11
|
import * as removeUselessComma from './plugins/remove-useless-comma/index.js';
|
|
10
12
|
import * as removeInvalidCharacter from './plugins/remove-invalid-character/index.js';
|
|
11
|
-
import * as addConstToExport from './plugins/add-const-to-export/index.js';
|
|
12
13
|
|
|
13
14
|
export const plugins = [
|
|
14
15
|
['wrap-assignment-in-parens', wrapAssignmentInParens],
|
|
15
16
|
['add-missing-round-braces', addMissingRoundBraces],
|
|
16
17
|
['add-missing-squire-brace', addMissingSquireBrace],
|
|
17
18
|
['add-missing-semicolon', addMissingSemicolon],
|
|
19
|
+
['add-missing-comma', addMissingComma],
|
|
18
20
|
['add-missing-quote', addMissingQuote],
|
|
19
21
|
['add-const-to-export', addConstToExport],
|
|
20
22
|
['convert-comma-to-semicolon', convertCommaToSemicolon],
|
package/lib/runner/path.js
CHANGED
|
@@ -121,6 +121,9 @@ const createIsNextPunctuator = ({tokens, end}) => (punctuators) => {
|
|
|
121
121
|
if (!current)
|
|
122
122
|
return false;
|
|
123
123
|
|
|
124
|
+
if (!punctuators)
|
|
125
|
+
return isPunctuator(current);
|
|
126
|
+
|
|
124
127
|
for (const punctuator of maybeArray(punctuators)) {
|
|
125
128
|
if (isPunctuator(current, punctuator))
|
|
126
129
|
return true;
|
package/lib/types/types.js
CHANGED
|
@@ -23,6 +23,8 @@ export const isOperator = (token) => {
|
|
|
23
23
|
'export',
|
|
24
24
|
'from',
|
|
25
25
|
'import',
|
|
26
|
+
'return',
|
|
27
|
+
'function',
|
|
26
28
|
];
|
|
27
29
|
|
|
28
30
|
for (const operator of operators) {
|
|
@@ -100,6 +102,8 @@ export const closeSquareBrace = Punctuator(']');
|
|
|
100
102
|
export const colon = Punctuator(':');
|
|
101
103
|
export const comma = Punctuator(',');
|
|
102
104
|
export const dot = Punctuator('.');
|
|
105
|
+
export const more = Punctuator('>');
|
|
106
|
+
export const assign = Punctuator('=');
|
|
103
107
|
export const openRoundBrace = Punctuator('(');
|
|
104
108
|
export const semicolon = Punctuator(';');
|
|
105
109
|
export const openCurlyBrace = Punctuator('{');
|