Repository navigation
Linter: Only classify an ERB tag's own calls in html-no-nested-forms - #2750
Merged
marcoroth merged 3 commits intoOct 6, 2026
Merged
Conversation
The Prism node of a block-opening ERB tag spans the whole block, so the form helper collector also found the form helpers of the tags nested inside it. Any block helper wrapping a `form_with` or `button_to`, such as a component render or a layout helper, was then treated as a form itself, and the real form helper inside it was reported as nested. The collector now ignores calls that start after the tag's own content, so calls in nested tags are judged by those tags. A form helper in an inline block inside the same tag is still found. Fixes marcoroth#2708 Fixes marcoroth#2709 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts: # javascript/packages/linter/src/rules/html-no-nested-forms.ts
marcoroth
approved these changes
Oct 6, 2026
marcoroth
left a comment
Owner
There was a problem hiding this comment.
Thanks @viktorianer, looks like this overlapped with #2774. Sorry.
But I merged in main to make sure to keep the tests from this pull request, thank you! 🙏🏼
marcoroth
enabled auto-merge (squash)
October 6, 2026 01:13
Contributor
Author
|
Oh, you found the same issue a bit later? 👌🏼 |
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.
Fixes #2708
Fixes #2709
html-no-nested-formscollects form helper calls from an ERB tag's Prism node. For a tag that opens a block, that node is the whole call including its block, so the collector also walked into the calls of the tags nested inside the block. Any block helper wrapping a form helper was then classified as a form itself, and the real form helper inside it was reported as nested:The collector now ignores calls that start after the tag's own content (
node.content.range.to, a byte offset like Prism'sstartOffset). A nested tag's calls are judged when the visitor reaches that tag, and a form helper in an inline block inside the same tag is still found.New cases cover every shape from the issue: a block helper with and without a receiver, nested block helpers, a component render block, a component slot block (#2709), and two form helpers inside a partial render block. Controls keep a real
button_toinsideform_withinside a block helper, a block helper inside a<form>element, and abutton_toin an inline block insideform_withreported.