Repository navigation
fix(lint): respect module headers in declaration guard - #1460
Merged
Lorenzobattistela merged 1 commit intoOct 10, 2026
Merged
Conversation
Lorenzobattistela
approved these changes
Oct 10, 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.
bend-lint refuses safe formatting when a valid module-import header is indented. Its declaration guard also removes import-looking lines throughout the file, so it can miss changes inside multiline strings or reject unchanged foreign-function bodies.
Limit masking to the initial module-import header, following
book_load's whitespace, comment and boundary rules. Recover fallback aliases from that same header while preserving parser-observed aliases. This adapts the standalone bend-lint correction to the bundled tool. Tests stay in bend-lint's suite, following the maintainer guidance in #1389.Blast radius
sameDeclarationsintools/bend-lint/src/seam.ts. It affects rules that use this guard, including the formatter's safety check.import Baseandimport path as Aliasheader lines are masked. Scanning stops at the first body line, including@unsafe. Foreign imports, later imports and multiline literal contents remain part of the comparison.rules/format.test.ts.Validation
bun testfromtools/bend-lintpasses all 122 tests. Each of the seven new regressions fails against the original guard.7.bun gates/repo.tspasses 54/54.git diff --checkpasses.Validation limits
Typecheck still reports the same two pre-existing TS2339 errors in
bend2/bend.ts, at lines 2040 and 3771. The before/after diagnostics are identical. These checks cover the bundled linter and tested programs; full cluster gates were not run.