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