Skip to content

🐛 Import sort (on beta) produces invalid JS/TS #6211

@martinuncountable

Description

@martinuncountable

Environment information

CLI:
  Version:                      2.0.0-beta.6
  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:                         alacritty
  JS_RUNTIME_VERSION:           v22.12.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         npm/10.9.0

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         /Users/martin/main/biome.json
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  false

Workspace:

What happened?

  1. On the next release, when sorting imports, it is missing a new line between two imports. Here is an example of the failing case:
  2. https://next.biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB7ACAAWgAgAH0AIABmAHIAbwBtACAAIgBiAGEAcwBlAC8AYwBvAG4AdAByAG8AbABzACIACgBpAG0AcABvAHIAdAAgACoAIABhAHMAIABSAEIAIABmAHIAbwBtACAAIgBiAGEAcwBlAC8AcgBiACIACgBpAG0AcABvAHIAdAAgAHsAIABBACAAfQAgAGYAcgBvAG0AIAAiAGIAYQBzAGUALwBjAG8AbgB0AHIAbwBsAHMAIgAKAGkAbQBwAG8AcgB0ACAAewAgAEEAQQAgAH0AIABmAHIAbwBtACAAIgBiAGEAcwBlAC8AYQBwAGkAIgAKAAoAZgB1AG4AYwB0AGkAbwBuACAAdABlAHMAdAAoACkAIAB7AAoAIAAgAGkAZgAgACgAWgApACAAewAKACAAIAAgACAAcgBlAHQAdQByAG4AIABaAAoAIAAgAH0ACgAgACAAaQBmACAAKABBACkAIAB7AAoAIAAgACAAIAByAGUAdAB1AHIAbgAgAEEACgAgACAAfQAKACAAIABpAGYAIAAoAEEAQQApACAAewAKACAAIAAgACAAcgBlAHQAdQByAG4AIABBAEEACgAgACAAfQAKACAAIAByAGUAdAB1AHIAbgAgAFIAQgAuAEQARQBGAEEAVQBMAFQACgB9AA%3D%3D

It is producing this:

import { AA } from "base/api"import { A, Z } from "base/controls"
import * as RB from "base/rb"

// ...

Expected result

Expected result, is there is a line break so it is valid resort, for example:

import { AA } from "base/api"
import { A, Z } from "base/controls"
import * as RB from "base/rb"

// ...

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-AnalyzerArea: analyzerL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugS-Help-wantedStatus: you're familiar with the code base and want to help the project

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions