Skip to content

Linter: Use the framework option from global config - #2922

Merged
marcoroth merged 1 commit into
marcoroth:mainfrom
palkan:fix/read-framework-from-global-config
Nov 23, 2026
Merged

marcoroth merged 1 commit into
marcoroth:mainfrom
palkan:fix/read-framework-from-global-config

Conversation

@palkan

@palkan palkan commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Tried to use scoped styles and encountered the problem with the herb-scoped-style-no-unused-selector—doesn't recognize link_to (although expected to).

A minimal repro (same as in the test):

<style scoped>
  .logo { color: red; }
</style>

<%= link_to "Home", "/", class: "logo" %>

herb-lint gives:

[error] The a.logo selector in this <style scoped> block matches no element in this file, so it never applies.

The proposed fix is to use the framework defined in the global config.

@github-actions github-actions Bot added linter @herb-tools/linter for HTML+ERB templates typescript TypeScript source across the javascript/ packages labels Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The linter now uses the configured framework for parser-option selection when the lint context does not specify one. A test covers this fallback with an Action View configuration.

Changes: Framework fallback

Layer / File(s) Summary
Framework fallback and test
javascript/packages/linter/src/linter.ts, javascript/packages/linter/test/framework-scoped-rules.test.ts
Parser-option selection falls back to the configured framework when the context has none. A test checks scoped-style and link_to input with a globally configured actionview framework.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: typescript

Suggested reviewers: marcoroth

Merge Risk: Minimal · up to 91fe2

The linter now uses the framework from global config when the lint call does not specify one, so Action View helpers such as link_to are parsed as intended. The change is small, keeps existing precedence, and is covered by a test, so merge risk is low.

Security architecture risk: Minimal · up to 91fe2

The change honors the configured framework when a lint call omits it. Explicit caller settings retain precedence, and no introduced or worsened security or failure-containment risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the linter now uses the framework option from the global config. The change to Linter.lint passes the configured framework to parser-option selection when the call con…
Full details: Title check

Explanation

The title names the main change: the linter now uses the framework option from the global config. The change to Linter.lint passes the configured framework to parser-option selection when the call context does not set one, and a new test covers an actionview global config with a scoped style and link_to element. The title is specific and matches the linked objective (PR #2922) and the commit message.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 51f2450b-9055-48c0-8533-cd724eb4d133
Commits

Reviewing files that changed from the base of the PR and between dd7cabe and 91fe2cf.

Files selected for processing: 2

  • javascript/packages/linter/src/linter.ts
  • javascript/packages/linter/test/framework-scoped-rules.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@marcoroth marcoroth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Great catch, thanks @palkan! 🙏🏼

@marcoroth marcoroth changed the title Linter: use the framework option from global config Linter: Use the framework option from global config Nov 23, 2026
@marcoroth
marcoroth enabled auto-merge (squash) November 23, 2026 15:38
@marcoroth
marcoroth merged commit e7f3706 into marcoroth:main Nov 23, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linter @herb-tools/linter for HTML+ERB templates typescript TypeScript source across the javascript/ packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants