@saasmakers/eslint 1.0.18 → 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) {
@@ -393,7 +393,7 @@ const rule$a = {
393
393
  return;
394
394
  }
395
395
  const previousLine = sourceCode.lines[commentLine - 2] ?? "";
396
- if (previousLine.trim() === "" || previousLine.trimEnd().endsWith("{")) {
396
+ if (previousLine.trim() === "" || previousLine.trimEnd().endsWith("{") || previousLine.trimStart().startsWith("//")) {
397
397
  return;
398
398
  }
399
399
  context.report({
@@ -440,9 +440,13 @@ const rule$a = {
440
440
  ":statement": verify,
441
441
  "BlockStatement": enterScope,
442
442
  "BlockStatement:exit": exitScope,
443
- "LineComment": verifyComment,
444
443
  "Program": enterScope,
445
- "Program:exit": exitScope,
444
+ "Program:exit": function() {
445
+ for (const comment of sourceCode.getAllComments()) {
446
+ verifyComment(comment);
447
+ }
448
+ exitScope();
449
+ },
446
450
  "StaticBlock": enterScope,
447
451
  "StaticBlock:exit": exitScope,
448
452
  "SwitchCase": verifyThenEnterScope,
@@ -480,8 +484,9 @@ function getSpecificName(testName) {
480
484
  return parts.slice(specialIndex + 1).join(".");
481
485
  }
482
486
  function getTestName(node) {
483
- if (node.arguments && node.arguments[0] && node.arguments[0].type === "Literal") {
484
- 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;
485
490
  }
486
491
  return "";
487
492
  }
@@ -499,11 +504,9 @@ function getTestPriority(testName) {
499
504
  }
500
505
  }
501
506
  const rule$9 = {
507
+ defaultOptions: [],
502
508
  meta: {
503
- docs: {
504
- description: "Enforce sorted test functions grouped by method with sorted metrics, errors, exceptions and middlewares",
505
- recommended: true
506
- },
509
+ docs: { description: "Enforce sorted test functions grouped by method with sorted metrics, errors, exceptions and middlewares" },
507
510
  fixable: "code",
508
511
  messages: { sortError: "Test functions should be grouped by method with sorted metrics, errors, exceptions and middlewares." },
509
512
  schema: [],
@@ -519,15 +522,15 @@ const rule$9 = {
519
522
  return;
520
523
  }
521
524
  const groupCallback = node.arguments[1];
522
- if (groupCallback.type !== "FunctionExpression" && groupCallback.type !== "ArrowFunctionExpression") {
525
+ if (groupCallback.type !== distExports.AST_NODE_TYPES.FunctionExpression && groupCallback.type !== distExports.AST_NODE_TYPES.ArrowFunctionExpression) {
523
526
  return;
524
527
  }
525
528
  const callbackBody = groupCallback.body;
526
- if (callbackBody.type !== "BlockStatement" || !callbackBody.body) {
529
+ if (callbackBody.type !== distExports.AST_NODE_TYPES.BlockStatement || !callbackBody.body) {
527
530
  return;
528
531
  }
529
532
  const tests = callbackBody.body.filter((statement) => {
530
- 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");
531
534
  });
532
535
  const testNames = tests.map((test) => getTestName(test.expression));
533
536
  const sortedTestNames = [...testNames].toSorted(compareTests);