@blumintinc/eslint-plugin-blumint 1.20.26 → 1.20.27
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
|
@@ -681,8 +681,27 @@ function findEarliestSafeIndex(body, startIndex, dependencies, { allowHooks }) {
|
|
|
681
681
|
}
|
|
682
682
|
return targetIndex;
|
|
683
683
|
}
|
|
684
|
-
|
|
684
|
+
/**
|
|
685
|
+
* A comment sharing a line with the code before it annotates that code, so it belongs
|
|
686
|
+
* to the preceding statement even though it lexically precedes this one. Counting it as
|
|
687
|
+
* this statement's leading comment cuts the segment boundary mid-line, which strands
|
|
688
|
+
* the comment against the wrong statement as soon as either one moves.
|
|
689
|
+
*
|
|
690
|
+
* Comments from the first own-line one onward are this statement's: a run of own-line
|
|
691
|
+
* comments directly above it reads as its preamble.
|
|
692
|
+
*/
|
|
693
|
+
function getLeadingComments(statement, sourceCode) {
|
|
685
694
|
const comments = sourceCode.getCommentsBefore(statement);
|
|
695
|
+
const ownLine = comments.findIndex((comment) => {
|
|
696
|
+
const previous = sourceCode.getTokenBefore(comment, {
|
|
697
|
+
includeComments: true,
|
|
698
|
+
});
|
|
699
|
+
return !previous || previous.loc.end.line < comment.loc.start.line;
|
|
700
|
+
});
|
|
701
|
+
return ownLine === -1 ? [] : comments.slice(ownLine);
|
|
702
|
+
}
|
|
703
|
+
function getStartWithComments(statement, sourceCode) {
|
|
704
|
+
const comments = getLeadingComments(statement, sourceCode);
|
|
686
705
|
const start = comments.length === 0 ? statement.range[0] : comments[0].range[0];
|
|
687
706
|
const text = sourceCode.getText();
|
|
688
707
|
let cursor = start - 1;
|
package/package.json
CHANGED
package/release-manifest.json
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "1.20.27",
|
|
4
|
+
"date": "2026-07-30T06:36:11.493Z",
|
|
5
|
+
"rules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "logical-top-to-bottom-grouping",
|
|
8
|
+
"changeType": "fix",
|
|
9
|
+
"issues": [
|
|
10
|
+
1416
|
|
11
|
+
],
|
|
12
|
+
"summary": "keep a trailing comment with the statement it annotates (closes #1416)"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
2
16
|
{
|
|
3
17
|
"version": "1.20.26",
|
|
4
18
|
"date": "2026-07-30T06:12:23.979Z",
|