Skip to content

💅 organizeImports reported on first import for unsorted exports #9530

@Kakadus

Description

@Kakadus

Environment information

Reproduced on playground.

Rule name

organizeImports

Playground link

https://biomejs.dev/playground/?lintRules=organizeImports&cssModules=true&code=aQBtAHAAbwByAHQAIAAiAGEAIgA7AAoAaQBtAHAAbwByAHQAIAAiAGIAIgA7AAoACgAKAGMAbwBuAHMAdAAgAGEAIAA9ACAAIgBhACIAOwAKAGMAbwBuAHMAdAAgAGIAIAA9ACAAIgBiACIAOwAKAAoAZQB4AHAAbwByAHQAIAB7ACAAYgAsACAAYQAgAH0AOwAKAA%3D%3D&language=ts

Expected result

The error / warning should be present on line 8, not line 1.

import "a";
import "b";


const a = "a";
const b = "b";

export { b, a };

Output:

/main.ts:1:1 [assist/source/organizeImports](https://biomejs.dev/assist/actions/organize-imports)  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ℹ The imports and exports are not sorted.
  
  > 1 │ import "a";
      │ ^^^^^^^^^^^
    2 │ import "b";
    3 │ 
  
  ℹ Safe fix: Organize Imports (Biome)
  
    6 6 │   const b = "b";
    7 7 │   
    8   │ - export·{·b,·a·};
      8 │ + export·{·a,·b·};
    9 9 │   

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 bug

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions