amatiasq / vsc-sort-imports

Sort ES6 imports automatically.
ISC License
57 stars 24 forks source link

Option to remove semicolon when sorting imports #77

Open CurralesDragon opened 3 years ago

CurralesDragon commented 3 years ago

I'd love to be able to use this when saving the file but some projects i have semi's disabled (and can format via eslint/prettier)

If the auto save is enabled then it will clash and not allow the formatter to remove the semi's So i guess an easy solution would be to have an option to remove the semi's?

Or even better check eslint if semi's are required and format as appropriate?

amatiasq commented 3 years ago

Code format is out of the scope of this extension.

I don't understand how it can prevent your formatter to do it's work, can you explain?

CurralesDragon commented 3 years ago

It seems the auto format on save is in a specific order.

Save file -> prettier formats file -> auto import sorts imports

Which leaves the semi colons present while saving.

Even triggering another manual format would result in same outcome. Only way to make it work is to manually trigger sort imports.

On 16 Nov 2020, at 09:30, A. Matías Quezada notifications@github.com wrote:

 Code format is out of the scope of this extension.

I don't understand how it can prevent your formatter to do it's work, can you explain?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

amatiasq commented 3 years ago

But if your prettier is removing the semicolons I don't see why would Sort Imports add them back.

If that is the case then please consider opening this issue in https://github.com/renke/import-sort where the sorting logic is actually made.

This extension is just an adapter between VS Code and https://github.com/renke/import-sort.