Thanks to visit codestin.com
Credit goes to github.com

Skip to content

πŸ› Biome fails when Svelte attribute name and value matchΒ #7861

@jamesgeorgewilliams

Description

@jamesgeorgewilliams

Environment information

CLI:
  Version:                      2.3.0
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  BIOME_THREADS:                unset
  NO_COLOR:                     unset
  TERM:                         xterm-ghostty
  JS_RUNTIME_VERSION:           v22.12.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         pnpm/10.6.5

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

Workspace:
  Open Documents:               0

What happened?

  1. Run biome check on a .svelte file that contains the following.

Playground

<script>
     const name = "name";
</script>

<input
  type="text"
  id="name"
  {name}
  required
/>
  1. The following output is observed:
Biome encountered an unexpected error

This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue.

When opening the issue, please provide a minimal reproduction, or identify and share the file/code that triggers it. Without a way to reproduce the error, the error can't be fixed:

Source Location: /Users/runner/work/biome/biome/crates/biome_parser/src/lib.rs:571:9
Thread Name: biome::workspace_worker_2
Message: The parser is no longer progressing. Stuck at '{' L_CURLY:96..97

βœ– processing panicked: The parser is no longer progressing. Stuck at '{' L_CURLY:96..97

  ⚠ This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.
  1. Explicitly declaring the name attribute, and then running biome check resolves the issue.
<script>
     const name = "name";
</script>

<input
  type="text"
  id="name"
  name={name}
  required
/>
// biome.json

{
  "$schema": "https://biomejs.dev/schemas/2.3.0/schema.json",
  "html": {
  	"experimentalFullSupportEnabled": true,
  	"formatter": {
  		"enabled": true,
  		"indentScriptAndStyle": true
  	}
  },
  "overrides": [
  	{
  		"includes": ["**/*.svelte"],
  		"linter": {
  			"rules": {
  				"style": {
  					"useConst": "off",
  					"useImportType": "off"
  				},
  				"correctness": {
  					"noUnusedVariables": "off",
  					"noUnusedImports": "off"
  				}
  			}
  		}
  	}
  ],
}

Not sure if this would be considered separate to the exceptions mentioned here:
https://biomejs.dev/internals/language-support/#linting-html-ish-languages

Related Svelte docs:
https://svelte.dev/docs/svelte/basic-markup#Element-attributes

Expected result

The parser to progress, and no unexpected error on this file.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-ParserArea: parserL-HTMLLanguage: HTMLS-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