You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Statements that can contain an `ExpressionStatement` after a closing parenthesis.
45
+
* DoWhileStatement is an exception in that it always triggers ASI after the closing parenthesis.
46
+
*/
47
+
constSTATEMENTS=newSet([
48
+
"DoWhileStatement",
49
+
"ForInStatement",
50
+
"ForOfStatement",
51
+
"ForStatement",
52
+
"IfStatement",
53
+
"WhileStatement",
54
+
"WithStatement"
55
+
]);
56
+
18
57
/**
19
58
* Tests if a node appears at the beginning of an ancestor ExpressionStatement node.
20
59
* @param {ASTNode} node The node to check.
@@ -53,7 +92,8 @@ module.exports = {
53
92
54
93
messages: {
55
94
preferLiteral: "The object literal notation {} is preferable.",
56
-
useLiteral: "Replace with '{{replacement}}'."
95
+
useLiteral: "Replace with '{{replacement}}'.",
96
+
useLiteralAfterSemicolon: "Replace with '{{replacement}}', add preceding semicolon."
57
97
}
58
98
},
59
99
@@ -80,6 +120,50 @@ module.exports = {
80
120
returnfalse;
81
121
}
82
122
123
+
/**
124
+
* Determines whether a parenthesized object literal that replaces a specified node needs to be preceded by a semicolon.
125
+
* @param {ASTNode} node The node to be replaced. This node should be at the start of an `ExpressionStatement` or at the start of the body of an `ArrowFunctionExpression`.
126
+
* @returns {boolean} Whether a semicolon is required before the parenthesized object literal.
0 commit comments