Skip to content

refactor(organizeImports): improve diagnostics#9574

Draft
Conaclos wants to merge 1 commit intonextfrom
conaclos/organizeImports-improve-diagnostic
Draft

refactor(organizeImports): improve diagnostics#9574
Conaclos wants to merge 1 commit intonextfrom
conaclos/organizeImports-improve-diagnostic

Conversation

@Conaclos
Copy link
Member

@Conaclos Conaclos commented Mar 21, 2026

Summary

Attempt to fix #9530 (comment)

This PR adds detailed diagnostics for the issues reported by the organizeImports.
This is a draft. Feedbacks are expected :)
I personally find it a bit too verbose. Any opinion?

Note I didn't change Rule::text_range to keep the current behavior for biome-ignore comments: they have to be placed on the first import or export that appears in thew file.

  • changelog entry (to be written)

Test Plan

I updated the snapshot.

Docs

Nochange.

@changeset-bot

This comment was marked as outdated.

@Conaclos Conaclos changed the base branch from main to next March 21, 2026 16:59
@Conaclos Conaclos marked this pull request as draft March 21, 2026 16:59
@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Mar 21, 2026
@Conaclos Conaclos changed the title Conaclos/organize imports improve diagnostic refactor(organizeImports): improve diagnostics Mar 21, 2026

# Diagnostics
```
custom-order-exports.ts:1:1 assist/source/organizeImports FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a regression.

newline_issue: NewLineIssue,
},
/// Unsorted chunk of imports or exports
UnsortedChunk {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed it for clarity. I think that I used the term prefix because the first implementation stopped at the first import/export that was unsorted. The current implementation reports entire chunks. Thus, it doesn't make sense of talking about chunk prefixes.

@coderabbitai

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 organizeImports reported on first import for unsorted exports

1 participant