Environment information
Description
When enabling the noUnknownAttribute rule, Biome reports the closedby attribute on the <dialog> element as an unknown attribute.
However, closedby is a valid HTML attribute for <dialog>, as documented in the MDN reference:
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog
This results in false positives, warning users about attributes that are actually part of the HTML specification.
Current Behavior
The linter flags closedby as an unknown attribute when used on a <dialog> element.
See the playground
This triggers a noUnknownAttribute warning.
Expected Behavior
The noUnknownAttribute rule should:
- Warn only about truly unknown or invalid attributes
- Accept valid attributes defined for each HTML element, including
closedby on <dialog>
Possible solution
By inspecting the implementation, the issue appears to come from a missing entry in the attribute map.
In this file:
|
const ATTRIBUTE_TAGS_MAP: &[(&str, &[&str])] = &[ |
The variable ATTRIBUTE_TAGS_MAP contains the list of valid attributes for each HTML element. The <dialog> entry does not currently include the closedby attribute.
Adding closedby to the list of allowed attributes for the dialog element in ATTRIBUTE_TAGS_MAP should resolve the issue and prevent false positives.
Details
CLI:
Version: 2.4.2
Color support: true
Platform:
CPU Architecture: x86_64
OS: linux
Environment:
BIOME_LOG_PATH: unset
BIOME_LOG_PREFIX_NAME: unset
BIOME_LOG_LEVEL: unset
BIOME_LOG_KIND: unset
BIOME_CONFIG_PATH: unset
BIOME_THREADS: unset
BIOME_WATCHER_KIND: unset
BIOME_WATCHER_POLLING_INTERVAL: unset
NO_COLOR: unset
TERM: xterm-256color
JS_RUNTIME_VERSION: v25.6.1
JS_RUNTIME_NAME: node
NODE_PACKAGE_MANAGER: unset
Biome Configuration:
Status: Loaded successfully
Path: biome.jsonc
Formatter enabled: true
Linter enabled: true
Assist enabled: true
VCS enabled: false
HTML full support enabled: unset
Workspace:
Open Documents: 0
Rule name
lint/nursery/noUnknownAttribute
Playground link
https://biomejs.dev/playground/?lineWidth=100&indentStyle=space"eStyle=single&lintRules=noUnknownAttribute&cssModules=true&code=PABkAGkAYQBsAG8AZwAgAG4AYQBtAGUAPQAiAHYAYQBsAGkAZAAiACAAYwBsAG8AcwBlAGQAYgB5AD0AIgBhAG4AeQAiACAAdQBuAGsAbgBvAHcAbgA9ACIAdAByAHUAZQAiAC8APgAKAA%3D%3D&ruleDomains.react=all&ruleDomains.project=all&ruleDomains.test=all&ruleDomains.solid=all&ruleDomains.next=all
Expected result
Do not warn when using closedby attribute on <dialog> element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog#closedby
Code of Conduct
Environment information
Description
When enabling the
noUnknownAttributerule, Biome reports theclosedbyattribute on the<dialog>element as an unknown attribute.However,
closedbyis a valid HTML attribute for<dialog>, as documented in the MDN reference:https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog
This results in false positives, warning users about attributes that are actually part of the HTML specification.
Current Behavior
The linter flags
closedbyas an unknown attribute when used on a<dialog>element.See the playground
This triggers a
noUnknownAttributewarning.Expected Behavior
The
noUnknownAttributerule should:closedbyon<dialog>Possible solution
By inspecting the implementation, the issue appears to come from a missing entry in the attribute map.
In this file:
biome/crates/biome_js_analyze/src/lint/nursery/no_unknown_attribute.rs
Line 103 in 792013e
The variable
ATTRIBUTE_TAGS_MAPcontains the list of valid attributes for each HTML element. The<dialog>entry does not currently include theclosedbyattribute.Adding
closedbyto the list of allowed attributes for thedialogelement inATTRIBUTE_TAGS_MAPshould resolve the issue and prevent false positives.Details
Rule name
lint/nursery/noUnknownAttribute
Playground link
https://biomejs.dev/playground/?lineWidth=100&indentStyle=space"eStyle=single&lintRules=noUnknownAttribute&cssModules=true&code=PABkAGkAYQBsAG8AZwAgAG4AYQBtAGUAPQAiAHYAYQBsAGkAZAAiACAAYwBsAG8AcwBlAGQAYgB5AD0AIgBhAG4AeQAiACAAdQBuAGsAbgBvAHcAbgA9ACIAdAByAHUAZQAiAC8APgAKAA%3D%3D&ruleDomains.react=all&ruleDomains.project=all&ruleDomains.test=all&ruleDomains.solid=all&ruleDomains.next=all
Expected result
Do not warn when using
closedbyattribute on<dialog>element.https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog#closedby
Code of Conduct