@saasmakers/eslint 1.0.16 → 1.0.18
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 +30 -11
- package/dist/index.mjs +30 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -143,18 +143,19 @@ function expressionStartsWithIdentifier(node, identifier) {
|
|
|
143
143
|
if (node.type === index$1.distExports.AST_NODE_TYPES.Identifier && node.name === identifier) {
|
|
144
144
|
return true;
|
|
145
145
|
}
|
|
146
|
-
if (node.type === index$1.distExports.AST_NODE_TYPES.CallExpression
|
|
147
|
-
|
|
146
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.CallExpression) {
|
|
147
|
+
const { callee } = node;
|
|
148
|
+
if (callee.type === index$1.distExports.AST_NODE_TYPES.Identifier && callee.name === identifier) {
|
|
148
149
|
return true;
|
|
149
150
|
}
|
|
150
|
-
if (
|
|
151
|
-
return expressionStartsWithIdentifier(
|
|
151
|
+
if (callee.type === index$1.distExports.AST_NODE_TYPES.MemberExpression) {
|
|
152
|
+
return expressionStartsWithIdentifier(callee.object, identifier);
|
|
152
153
|
}
|
|
153
|
-
if (
|
|
154
|
-
return expressionStartsWithIdentifier(
|
|
154
|
+
if (callee.type === index$1.distExports.AST_NODE_TYPES.ChainExpression) {
|
|
155
|
+
return expressionStartsWithIdentifier(callee.expression, identifier);
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
|
-
if (node.type === index$1.distExports.AST_NODE_TYPES.MemberExpression
|
|
158
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.MemberExpression) {
|
|
158
159
|
return expressionStartsWithIdentifier(node.object, identifier);
|
|
159
160
|
}
|
|
160
161
|
if (node.type === index$1.distExports.AST_NODE_TYPES.ChainExpression) {
|
|
@@ -169,9 +170,6 @@ function expressionUsesThis(expression) {
|
|
|
169
170
|
if (expression.type === index$1.distExports.AST_NODE_TYPES.CallExpression) {
|
|
170
171
|
return isThisReceiver(expression.callee);
|
|
171
172
|
}
|
|
172
|
-
if (expression.type === index$1.distExports.AST_NODE_TYPES.OptionalCallExpression) {
|
|
173
|
-
return isThisReceiver(expression.callee);
|
|
174
|
-
}
|
|
175
173
|
if (expression.type === index$1.distExports.AST_NODE_TYPES.UpdateExpression) {
|
|
176
174
|
return isThisReceiver(expression.argument);
|
|
177
175
|
}
|
|
@@ -249,6 +247,27 @@ function getStatementKind(node) {
|
|
|
249
247
|
}
|
|
250
248
|
return isSingleLine(node) ? "singleline-expression" : "multiline-expression";
|
|
251
249
|
}
|
|
250
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.IfStatement) {
|
|
251
|
+
return isSingleLine(node) ? "singleline-if" : "multiline-if";
|
|
252
|
+
}
|
|
253
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.ForStatement || node.type === index$1.distExports.AST_NODE_TYPES.ForInStatement || node.type === index$1.distExports.AST_NODE_TYPES.ForOfStatement || node.type === index$1.distExports.AST_NODE_TYPES.WhileStatement || node.type === index$1.distExports.AST_NODE_TYPES.DoWhileStatement) {
|
|
254
|
+
return isSingleLine(node) ? "singleline-loop" : "multiline-loop";
|
|
255
|
+
}
|
|
256
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.ReturnStatement) {
|
|
257
|
+
return isSingleLine(node) ? "singleline-return" : "multiline-return";
|
|
258
|
+
}
|
|
259
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.SwitchStatement) {
|
|
260
|
+
return isSingleLine(node) ? "singleline-switch" : "multiline-switch";
|
|
261
|
+
}
|
|
262
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.TryStatement) {
|
|
263
|
+
return isSingleLine(node) ? "singleline-try" : "multiline-try";
|
|
264
|
+
}
|
|
265
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.BreakStatement || node.type === index$1.distExports.AST_NODE_TYPES.ContinueStatement) {
|
|
266
|
+
return isSingleLine(node) ? "singleline-jump" : "multiline-jump";
|
|
267
|
+
}
|
|
268
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.ThrowStatement) {
|
|
269
|
+
return isSingleLine(node) ? "singleline-throw" : "multiline-throw";
|
|
270
|
+
}
|
|
252
271
|
return null;
|
|
253
272
|
}
|
|
254
273
|
function hasEmptyLineBetween(prevNode, nextNode, sourceCode) {
|
|
@@ -299,7 +318,7 @@ function isThisReceiver(node) {
|
|
|
299
318
|
if (node.type === index$1.distExports.AST_NODE_TYPES.ThisExpression) {
|
|
300
319
|
return true;
|
|
301
320
|
}
|
|
302
|
-
if (node.type === index$1.distExports.AST_NODE_TYPES.MemberExpression
|
|
321
|
+
if (node.type === index$1.distExports.AST_NODE_TYPES.MemberExpression) {
|
|
303
322
|
return isThisReceiver(node.object);
|
|
304
323
|
}
|
|
305
324
|
if (node.type === index$1.distExports.AST_NODE_TYPES.ChainExpression) {
|
package/dist/index.mjs
CHANGED
|
@@ -141,18 +141,19 @@ function expressionStartsWithIdentifier(node, identifier) {
|
|
|
141
141
|
if (node.type === distExports.AST_NODE_TYPES.Identifier && node.name === identifier) {
|
|
142
142
|
return true;
|
|
143
143
|
}
|
|
144
|
-
if (node.type === distExports.AST_NODE_TYPES.CallExpression
|
|
145
|
-
|
|
144
|
+
if (node.type === distExports.AST_NODE_TYPES.CallExpression) {
|
|
145
|
+
const { callee } = node;
|
|
146
|
+
if (callee.type === distExports.AST_NODE_TYPES.Identifier && callee.name === identifier) {
|
|
146
147
|
return true;
|
|
147
148
|
}
|
|
148
|
-
if (
|
|
149
|
-
return expressionStartsWithIdentifier(
|
|
149
|
+
if (callee.type === distExports.AST_NODE_TYPES.MemberExpression) {
|
|
150
|
+
return expressionStartsWithIdentifier(callee.object, identifier);
|
|
150
151
|
}
|
|
151
|
-
if (
|
|
152
|
-
return expressionStartsWithIdentifier(
|
|
152
|
+
if (callee.type === distExports.AST_NODE_TYPES.ChainExpression) {
|
|
153
|
+
return expressionStartsWithIdentifier(callee.expression, identifier);
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
|
-
if (node.type === distExports.AST_NODE_TYPES.MemberExpression
|
|
156
|
+
if (node.type === distExports.AST_NODE_TYPES.MemberExpression) {
|
|
156
157
|
return expressionStartsWithIdentifier(node.object, identifier);
|
|
157
158
|
}
|
|
158
159
|
if (node.type === distExports.AST_NODE_TYPES.ChainExpression) {
|
|
@@ -167,9 +168,6 @@ function expressionUsesThis(expression) {
|
|
|
167
168
|
if (expression.type === distExports.AST_NODE_TYPES.CallExpression) {
|
|
168
169
|
return isThisReceiver(expression.callee);
|
|
169
170
|
}
|
|
170
|
-
if (expression.type === distExports.AST_NODE_TYPES.OptionalCallExpression) {
|
|
171
|
-
return isThisReceiver(expression.callee);
|
|
172
|
-
}
|
|
173
171
|
if (expression.type === distExports.AST_NODE_TYPES.UpdateExpression) {
|
|
174
172
|
return isThisReceiver(expression.argument);
|
|
175
173
|
}
|
|
@@ -247,6 +245,27 @@ function getStatementKind(node) {
|
|
|
247
245
|
}
|
|
248
246
|
return isSingleLine(node) ? "singleline-expression" : "multiline-expression";
|
|
249
247
|
}
|
|
248
|
+
if (node.type === distExports.AST_NODE_TYPES.IfStatement) {
|
|
249
|
+
return isSingleLine(node) ? "singleline-if" : "multiline-if";
|
|
250
|
+
}
|
|
251
|
+
if (node.type === distExports.AST_NODE_TYPES.ForStatement || node.type === distExports.AST_NODE_TYPES.ForInStatement || node.type === distExports.AST_NODE_TYPES.ForOfStatement || node.type === distExports.AST_NODE_TYPES.WhileStatement || node.type === distExports.AST_NODE_TYPES.DoWhileStatement) {
|
|
252
|
+
return isSingleLine(node) ? "singleline-loop" : "multiline-loop";
|
|
253
|
+
}
|
|
254
|
+
if (node.type === distExports.AST_NODE_TYPES.ReturnStatement) {
|
|
255
|
+
return isSingleLine(node) ? "singleline-return" : "multiline-return";
|
|
256
|
+
}
|
|
257
|
+
if (node.type === distExports.AST_NODE_TYPES.SwitchStatement) {
|
|
258
|
+
return isSingleLine(node) ? "singleline-switch" : "multiline-switch";
|
|
259
|
+
}
|
|
260
|
+
if (node.type === distExports.AST_NODE_TYPES.TryStatement) {
|
|
261
|
+
return isSingleLine(node) ? "singleline-try" : "multiline-try";
|
|
262
|
+
}
|
|
263
|
+
if (node.type === distExports.AST_NODE_TYPES.BreakStatement || node.type === distExports.AST_NODE_TYPES.ContinueStatement) {
|
|
264
|
+
return isSingleLine(node) ? "singleline-jump" : "multiline-jump";
|
|
265
|
+
}
|
|
266
|
+
if (node.type === distExports.AST_NODE_TYPES.ThrowStatement) {
|
|
267
|
+
return isSingleLine(node) ? "singleline-throw" : "multiline-throw";
|
|
268
|
+
}
|
|
250
269
|
return null;
|
|
251
270
|
}
|
|
252
271
|
function hasEmptyLineBetween(prevNode, nextNode, sourceCode) {
|
|
@@ -297,7 +316,7 @@ function isThisReceiver(node) {
|
|
|
297
316
|
if (node.type === distExports.AST_NODE_TYPES.ThisExpression) {
|
|
298
317
|
return true;
|
|
299
318
|
}
|
|
300
|
-
if (node.type === distExports.AST_NODE_TYPES.MemberExpression
|
|
319
|
+
if (node.type === distExports.AST_NODE_TYPES.MemberExpression) {
|
|
301
320
|
return isThisReceiver(node.object);
|
|
302
321
|
}
|
|
303
322
|
if (node.type === distExports.AST_NODE_TYPES.ChainExpression) {
|