Repository navigation
Linter: Resolve the framework from the config before choosing parser options - #2853
Open
viktorianer wants to merge 1 commit into
Open
viktorianer wants to merge 1 commit into
viktorianer wants to merge 1 commit into
Conversation
…options Since marcoroth#2824, `lint()` picks each rule's parser options before it merges `this.config.framework` into the lint context. A framework set only in `.herb.yml`, as the CLI sets it, therefore reaches `parserOptionsFor` as `undefined`, which falls back to `DEFAULT_FRAMEWORK` ("ruby") and turns `action_view_helpers` off for every rule that asks for it. Without the Action View transform, the body of a `javascript_tag` block is text instead of a `<script>` element, so `html-no-unescaped-entities` reports the JavaScript's `&&` and its unsafe autofix rewrites it to `&&`. 0.11.0 reports nothing on the same file. `parserOptionsFor` now gets the framework the same way the lint context does: from the context, else from the config. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
viktorianer
marked this pull request as ready for review
October 25, 2026 19:47
This branch has not been deployed
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.
Since #2824,
Linter#lintcomputes each rule's parser options before it mergesthis.config.frameworkinto the lint context. When the framework comes only from the config, as withframework: actionviewin.herb.ymlandherb-linton the command line,parserOptionsForreceivesundefined. It falls back toDEFAULT_FRAMEWORK("ruby") and turnsaction_view_helpersoff for every rule that asks for it.One visible effect: the body of a
javascript_tagblock is parsed as text instead of a<script>element, sohtml-no-unescaped-entitiesreports the JavaScript inside it.With
framework: actionviewin.herb.yml,herb-lint0.11.0 reports nothing on this file. 0.11.1 reports twohtml-no-unescaped-entitieswarnings, and its unsafe autofix would turn the&&into&&. Passing{ framework: "actionview" }in the lint context still gives no offense, which is why the existing tests did not notice.parserOptionsFornow gets the framework the way the lint context does: from the context, else from the config.The new test lints that snippet once with the framework in the context and once with it only in the config, and expects no offense from either. It fails on
mainon the config path, with 2 offenses. The full linter suite passes with the change (250 files). Aherb-lintbuilt from this branch reports nothing on the snippet, and still reports aform_withnested inside anotherform_with.🤖 Generated with Claude Code