@saasmakers/eslint 1.0.17 → 1.0.19

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { d as distExports } from './shared/eslint.CohBuu1-.mjs';
1
+ import { d as distExports } from './shared/eslint.DOaqyhfZ.mjs';
2
2
  import 'eslint';
3
3
  import 'eslint/use-at-your-own-risk';
4
4
 
@@ -191,7 +191,7 @@ function getBlankLineRequirement(prevNode, nextNode, sourceCode) {
191
191
  return null;
192
192
  }
193
193
  if (hasLineCommentBetween(prevNode, nextNode, sourceCode)) {
194
- return "always";
194
+ return null;
195
195
  }
196
196
  const nextKind = getStatementKind(nextNode);
197
197
  if (!nextKind) {
@@ -245,6 +245,27 @@ function getStatementKind(node) {
245
245
  }
246
246
  return isSingleLine(node) ? "singleline-expression" : "multiline-expression";
247
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
+ }
248
269
  return null;
249
270
  }
250
271
  function hasEmptyLineBetween(prevNode, nextNode, sourceCode) {
@@ -372,7 +393,7 @@ const rule$a = {
372
393
  return;
373
394
  }
374
395
  const previousLine = sourceCode.lines[commentLine - 2] ?? "";
375
- if (previousLine.trim() === "" || previousLine.trimEnd().endsWith("{")) {
396
+ if (previousLine.trim() === "" || previousLine.trimEnd().endsWith("{") || previousLine.trimStart().startsWith("//")) {
376
397
  return;
377
398
  }
378
399
  context.report({
@@ -419,9 +440,13 @@ const rule$a = {
419
440
  ":statement": verify,
420
441
  "BlockStatement": enterScope,
421
442
  "BlockStatement:exit": exitScope,
422
- "LineComment": verifyComment,
423
443
  "Program": enterScope,
424
- "Program:exit": exitScope,
444
+ "Program:exit": function() {
445
+ for (const comment of sourceCode.getAllComments()) {
446
+ verifyComment(comment);
447
+ }
448
+ exitScope();
449
+ },
425
450
  "StaticBlock": enterScope,
426
451
  "StaticBlock:exit": exitScope,
427
452
  "SwitchCase": verifyThenEnterScope,
@@ -459,8 +484,9 @@ function getSpecificName(testName) {
459
484
  return parts.slice(specialIndex + 1).join(".");
460
485
  }
461
486
  function getTestName(node) {
462
- if (node.arguments && node.arguments[0] && node.arguments[0].type === "Literal") {
463
- return node.arguments[0].value;
487
+ const firstArgument = node.arguments[0];
488
+ if (firstArgument?.type === distExports.AST_NODE_TYPES.Literal && typeof firstArgument.value === "string") {
489
+ return firstArgument.value;
464
490
  }
465
491
  return "";
466
492
  }
@@ -478,11 +504,9 @@ function getTestPriority(testName) {
478
504
  }
479
505
  }
480
506
  const rule$9 = {
507
+ defaultOptions: [],
481
508
  meta: {
482
- docs: {
483
- description: "Enforce sorted test functions grouped by method with sorted metrics, errors, exceptions and middlewares",
484
- recommended: true
485
- },
509
+ docs: { description: "Enforce sorted test functions grouped by method with sorted metrics, errors, exceptions and middlewares" },
486
510
  fixable: "code",
487
511
  messages: { sortError: "Test functions should be grouped by method with sorted metrics, errors, exceptions and middlewares." },
488
512
  schema: [],
@@ -498,15 +522,15 @@ const rule$9 = {
498
522
  return;
499
523
  }
500
524
  const groupCallback = node.arguments[1];
501
- if (groupCallback.type !== "FunctionExpression" && groupCallback.type !== "ArrowFunctionExpression") {
525
+ if (groupCallback.type !== distExports.AST_NODE_TYPES.FunctionExpression && groupCallback.type !== distExports.AST_NODE_TYPES.ArrowFunctionExpression) {
502
526
  return;
503
527
  }
504
528
  const callbackBody = groupCallback.body;
505
- if (callbackBody.type !== "BlockStatement" || !callbackBody.body) {
529
+ if (callbackBody.type !== distExports.AST_NODE_TYPES.BlockStatement || !callbackBody.body) {
506
530
  return;
507
531
  }
508
532
  const tests = callbackBody.body.filter((statement) => {
509
- return statement.type === "ExpressionStatement" && statement.expression.type === "CallExpression" && statement.expression.callee.type === "Identifier" && (statement.expression.callee.name === "test" || statement.expression.callee.name === "it");
533
+ return statement.type === distExports.AST_NODE_TYPES.ExpressionStatement && statement.expression.type === distExports.AST_NODE_TYPES.CallExpression && statement.expression.callee.type === distExports.AST_NODE_TYPES.Identifier && (statement.expression.callee.name === "test" || statement.expression.callee.name === "it");
510
534
  });
511
535
  const testNames = tests.map((test) => getTestName(test.expression));
512
536
  const sortedTestNames = [...testNames].toSorted(compareTests);