@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.
@@ -4,7 +4,7 @@ const antfu = require('@antfu/eslint-config');
4
4
  const saasmakers = require('@saasmakers/eslint');
5
5
  const vitest = require('@vitest/eslint-plugin');
6
6
  const packageJson = require('eslint-plugin-package-json');
7
- const index$1 = require('./shared/eslint.DhFjwkxh.cjs');
7
+ const index$1 = require('./shared/eslint.BqRQ4tAN.cjs');
8
8
  const path = require('node:path');
9
9
  const fs = require('node:fs');
10
10
  const node_module = require('node:module');
@@ -2,7 +2,7 @@ import antfu from '@antfu/eslint-config';
2
2
  import saasmakers from '@saasmakers/eslint';
3
3
  import vitest from '@vitest/eslint-plugin';
4
4
  import packageJson from 'eslint-plugin-package-json';
5
- import { d as distExports } from './shared/eslint.CohBuu1-.mjs';
5
+ import { d as distExports } from './shared/eslint.DOaqyhfZ.mjs';
6
6
  import * as path from 'node:path';
7
7
  import * as fs from 'node:fs';
8
8
  import { createRequire, builtinModules } from 'node:module';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index$1 = require('./shared/eslint.DhFjwkxh.cjs');
3
+ const index$1 = require('./shared/eslint.BqRQ4tAN.cjs');
4
4
  require('eslint');
5
5
  require('eslint/use-at-your-own-risk');
6
6
 
@@ -193,7 +193,7 @@ function getBlankLineRequirement(prevNode, nextNode, sourceCode) {
193
193
  return null;
194
194
  }
195
195
  if (hasLineCommentBetween(prevNode, nextNode, sourceCode)) {
196
- return "always";
196
+ return null;
197
197
  }
198
198
  const nextKind = getStatementKind(nextNode);
199
199
  if (!nextKind) {
@@ -395,7 +395,7 @@ const rule$a = {
395
395
  return;
396
396
  }
397
397
  const previousLine = sourceCode.lines[commentLine - 2] ?? "";
398
- if (previousLine.trim() === "" || previousLine.trimEnd().endsWith("{")) {
398
+ if (previousLine.trim() === "" || previousLine.trimEnd().endsWith("{") || previousLine.trimStart().startsWith("//")) {
399
399
  return;
400
400
  }
401
401
  context.report({
@@ -442,9 +442,13 @@ const rule$a = {
442
442
  ":statement": verify,
443
443
  "BlockStatement": enterScope,
444
444
  "BlockStatement:exit": exitScope,
445
- "LineComment": verifyComment,
446
445
  "Program": enterScope,
447
- "Program:exit": exitScope,
446
+ "Program:exit": function() {
447
+ for (const comment of sourceCode.getAllComments()) {
448
+ verifyComment(comment);
449
+ }
450
+ exitScope();
451
+ },
448
452
  "StaticBlock": enterScope,
449
453
  "StaticBlock:exit": exitScope,
450
454
  "SwitchCase": verifyThenEnterScope,
@@ -482,8 +486,9 @@ function getSpecificName(testName) {
482
486
  return parts.slice(specialIndex + 1).join(".");
483
487
  }
484
488
  function getTestName(node) {
485
- if (node.arguments && node.arguments[0] && node.arguments[0].type === "Literal") {
486
- return node.arguments[0].value;
489
+ const firstArgument = node.arguments[0];
490
+ if (firstArgument?.type === index$1.distExports.AST_NODE_TYPES.Literal && typeof firstArgument.value === "string") {
491
+ return firstArgument.value;
487
492
  }
488
493
  return "";
489
494
  }
@@ -501,11 +506,9 @@ function getTestPriority(testName) {
501
506
  }
502
507
  }
503
508
  const rule$9 = {
509
+ defaultOptions: [],
504
510
  meta: {
505
- docs: {
506
- description: "Enforce sorted test functions grouped by method with sorted metrics, errors, exceptions and middlewares",
507
- recommended: true
508
- },
511
+ docs: { description: "Enforce sorted test functions grouped by method with sorted metrics, errors, exceptions and middlewares" },
509
512
  fixable: "code",
510
513
  messages: { sortError: "Test functions should be grouped by method with sorted metrics, errors, exceptions and middlewares." },
511
514
  schema: [],
@@ -521,15 +524,15 @@ const rule$9 = {
521
524
  return;
522
525
  }
523
526
  const groupCallback = node.arguments[1];
524
- if (groupCallback.type !== "FunctionExpression" && groupCallback.type !== "ArrowFunctionExpression") {
527
+ if (groupCallback.type !== index$1.distExports.AST_NODE_TYPES.FunctionExpression && groupCallback.type !== index$1.distExports.AST_NODE_TYPES.ArrowFunctionExpression) {
525
528
  return;
526
529
  }
527
530
  const callbackBody = groupCallback.body;
528
- if (callbackBody.type !== "BlockStatement" || !callbackBody.body) {
531
+ if (callbackBody.type !== index$1.distExports.AST_NODE_TYPES.BlockStatement || !callbackBody.body) {
529
532
  return;
530
533
  }
531
534
  const tests = callbackBody.body.filter((statement) => {
532
- return statement.type === "ExpressionStatement" && statement.expression.type === "CallExpression" && statement.expression.callee.type === "Identifier" && (statement.expression.callee.name === "test" || statement.expression.callee.name === "it");
535
+ return statement.type === index$1.distExports.AST_NODE_TYPES.ExpressionStatement && statement.expression.type === index$1.distExports.AST_NODE_TYPES.CallExpression && statement.expression.callee.type === index$1.distExports.AST_NODE_TYPES.Identifier && (statement.expression.callee.name === "test" || statement.expression.callee.name === "it");
533
536
  });
534
537
  const testNames = tests.map((test) => getTestName(test.expression));
535
538
  const sortedTestNames = [...testNames].toSorted(compareTests);