Post-merge-review: Fix template-no-multiple-empty-lines: detect trailing empty lines and fix reported location#2661
Merged
NullVoxPopuli merged 1 commit intoember-cli:masterfrom Apr 13, 2026
Conversation
The port was missing detection of trailing multiple empty lines at the end of a file. Upstream handles this by adding a sentinel value after the last non-empty line. Also matches upstream behavior of swallowing the final trailing newline (as editors often add it).
NullVoxPopuli
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's broken on
masterTwo bugs in the line-scanning loop:
…foo\n\n\n(three newlines) never reports. Upstream handles this by iteratingallLines.length + 1(no-multiple-empty-lines.jsL49).start.line = firstEmptyLine + max + 2andend.line = index, producingstart.line > end.linein real cases.Fix
source.at(-1) === '' ? source.slice(0, -1) : source).reportExcesscall for trailing empty lines.reportExcessfunction so both the mid-file and trailing cases use identical logic.Test plan
line/endLineassertions fails on master (the inverted loc bug)Co-written by Claude.