Skip to content

Linter: Fix html-no-unescaped-entities false positive on ActionView tag helpers#1672

Open
bdewater-thatch wants to merge 1 commit into
marcoroth:mainfrom
bdewater-thatch:fix/html-no-unescaped-entities-actionview-helpers
Open

Linter: Fix html-no-unescaped-entities false positive on ActionView tag helpers#1672
bdewater-thatch wants to merge 1 commit into
marcoroth:mainfrom
bdewater-thatch:fix/html-no-unescaped-entities-actionview-helpers

Conversation

@bdewater-thatch
Copy link
Copy Markdown

@bdewater-thatch bdewater-thatch commented Apr 22, 2026

#1670 was actually correct, the agent hallucinated the rule being enabled or not 😂

The html-no-unescaped-entities rule flags & characters inside string arguments to ActionView tag helpers that auto-escape their content by default. Following the suggested fix (&) causes double-escaping and the user sees literal & instead of &.

Decided to let it take a stab at fixing it because I don't want people to get too comfortable with disabling this rule.

@bdewater-thatch bdewater-thatch changed the title Fix/html no unescaped entities actionview helpers Fix html-no-unescaped-entities false positive on ActionView tag helpers Apr 22, 2026
@bdewater-thatch bdewater-thatch force-pushed the fix/html-no-unescaped-entities-actionview-helpers branch from 89101c5 to d33a4d6 Compare May 20, 2026 19:56
@marcoroth marcoroth changed the title Fix html-no-unescaped-entities false positive on ActionView tag helpers Linter: Fix html-no-unescaped-entities false positive on ActionView tag helpers May 22, 2026
@bdewater-thatch bdewater-thatch force-pushed the fix/html-no-unescaped-entities-actionview-helpers branch from d33a4d6 to 83fd89c Compare June 5, 2026 16:45
Add an escape_content flag to HTMLElementNode so virtual elements created from ActionView helpers can track whether generated content is escaped. Use that flag in html-no-unescaped-entities to avoid false positives for escaped helper content while still linting raw-safe helper output.

Update generated bindings and snapshots for the new AST shape.
@bdewater-thatch bdewater-thatch force-pushed the fix/html-no-unescaped-entities-actionview-helpers branch from 83fd89c to 2238fc5 Compare June 5, 2026 16:51
@bdewater-thatch
Copy link
Copy Markdown
Author

@marcoroth rebased and tests should be fixed now, could you kick off another CI run please?


get parserOptions(): Partial<ParserOptions> {
return {
action_view_helpers: true,
Copy link
Copy Markdown
Owner

@marcoroth marcoroth Jun 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @bdewater-thatch, thanks for taking a stab at fixing this!

I'd need to check, but couldn't we just disable the action_view_tag_helpers option on this linter rule, so that the linter doesn't even see the converted ActionView helpers as HTML nodes?

Or is the automatic escaping only happening on some of the Action View helpers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants