@saasmakers/eslint 1.0.8 → 1.0.9
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/dist/index.cjs +15 -3
- package/dist/index.mjs +15 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -178,8 +178,14 @@ function getStatementKind(node) {
|
|
|
178
178
|
}
|
|
179
179
|
return null;
|
|
180
180
|
}
|
|
181
|
-
if (node.type === index$1.distExports.AST_NODE_TYPES.ExpressionStatement
|
|
182
|
-
|
|
181
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.ExpressionStatement) {
|
|
182
|
+
if (node.expression.type === index$1.distExports.AST_NODE_TYPES.AwaitExpression) {
|
|
183
|
+
return isSingleLine(node) ? "singleline-await" : "multiline-await";
|
|
184
|
+
}
|
|
185
|
+
if (isDirectivePrologue(node)) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
return isSingleLine(node) ? "singleline-expression" : "multiline-expression";
|
|
183
189
|
}
|
|
184
190
|
return null;
|
|
185
191
|
}
|
|
@@ -199,6 +205,12 @@ function hasLineCommentBetween(prevNode, nextNode, sourceCode) {
|
|
|
199
205
|
return comment.range[0] >= prevNode.range[1] && comment.range[1] <= nextNode.range[0];
|
|
200
206
|
});
|
|
201
207
|
}
|
|
208
|
+
function isDirectivePrologue(node) {
|
|
209
|
+
if (node.expression.type !== index$1.distExports.AST_NODE_TYPES.Literal) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
return typeof node.expression.value === "string";
|
|
213
|
+
}
|
|
202
214
|
function isOwnLineComment(comment, sourceCode) {
|
|
203
215
|
if (comment.type !== "Line") {
|
|
204
216
|
return false;
|
|
@@ -212,7 +224,7 @@ function isSingleLine(node) {
|
|
|
212
224
|
const rule$a = {
|
|
213
225
|
defaultOptions: [],
|
|
214
226
|
meta: {
|
|
215
|
-
docs: { description: "Require or disallow padding lines between const, let, and
|
|
227
|
+
docs: { description: "Require or disallow padding lines between const, let, await, and expression statements" },
|
|
216
228
|
fixable: "whitespace",
|
|
217
229
|
messages: {
|
|
218
230
|
expectedBlankLine: "Expected blank line before this statement.",
|
package/dist/index.mjs
CHANGED
|
@@ -176,8 +176,14 @@ function getStatementKind(node) {
|
|
|
176
176
|
}
|
|
177
177
|
return null;
|
|
178
178
|
}
|
|
179
|
-
if (node.type === distExports.AST_NODE_TYPES.ExpressionStatement
|
|
180
|
-
|
|
179
|
+
if (node.type === distExports.AST_NODE_TYPES.ExpressionStatement) {
|
|
180
|
+
if (node.expression.type === distExports.AST_NODE_TYPES.AwaitExpression) {
|
|
181
|
+
return isSingleLine(node) ? "singleline-await" : "multiline-await";
|
|
182
|
+
}
|
|
183
|
+
if (isDirectivePrologue(node)) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
return isSingleLine(node) ? "singleline-expression" : "multiline-expression";
|
|
181
187
|
}
|
|
182
188
|
return null;
|
|
183
189
|
}
|
|
@@ -197,6 +203,12 @@ function hasLineCommentBetween(prevNode, nextNode, sourceCode) {
|
|
|
197
203
|
return comment.range[0] >= prevNode.range[1] && comment.range[1] <= nextNode.range[0];
|
|
198
204
|
});
|
|
199
205
|
}
|
|
206
|
+
function isDirectivePrologue(node) {
|
|
207
|
+
if (node.expression.type !== distExports.AST_NODE_TYPES.Literal) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
return typeof node.expression.value === "string";
|
|
211
|
+
}
|
|
200
212
|
function isOwnLineComment(comment, sourceCode) {
|
|
201
213
|
if (comment.type !== "Line") {
|
|
202
214
|
return false;
|
|
@@ -210,7 +222,7 @@ function isSingleLine(node) {
|
|
|
210
222
|
const rule$a = {
|
|
211
223
|
defaultOptions: [],
|
|
212
224
|
meta: {
|
|
213
|
-
docs: { description: "Require or disallow padding lines between const, let, and
|
|
225
|
+
docs: { description: "Require or disallow padding lines between const, let, await, and expression statements" },
|
|
214
226
|
fixable: "whitespace",
|
|
215
227
|
messages: {
|
|
216
228
|
expectedBlankLine: "Expected blank line before this statement.",
|