flatlint 1.52.1 → 1.54.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
package/README.md
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {isOneOfKeywords} from '#types';
|
|
2
|
+
|
|
3
|
+
export const report = () => 'Add missing assign';
|
|
4
|
+
|
|
5
|
+
export const match = () => ({
|
|
6
|
+
'__x __a __b': ({__x}) => {
|
|
7
|
+
return isOneOfKeywords(__x, ['const', 'let', 'var']);
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const replace = () => ({
|
|
12
|
+
'__x __a __b': '__x __a = __b',
|
|
13
|
+
});
|
|
@@ -19,7 +19,7 @@ export const match = () => ({
|
|
|
19
19
|
|
|
20
20
|
return true;
|
|
21
21
|
},
|
|
22
|
-
'__x __a =
|
|
22
|
+
'__x __a = __expr,': check,
|
|
23
23
|
'__x __a,': check,
|
|
24
24
|
'return __expr,': ({__expr}, path) => {
|
|
25
25
|
if (isPunctuator(openRoundBrace, __expr) && !isPunctuator(closeRoundBrace, __expr))
|
|
@@ -35,7 +35,7 @@ export const match = () => ({
|
|
|
35
35
|
export const replace = () => ({
|
|
36
36
|
'from "__a",': 'from "__a";',
|
|
37
37
|
'__x __a,': '__x __a;',
|
|
38
|
-
'__x __a =
|
|
38
|
+
'__x __a = __expr,': '__x __a = __expr;',
|
|
39
39
|
'__a(__args),': '__a(__args);',
|
|
40
40
|
'return __expr,': 'return __expr;',
|
|
41
41
|
});
|
package/lib/plugins.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as addMissingArrow from './plugins/add-missing-arrow/index.js';
|
|
2
|
+
import * as addMissingAssign from './plugins/add-missing-assign/index.js';
|
|
2
3
|
import * as addMissingRoundBrace from './plugins/add-missing-round-brace/index.js';
|
|
3
4
|
import * as addMissingSquireBrace from './plugins/add-missing-square-brace/index.js';
|
|
4
5
|
import * as addMissingQuote from './plugins/add-missing-quote/index.js';
|
|
@@ -14,6 +15,7 @@ import * as wrapAssignmentInParens from './plugins/wrap-assignment-in-parens/ind
|
|
|
14
15
|
|
|
15
16
|
export const plugins = [
|
|
16
17
|
['add-missing-arrow', addMissingArrow],
|
|
18
|
+
['add-missing-assign', addMissingAssign],
|
|
17
19
|
['add-missing-round-brace', addMissingRoundBrace],
|
|
18
20
|
['add-missing-squire-brace', addMissingSquireBrace],
|
|
19
21
|
['add-missing-semicolon', addMissingSemicolon],
|