@sarj/eslint-plugin 9.2.0 → 9.3.0

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 CHANGED
@@ -534,7 +534,72 @@ function restatesStatementHead(body, statement) {
534
534
  // src/rules/no-comment-cruft.ts
535
535
  var LEADING_PREAMBLE_MIN = 4;
536
536
  var STEP_NARRATION_RE = /^(?:first(?:ly)?|second(?:ly)?|third(?:ly)?|then|next|after(?:wards| that)?|finally|lastly|now)\s*[,:]\s*\S/i;
537
- var META_COMMENTARY_RE = /\b(?:for now|keeping (?:it|this) simple|could be (?:refactored|improved|cleaned up|simplified)|refactor(?:ed|ing)? (?:later|this)|not sure (?:if|whether|why|how)|quick[- ](?:and[- ]dirty|fix)|(?:a |bit of a )?hacky|is a hack|temporary (?:solution|workaround|fix|hack)|revisit (?:this|later|below)|clean (?:this|it) up|not ideal|placeholder for now)\b/i;
537
+ var META_COMMENTARY_RE = /\b(?:keeping (?:it|this) simple|could be (?:refactored|improved|cleaned up|simplified)|refactor(?:ed|ing)? (?:later|this)|not sure (?:if|whether|why|how)|quick[- ](?:and[- ]dirty|fix)|(?:a |bit of a )?hacky|is a hack|temporary (?:solution|workaround|fix|hack)|revisit (?:this|later|below)|clean (?:this|it) up|not ideal|placeholder for now)\b/i;
538
+ var FOR_NOW_RE = /\bfor now\b/i;
539
+ var DEFERRAL_STOPWORDS = /* @__PURE__ */ new Set([
540
+ "a",
541
+ "an",
542
+ "and",
543
+ "are",
544
+ "as",
545
+ "at",
546
+ "be",
547
+ "but",
548
+ "by",
549
+ "can",
550
+ "could",
551
+ "do",
552
+ "does",
553
+ "for",
554
+ "from",
555
+ "had",
556
+ "has",
557
+ "have",
558
+ "here",
559
+ "i",
560
+ "in",
561
+ "is",
562
+ "it",
563
+ "its",
564
+ "just",
565
+ "may",
566
+ "might",
567
+ "no",
568
+ "not",
569
+ "now",
570
+ "of",
571
+ "on",
572
+ "only",
573
+ "our",
574
+ "shall",
575
+ "should",
576
+ "so",
577
+ "still",
578
+ "that",
579
+ "the",
580
+ "then",
581
+ "there",
582
+ "this",
583
+ "to",
584
+ "us",
585
+ "was",
586
+ "we",
587
+ "were",
588
+ "will",
589
+ "with",
590
+ "would",
591
+ "you",
592
+ "your"
593
+ ]);
594
+ var DEFERRAL_MAX_CONTENT_WORDS = 2;
595
+ function isBareDeferral(text) {
596
+ if (!FOR_NOW_RE.test(text)) return false;
597
+ const rest = text.replace(FOR_NOW_RE, " ");
598
+ const content = (rest.match(/[A-Za-z][\w']*/g) ?? []).filter(
599
+ (word) => !DEFERRAL_STOPWORDS.has(word.toLowerCase())
600
+ );
601
+ return content.length <= DEFERRAL_MAX_CONTENT_WORDS;
602
+ }
538
603
  var DIRECTIVE_RE = /^(eslint\b|eslint-|sarj-noqa\b|@ts-|prettier-ignore|prettier\b|biome-|c8\b|v8\b|istanbul\b|@type\b|@vite|webpack|<reference|<amd|global\b|noinspection|hack\b|xxx\b)/i;
539
604
  var LICENSE_RE = /copyright|licen[cs]ed?|spdx|permission is hereby granted|all rights reserved/i;
540
605
  var ENUMERATED_ITEM_RE = /^(?:\d+[.):]|[-*•])\s+\S/;
@@ -655,6 +720,7 @@ function isRedundantNarration(body, statementBelow, standalone, isolatedEnumerat
655
720
  const justified = JUSTIFICATION_RE.test(t);
656
721
  if (STEP_NARRATION_RE.test(t) && !justified) return true;
657
722
  if (META_COMMENTARY_RE.test(t) && !justified) return true;
723
+ if (isBareDeferral(t) && !justified) return true;
658
724
  if (HELPER_OPENER_RE.test(t) || LETS_RE.test(t)) return true;
659
725
  const words = t.split(/\s+/);
660
726
  if (words.length > 1 && words.length <= 4 && DUMMY_TRANSLATION_RE.test(t) && !/[():=]/.test(t)) {
@@ -9319,7 +9385,7 @@ var rules = {
9319
9385
  };
9320
9386
  var meta = {
9321
9387
  name: "@sarj/eslint-plugin",
9322
- version: "9.2.0"
9388
+ version: "9.3.0"
9323
9389
  };
9324
9390
  var recommendedRules = {
9325
9391
  "@sarj/enforce-file-structure": "warn",