Skip to content

fix(noUnknownAttribute): add closedby as a valid attribute for <dialog>#9142

Merged
ematipico merged 1 commit intobiomejs:mainfrom
THernandez03:fix#9141
Feb 19, 2026
Merged

fix(noUnknownAttribute): add closedby as a valid attribute for <dialog>#9142
ematipico merged 1 commit intobiomejs:mainfrom
THernandez03:fix#9141

Conversation

@THernandez03
Copy link
Contributor

@THernandez03 THernandez03 commented Feb 18, 2026

IA Usage

I made a final check before sending this PR, invalid.jsx.snap, valid.jsx.snap and fix-closedby-dialog-attribute.md files where updated/added by Claude, the core changes to fix the issue were manually made.

Summary

Fixes #9141

Test Plan

Updated invalid.jsx and valid.jsx files

Copilot AI review requested due to automatic review settings February 18, 2026 23:54
@changeset-bot
Copy link

changeset-bot bot commented Feb 18, 2026

🦋 Changeset detected

Latest commit: ee475a8

The changes in this PR will be included in the next version bump.

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

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Feb 18, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes Biome’s lint/nursery/noUnknownAttribute false positive by recognizing the closedby attribute as valid on <dialog> elements (per issue #9141).

Changes:

  • Added closedby to the tag-restricted attribute allowlist for dialog.
  • Updated the noUnknownAttribute JSX spec fixtures and snapshots to cover closedby as valid on <dialog> and invalid on other tags.
  • Added a changeset entry to publish the fix as a patch.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/biome_js_analyze/src/lint/nursery/no_unknown_attribute.rs Allows closedby only on <dialog> via ATTRIBUTE_TAGS_MAP.
crates/biome_js_analyze/tests/specs/nursery/noUnknownAttribute/valid.jsx Adds a valid <dialog closedby="any" ... /> usage to the fixture.
crates/biome_js_analyze/tests/specs/nursery/noUnknownAttribute/valid.jsx.snap Updates snapshot output for the valid fixture.
crates/biome_js_analyze/tests/specs/nursery/noUnknownAttribute/invalid.jsx Adds an invalid <div closedby="any" /> usage to ensure restriction is enforced.
crates/biome_js_analyze/tests/specs/nursery/noUnknownAttribute/invalid.jsx.snap Updates snapshot output for the invalid fixture and shifted diagnostics.
.changeset/fix-closedby-dialog-attribute.md Patch-level release note for the fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2026

Walkthrough

This change adds the HTML attribute closedby to the allowed attributes map for the <dialog> element in the noUnknownAttribute lint (crates/biome_js_analyze/src/lint/nursery/no_unknown_attribute.rs) and updates tests to assert closedby is accepted on <dialog> and reported elsewhere where invalid. A changeset entry for a patch release was added.

Possibly related PRs

Suggested reviewers

  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding closedby as a valid attribute for <dialog> elements in the noUnknownAttribute rule.
Linked Issues check ✅ Passed The PR fully addresses issue #9141's requirements: adds closedby to ATTRIBUTE_TAGS_MAP for <dialog> elements and updates test cases accordingly.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the issue: one-line addition to no_unknown_attribute.rs, test file updates, and a changeset entry.
Description check ✅ Passed The description clearly references fixing issue #9141 and outlines the test plan with actual file changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/biome_js_analyze/src/lint/nursery/no_unknown_attribute.rs (1)

117-117: LGTM — directly fixes the false positive for closedby on <dialog>.

One thing worth noting: the HTML attribute is closedby (lowercase), while the JavaScript property is closedBy (camelCase). The existing dialog-specific entries in ATTRIBUTE_TAGS_MAP use the React/JS property form (returnValue, onClose, onCancel), so closedBy would be the consistent key here. As-is, users writing <dialog closedBy="any" /> (camelCase, following React convention) would still get an UnknownProp diagnostic.

Consider whether this should be a two-part fix:

✨ Suggested follow-up for complete coverage
-    ("closedby", &["dialog"]),
+    ("closedBy", &["dialog"]),

And in DOM_ATTRIBUTE_NAMES (to steer users from the HTML form to the React prop form):

+    ("closedby", "closedBy"),

That said, since the reported issue is specifically about closedby (lowercase), this is a nice-to-have and can be addressed in a follow-up.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_js_analyze/src/lint/nursery/no_unknown_attribute.rs` at line
117, ATTRIBUTE_TAGS_MAP currently uses the HTML lowercase "closedby" key which
causes React-style camelCase props like closedBy to still trigger UnknownProp;
update the dialog-specific entry in ATTRIBUTE_TAGS_MAP to use "closedBy"
(camelCase) instead of "closedby", and add a corresponding entry in
DOM_ATTRIBUTE_NAMES mapping "closedby" -> "closedBy" so users are guided from
the HTML attribute form to the React prop form and both forms are handled
consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/biome_js_analyze/src/lint/nursery/no_unknown_attribute.rs`:
- Line 117: ATTRIBUTE_TAGS_MAP currently uses the HTML lowercase "closedby" key
which causes React-style camelCase props like closedBy to still trigger
UnknownProp; update the dialog-specific entry in ATTRIBUTE_TAGS_MAP to use
"closedBy" (camelCase) instead of "closedby", and add a corresponding entry in
DOM_ATTRIBUTE_NAMES mapping "closedby" -> "closedBy" so users are guided from
the HTML attribute form to the React prop form and both forms are handled
consistently.

@THernandez03 THernandez03 changed the title fix(noUnknownAttribute): Add closedby as a valid attribute for <dialog> fix(noUnknownAttribute): add closedby as a valid attribute for <dialog> Feb 19, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 19, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 96 skipped benchmarks1


Comparing THernandez03:fix#9141 (ee475a8) with main (6918c9e)

Open in CodSpeed

Footnotes

  1. 96 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@ematipico ematipico merged commit 3ca066b into biomejs:main Feb 19, 2026
20 checks passed
@github-actions github-actions bot mentioned this pull request Feb 18, 2026
@THernandez03 THernandez03 deleted the fix#9141 branch February 19, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 noUnknownAttribute do not recognize closedby as a valid attribute for <dialog>

4 participants