Skip to content

🐛 oragnizeImports doesn't organize bare export #7583

@Conaclos

Description

@Conaclos

Environment information

Main branch

What happened?

Running oragnizeImports on the following code:

export { f, e, d };
export { g };
export { b, a, c } from './files.js';

provides the following results:

export { f, e, d };
export { g };
export { a, b, c } from './files.js';

Note that the export without a from clause are not organized and merged.

Expected result

A user could expect the following organized code:

export { d, e, f, g };
export { a, b, c } from './files.js';

This looks more complex that it seems. Because if we use the current rule logic, then we have to define an order between export from and export. For example, if we decide that export from is always placed first, then the resulting code could be:

export { a, b, c } from './files.js';
export { d, e, f, g };

If it is a bug fix or a breaking change is up to debate.
We face some complains about the fact that organizeImports organizes exports.

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-Needs discussionStatus: needs a discussion to understand criteria

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions