@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 +68 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +68 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -392,7 +392,7 @@ type FlatPreset = {
|
|
|
392
392
|
declare const plugin: {
|
|
393
393
|
meta: {
|
|
394
394
|
readonly name: "@sarj/eslint-plugin";
|
|
395
|
-
readonly version: "9.
|
|
395
|
+
readonly version: "9.3.0";
|
|
396
396
|
};
|
|
397
397
|
rules: {
|
|
398
398
|
"enforce-file-structure": _typescript_eslint_utils_ts_eslint.RuleModule<"importsFirst" | "useServerDirective", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -392,7 +392,7 @@ type FlatPreset = {
|
|
|
392
392
|
declare const plugin: {
|
|
393
393
|
meta: {
|
|
394
394
|
readonly name: "@sarj/eslint-plugin";
|
|
395
|
-
readonly version: "9.
|
|
395
|
+
readonly version: "9.3.0";
|
|
396
396
|
};
|
|
397
397
|
rules: {
|
|
398
398
|
"enforce-file-structure": _typescript_eslint_utils_ts_eslint.RuleModule<"importsFirst" | "useServerDirective", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
package/dist/index.js
CHANGED
|
@@ -493,7 +493,72 @@ function restatesStatementHead(body, statement) {
|
|
|
493
493
|
// src/rules/no-comment-cruft.ts
|
|
494
494
|
var LEADING_PREAMBLE_MIN = 4;
|
|
495
495
|
var STEP_NARRATION_RE = /^(?:first(?:ly)?|second(?:ly)?|third(?:ly)?|then|next|after(?:wards| that)?|finally|lastly|now)\s*[,:]\s*\S/i;
|
|
496
|
-
var META_COMMENTARY_RE = /\b(?:
|
|
496
|
+
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;
|
|
497
|
+
var FOR_NOW_RE = /\bfor now\b/i;
|
|
498
|
+
var DEFERRAL_STOPWORDS = /* @__PURE__ */ new Set([
|
|
499
|
+
"a",
|
|
500
|
+
"an",
|
|
501
|
+
"and",
|
|
502
|
+
"are",
|
|
503
|
+
"as",
|
|
504
|
+
"at",
|
|
505
|
+
"be",
|
|
506
|
+
"but",
|
|
507
|
+
"by",
|
|
508
|
+
"can",
|
|
509
|
+
"could",
|
|
510
|
+
"do",
|
|
511
|
+
"does",
|
|
512
|
+
"for",
|
|
513
|
+
"from",
|
|
514
|
+
"had",
|
|
515
|
+
"has",
|
|
516
|
+
"have",
|
|
517
|
+
"here",
|
|
518
|
+
"i",
|
|
519
|
+
"in",
|
|
520
|
+
"is",
|
|
521
|
+
"it",
|
|
522
|
+
"its",
|
|
523
|
+
"just",
|
|
524
|
+
"may",
|
|
525
|
+
"might",
|
|
526
|
+
"no",
|
|
527
|
+
"not",
|
|
528
|
+
"now",
|
|
529
|
+
"of",
|
|
530
|
+
"on",
|
|
531
|
+
"only",
|
|
532
|
+
"our",
|
|
533
|
+
"shall",
|
|
534
|
+
"should",
|
|
535
|
+
"so",
|
|
536
|
+
"still",
|
|
537
|
+
"that",
|
|
538
|
+
"the",
|
|
539
|
+
"then",
|
|
540
|
+
"there",
|
|
541
|
+
"this",
|
|
542
|
+
"to",
|
|
543
|
+
"us",
|
|
544
|
+
"was",
|
|
545
|
+
"we",
|
|
546
|
+
"were",
|
|
547
|
+
"will",
|
|
548
|
+
"with",
|
|
549
|
+
"would",
|
|
550
|
+
"you",
|
|
551
|
+
"your"
|
|
552
|
+
]);
|
|
553
|
+
var DEFERRAL_MAX_CONTENT_WORDS = 2;
|
|
554
|
+
function isBareDeferral(text) {
|
|
555
|
+
if (!FOR_NOW_RE.test(text)) return false;
|
|
556
|
+
const rest = text.replace(FOR_NOW_RE, " ");
|
|
557
|
+
const content = (rest.match(/[A-Za-z][\w']*/g) ?? []).filter(
|
|
558
|
+
(word) => !DEFERRAL_STOPWORDS.has(word.toLowerCase())
|
|
559
|
+
);
|
|
560
|
+
return content.length <= DEFERRAL_MAX_CONTENT_WORDS;
|
|
561
|
+
}
|
|
497
562
|
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;
|
|
498
563
|
var LICENSE_RE = /copyright|licen[cs]ed?|spdx|permission is hereby granted|all rights reserved/i;
|
|
499
564
|
var ENUMERATED_ITEM_RE = /^(?:\d+[.):]|[-*•])\s+\S/;
|
|
@@ -614,6 +679,7 @@ function isRedundantNarration(body, statementBelow, standalone, isolatedEnumerat
|
|
|
614
679
|
const justified = JUSTIFICATION_RE.test(t);
|
|
615
680
|
if (STEP_NARRATION_RE.test(t) && !justified) return true;
|
|
616
681
|
if (META_COMMENTARY_RE.test(t) && !justified) return true;
|
|
682
|
+
if (isBareDeferral(t) && !justified) return true;
|
|
617
683
|
if (HELPER_OPENER_RE.test(t) || LETS_RE.test(t)) return true;
|
|
618
684
|
const words = t.split(/\s+/);
|
|
619
685
|
if (words.length > 1 && words.length <= 4 && DUMMY_TRANSLATION_RE.test(t) && !/[():=]/.test(t)) {
|
|
@@ -9284,7 +9350,7 @@ var rules = {
|
|
|
9284
9350
|
};
|
|
9285
9351
|
var meta = {
|
|
9286
9352
|
name: "@sarj/eslint-plugin",
|
|
9287
|
-
version: "9.
|
|
9353
|
+
version: "9.3.0"
|
|
9288
9354
|
};
|
|
9289
9355
|
var recommendedRules = {
|
|
9290
9356
|
"@sarj/enforce-file-structure": "warn",
|