@blumintinc/eslint-plugin-blumint 1.19.8 → 1.19.9
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/lib/index.js
CHANGED
|
@@ -43,6 +43,29 @@ const SESSION_MATCHER = {
|
|
|
43
43
|
function isDirectiveComment(comment) {
|
|
44
44
|
return DIRECTIVE_PREFIX.test(comment.value.trim());
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Pointer phrasing by which a directive DEFERS its rationale to an adjacent
|
|
48
|
+
* comment: "see above", "per the note below", "as noted in the comment".
|
|
49
|
+
* Up to two intervening words ("the note", "the preceding") are tolerated so
|
|
50
|
+
* natural phrasings still register as deferrals.
|
|
51
|
+
*/
|
|
52
|
+
const DEFERRAL_PATTERN = /\b(?:see|per|as)\s+(?:\w+\s+){0,2}(?:above|below|note|comment|preceding)\b/i;
|
|
53
|
+
/**
|
|
54
|
+
* A directive defers to its preceding comment only when its own `--` text is a
|
|
55
|
+
* mere pointer to that comment ("see above") or carries no substantive words at
|
|
56
|
+
* all (a bare "^" gesture). This is the discriminating signal for #1296's
|
|
57
|
+
* split-justification support: a directive that already states a substantive,
|
|
58
|
+
* self-contained reason owns its rationale outright, so an unrelated docblock or
|
|
59
|
+
* line comment that merely sits above it — documenting the declaration, not the
|
|
60
|
+
* suppression — must never contribute its incidental harness keywords (#1312).
|
|
61
|
+
*/
|
|
62
|
+
function defersToPreceding(justification) {
|
|
63
|
+
const text = justification.trim();
|
|
64
|
+
if (DEFERRAL_PATTERN.test(text)) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
return text.replace(/[^a-z]/gi, '') === '';
|
|
68
|
+
}
|
|
46
69
|
/**
|
|
47
70
|
* Isolates the justification text of a directive comment: everything after the
|
|
48
71
|
* first `--` separator, spanning every line of a multi-line block body. The
|
|
@@ -109,12 +132,16 @@ exports.noHarnessCoupledDisables = (0, createRule_1.createRule)({
|
|
|
109
132
|
}
|
|
110
133
|
// Split-justification style: an immediately-adjacent preceding
|
|
111
134
|
// non-directive comment (no intervening blank line or code) is part
|
|
112
|
-
// of the directive's rationale when the directive defers to it.
|
|
135
|
+
// of the directive's rationale ONLY when the directive defers to it.
|
|
136
|
+
// Without the deferral gate, an unrelated docblock above the
|
|
137
|
+
// declaration bleeds its incidental harness words into a directive
|
|
138
|
+
// that already carries a self-contained code-level reason (#1312).
|
|
113
139
|
let scanned = justification;
|
|
114
140
|
const previous = comments[index - 1];
|
|
115
141
|
if (previous &&
|
|
116
142
|
!isDirectiveComment(previous) &&
|
|
117
|
-
comment.loc.start.line - previous.loc.end.line <= 1
|
|
143
|
+
comment.loc.start.line - previous.loc.end.line <= 1 &&
|
|
144
|
+
defersToPreceding(justification)) {
|
|
118
145
|
scanned = `${previous.value}\n${scanned}`;
|
|
119
146
|
}
|
|
120
147
|
const matchedTerm = findHarnessTerm(scanned);
|
package/package.json
CHANGED
package/release-manifest.json
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "1.19.9",
|
|
4
|
+
"date": "2026-07-17T01:27:12.035Z",
|
|
5
|
+
"rules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "no-harness-coupled-disables",
|
|
8
|
+
"changeType": "fix",
|
|
9
|
+
"issues": [
|
|
10
|
+
1312
|
|
11
|
+
],
|
|
12
|
+
"summary": "only merge preceding comment when directive defers to it (closes #1312)"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
2
16
|
{
|
|
3
17
|
"version": "1.19.8",
|
|
4
18
|
"date": "2026-07-17T00:25:07.461Z",
|