fix(lint/noBlankTarget): still report when the href attribute is dynamic#9434
fix(lint/noBlankTarget): still report when the href attribute is dynamic#9434siketyan merged 2 commits intobiomejs:mainfrom
Conversation
Co-authored-by: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 035fb05 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis patch release updates the noBlankTarget linter rule in Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/biome_js_analyze/tests/specs/security/noBlankTarget/invalid.jsx`:
- Line 13: Add a new invalid fixture that replicates this
anchor-with-target="_blank" case but runs with a config enabling allowDomains so
the regression is pinned; locate the existing invalid.jsx test (the <a
href={company?.website} target="_blank"></a> case) and duplicate it into a new
spec that loads a config object or meta enabling allowDomains (matching how
other tests set options) so the analyzer runs with allowDomains=true rather than
default options.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 59c7554b-45c8-4c2c-8d77-0b89c28dbf27
⛔ Files ignored due to path filters (2)
crates/biome_js_analyze/tests/specs/security/noBlankTarget/invalid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/security/noBlankTarget/valid.jsx.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (4)
.changeset/lovely-clouds-change.mdcrates/biome_js_analyze/src/lint/security/no_blank_target.rscrates/biome_js_analyze/tests/specs/security/noBlankTarget/invalid.jsxcrates/biome_js_analyze/tests/specs/security/noBlankTarget/valid.jsx
| <a target="_blank" href="//example.com/17" rel></a> | ||
| <a target="_blank" href={dynamicLink}></a> | ||
| <a target={'_blank'} href="//example.com/18"></a> | ||
| <a href={company?.website} target="_blank"></a> |
There was a problem hiding this comment.
Please add an allowDomains-configured invalid fixture as well.
The bug being fixed only shows up once allowDomains is enabled, but this new case still runs under default options. A config-backed case here would pin the actual regression, not just its nearby cousin.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@crates/biome_js_analyze/tests/specs/security/noBlankTarget/invalid.jsx` at
line 13, Add a new invalid fixture that replicates this
anchor-with-target="_blank" case but runs with a config enabling allowDomains so
the regression is pinned; locate the existing invalid.jsx test (the <a
href={company?.website} target="_blank"></a> case) and duplicate it into a new
spec that loads a config object or meta enabling allowDomains (matching how
other tests set options) so the analyzer runs with allowDomains=true rather than
default options.
Merging this PR will not alter performance
Comparing Footnotes
|
dyc3
left a comment
There was a problem hiding this comment.
Has this rule been ported to HTML yet? If so we should verify that vue/svelte/etc have the same fix
Note
AI Assistance Disclosure: I used the Claude Agent to create a changeset. I didn't use any AI/LLMs for code changes.
Summary
Closes #9433
The rule has the
allowedDomainsoption to ignore some URLs starts with the specified domain names. While this option requires thehrefattribute to be static, the rule still should report a diagnostic for dynamic values.Test Plan
Added snapshot tests.
Docs
N/A