Skip to content

Autofix (linter or assist) adds newlines in .astroΒ #10309

Description

@iamdevlinph

Environment information

Details
CLI:
  Version:                      2.4.14
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

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:                         screen-256color
  JS_RUNTIME_VERSION:           v24.12.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         npm/11.6.2

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. Clone https://github.com/iamdevlinph/astro-biome-js
  2. npm install
  3. Make sure you have the biome extension in vscode
  4. Open Welcome.astro file and reorder the imports then save
  5. There's a new line added when the organize import fix is done

I was supposed to only report the new line issue but I sometimes encounter the code being deleted issue similar to biomejs/biome-vscode#894. Both or either issue is very finicky to replicate or there's some sequence of action. I have a recording here on what I did.

Video - starting a new project (finicky)
Screen.Recording.2026-05-08.at.9.37.15.PM.mp4
Video - cloning project, new line issue easy to replicate
Screen.Recording.2026-05-08.at.9.51.32.PM.mov

My biome extension:

Image

Expected result

The organize imports should not add new lines.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Activity

  1. added
    S-Needs triage
    on May 8, 2026
  2. added theissue type on May 8, 2026
  3. changed the title [-]Autofix of organizeImports addeds white space[/-] [+]Autofix of organizeImports adds white space[/+] on May 8, 2026
  4. changed the title [-]Autofix of organizeImports adds white space[/-] [+]Autofix of organizeImports adds white space in `.astro`[/+] on May 8, 2026
  5. Conaclos commented on May 8, 2026

    @Conaclos
    Member

    This doesn't seem to come from the import organizer, as newlines are added even when it is disabled.

  6. added
    S-Bug-confirmed
    and removed
    S-Needs triage
    on May 8, 2026
  7. iamdevlinph commented on May 9, 2026

    @iamdevlinph
    Author

    I don't know if this helps.

    Running npx @biomejs/biome lint --write src/components/Welcome.astro adds a new line.

    Running npx @biomejs/biome check --write src/components/Welcome.astro adds a new line and also fixes the import sort.

  8. changed the title [-]Autofix of organizeImports adds white space in `.astro`[/-] [+]Autofix adds newlines in `.astro`[/+] on May 9, 2026
  9. changed the title [-]Autofix adds newlines in `.astro`[/-] [+]Autofix (linter or assist) adds newlines in `.astro`[/+] on May 9, 2026
  10. Conaclos commented on May 9, 2026

    @Conaclos
    Member

    Running npx @biomejs/biome lint --write src/components/Welcome.astro adds a new line and also fixes the import sort.

    Do you mean @biomejs/biome check?

    The issue happen also in previous releases (tested on Biome 2.4.13, 2.4.12, and 2.4.11).
    Newlines are added regardless of whether the linter or the assist is run. The formatter doesn't add any newlines.

    Important note: even when there is no code fix to apply, newlines are added. However, this only happen with the --write flag. Also, this only happen when experimental HTML support is enabled.

    Tested with:

    npx @biomejs/biome lint --write src/components/Welcome.astro
    

    and

    npx @biomejs/biome check --write --linter-enabled=false --formatter-enabled=false src/components/Welcome.astro
    
  11. iamdevlinph commented on May 10, 2026

    @iamdevlinph
    Author

    Do you mean @biomejs/biome check?

    Ah yes. The other one is supposed to be check didn't notice I copied the same command.

  12. self-assigned this
    on May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

S-Bug-confirmed

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions