Skip to content

Linter: Implement actionview-strict-locals-partial-only rule#1463

Merged
marcoroth merged 1 commit intomainfrom
actionview-strict-locals-partial-only
Mar 22, 2026
Merged

Linter: Implement actionview-strict-locals-partial-only rule#1463
marcoroth merged 1 commit intomainfrom
actionview-strict-locals-partial-only

Conversation

@marcoroth
Copy link
Owner

@marcoroth marcoroth commented Mar 22, 2026

This pull request adds a new actionview-strict-locals-partial-only linter rule that detects strict locals declarations in files that are not Rails partials.

Strict locals are only supported in partials (templates whose filename begins with an underscore), so a declaration in any other template has no effect.

Good

app/views/users/_card.html.erb

<%# locals: (user:) %>

<div class="user-card">
  <%= user.name %>
</div>

Bad

app/views/users/show.html.erb

<%# locals: (user:) %>

<div class="user-card">
  <%= user.name %>
</div>

app/components/card_component.html.erb

<%# locals: (title:) %>

<div class="card"><%= title %></div>

Resolves #1464

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 22, 2026

npx https://pkg.pr.new/@herb-tools/formatter@1463
npx https://pkg.pr.new/@herb-tools/language-server@1463
npx https://pkg.pr.new/@herb-tools/linter@1463

commit: fa20fc7

@github-actions
Copy link

github-actions bot commented Mar 22, 2026

🌿 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 fa20fc7


✅ Preview deployment has been cleaned up.

@marcoroth marcoroth force-pushed the actionview-strict-locals-partial-only branch from fa20fc7 to a27ec57 Compare March 22, 2026 23:00
@marcoroth marcoroth merged commit 8ebb067 into main Mar 22, 2026
14 checks passed
@marcoroth marcoroth deleted the actionview-strict-locals-partial-only branch March 22, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linter: Implement actionview-strict-locals-partial-only rule

1 participant