fix(js): parse short hand identifier in Astro JSX files#9846
Conversation
🦋 Changeset detectedLatest commit: 3e90593 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 |
Parser conformance results onjs/262
jsx/babel
markdown/commonmark
symbols/microsoft
ts/babel
ts/microsoft
|
Merging this PR will not alter performance
Comparing Footnotes
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR introduces an AST node and end-to-end support for Astro-only JSX shorthand attributes ( Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/icy-views-melt.md:
- Line 5: The changeset sentence "Fixed
[`#9140`](https://github.com/biomejs/biome/issues/9140): Biome now parses Astro's
attribute shorthand inside `.astro` files. The following snippet no longer
reports a parse error:" must end with a full stop; update that line in
.changeset/icy-views-melt.md by replacing the trailing colon ":" with a period
"." so the sentence ends with a full stop.
In `@crates/biome_js_analyze/src/lint/a11y/no_label_without_control.rs`:
- Around line 286-288: The current match arm unconditionally returns false for
AnyJsxAttribute::JsxShorthandAttribute, which causes valid shorthand attributes
like <label {htmlFor}> to be treated as unassociated; update the logic in the
association-detection function (the match handling
AnyJsxAttribute::JsxShorthandAttribute) to inspect the shorthand's
identifier/name rather than blanket-failing: if the shorthand identifier is
"htmlFor" (and optionally "for" depending on supported syntaxes) treat it as an
associated control (do not return false), otherwise continue to handle other
shorthand cases as before.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d9a9d38a-d83d-480c-95ce-ca035399ae05
⛔ Files ignored due to path filters (7)
crates/biome_js_factory/src/generated/node_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_js_factory/src/generated/syntax_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_js_parser/tests/js_test_suite/error/jsx_shorthand_attribute_outside_astro.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_syntax/src/generated/kind.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_js_syntax/src/generated/macros.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_js_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_js_syntax/src/generated/nodes_mut.rsis excluded by!**/generated/**,!**/generated/**and included by**
📒 Files selected for processing (15)
.changeset/icy-views-melt.mdcrates/biome_grit_patterns/src/grit_target_language/js_target_language/generated_mappings.rscrates/biome_js_analyze/src/assist/source/use_sorted_attributes.rscrates/biome_js_analyze/src/lint/a11y/no_label_without_control.rscrates/biome_js_analyze/src/lint/performance/use_google_font_preconnect.rscrates/biome_js_formatter/src/generated.rscrates/biome_js_formatter/src/jsx/any/attribute.rscrates/biome_js_formatter/src/jsx/attribute/mod.rscrates/biome_js_formatter/src/jsx/attribute/shorthand_attribute.rscrates/biome_js_formatter/src/jsx/tag/opening_element.rscrates/biome_js_parser/src/syntax/jsx/mod.rscrates/biome_js_parser/tests/js_test_suite/error/jsx_shorthand_attribute_outside_astro.jsxcrates/biome_service/src/workspace/server.tests.rsxtask/codegen/js.ungramxtask/codegen/src/js_kinds_src.rs
Summary
Closes #9140
Fixed with AI agent.
Test Plan
Added new tests
Docs