Skip to content

🐛 Astro: parsing fails for shorthand props ({title}) when inside expression #9140

@Trombach

Description

@Trombach

Environment information

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:           v22.16.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         pnpm/10.12.3

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         biome.json
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  true
  HTML full support enabled:    true

Workspace:
  Open Documents:               0

What happened?

  1. Create an astro component with with an element using the shorthand property notation <div {title}></div> (Note: the chosen name 'title' is just an example)
  2. Put this element inside curly braces, just like you would for a conditional, i.e. {show && <div {title}></div>}
  3. Error parse: Expected ... but instead found title

https://biomejs.dev/playground/?files.not-working.astro=LQAtAC0ACgBsAGUAdAAgAHQAaQB0AGwAZQAgAD0AIAAiAHQAaQB0AGwAZQAiADsACgBsAGUAdAAgAHMAaABvAHcAIAA9ACAAdAByAHUAZQA7AAoALQAtAC0ACgB7AHMAaABvAHcAIAAmACYAIAA8AGQAaQB2ACAAewB0AGkAdABsAGUAfQA%2BADwALwBkAGkAdgA%2BAH0A&files.working.astro=LQAtAC0ACgBsAGUAdAAgAHQAaQB0AGwAZQAgAD0AIAAiAHQAaQB0AGwAZQAiADsACgBsAGUAdAAgAHMAaABvAHcAIAA9ACAAdAByAHUAZQA7AAoALQAtAC0ACgB7AHMAaABvAHcAIAAmACYAIAA8AGQAaQB2ACAAewB0AGkAdABsAGUAfQA%2BADwALwBkAGkAdgA%2BAH0A

Expected result

Biome should be able to parse Astro's shorthand prop notation inside curly brackets

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ParserArea: parserL-HTMLLanguage: HTML and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions