Skip to content

Parser: Properly detect locals that shadow Action View helpers - #2076

Merged
marcoroth merged 1 commit into
mainfrom
actionview-helper-shadowing
Aug 7, 2026
Merged

Parser: Properly detect locals that shadow Action View helpers#2076
marcoroth merged 1 commit into
mainfrom
actionview-helper-shadowing

Conversation

@marcoroth

Copy link
Copy Markdown
Owner

Follow up on #1900.

#1900 taught the action_view_helpers transform to leave block arguments alone, so <%= tag.name %> inside <% @tags.each do |tag| %> stopped turning into a <name> element. It only covered block arguments though, and every other way of binding a local still shadowed nothing:

<% tag = Tag.new(name: "Name") %>

<li><%= tag.name %></li>

The tag.name call was still analyzed as the Action View tag builder, which surfaced through the html-no-unknown-tag linter rule as:

Unknown HTML tag `<name>`. This is not a standard HTML element.

This pull request resolves helper shadowing against a single Prism parse of the whole template instead of tracking scopes by hand.

Related #1762

@marcoroth marcoroth added refactor Internal cleanup with no intended behavior change parser HTML+ERB parser labels Aug 7, 2026
@github-actions github-actions Bot added linter @herb-tools/linter for HTML+ERB templates typescript TypeScript source across the javascript/ packages c C source for the core parser, lexer, and AST action-view-helpers Action View helper support and metadata labels Aug 7, 2026
@marcoroth
marcoroth enabled auto-merge (squash) August 7, 2026 18:18
@marcoroth
marcoroth force-pushed the actionview-helper-shadowing branch from 734f97d to 7a63be1 Compare August 7, 2026 18:19
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

🌿 Interactive Playground and Documentation Preview

A preview deployment has been built for this pull request. Try out the changes live in the interactive playground:


🌱 Grown from commit 734f97d


✅ Preview deployment has been cleaned up.

@pkg-pr-new

pkg-pr-new Bot commented Aug 7, 2026

Copy link
Copy Markdown
npx https://pkg.pr.new/@herb-tools/formatter@2076
npx https://pkg.pr.new/@herb-tools/language-server@2076
npx https://pkg.pr.new/@herb-tools/linter@2076

commit: 734f97d

@marcoroth
marcoroth merged commit 9a3b157 into main Aug 7, 2026
32 of 33 checks passed
@marcoroth
marcoroth deleted the actionview-helper-shadowing branch August 7, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action-view-helpers Action View helper support and metadata c C source for the core parser, lexer, and AST linter @herb-tools/linter for HTML+ERB templates parser HTML+ERB parser refactor Internal cleanup with no intended behavior change typescript TypeScript source across the javascript/ packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant