prettier-plugin-sort-imports icon indicating copy to clipboard operation
prettier-plugin-sort-imports copied to clipboard

[Feat] sort import alias by original module name, not alias

Open Airkro opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe a clear and concise description of what the problem is. E.g. I'm always frustrated when [...]

Describe the solution you'd like

Currently, this plugin sorts alias imports by alias:

import { xyz as abc, efg } from 'abc';

↓↓

import { xyz as abc, efg } from 'abc';

And this's how https://github.com/lydell/eslint-plugin-simple-import-sort do:

import { xyz as abc, efg } from 'abc';

↓↓

import { efg, xyz as abc } from 'abc';

I think this makes more reasonable, and is more conducive to git diff.

Airkro avatar Nov 18 '24 15:11 Airkro

I don't have a strong opinion here, and I expect that reasonable people could disagree on how to order these. We wouldn't want to add an option to control this, and changing the behavior would need to happen in a major release, and could cause disruption to existing projects. I'll leave this open to see what others think, though.

IanVS avatar Nov 18 '24 16:11 IanVS