IanVS / prettier-plugin-sort-imports

An opinionated but flexible prettier plugin to sort import statements
Apache License 2.0
892 stars 21 forks source link

Add a setting to always use single line imports (never split to multiple lines) #127

Closed willhoney7 closed 9 months ago

willhoney7 commented 9 months ago

Is your feature request related to a problem? I've always found it chaotic to have single line and multi line imports in my files. The multi-line imports seem out of place and actually make it harder to read the imports lists, in my opinion.

Describe the solution you'd like I would love a setting, enforceSingleLineImports (or whatever), that when enabled would ensure imports never get split to never lines.

Describe alternatives you've considered The alternative is just dealing with it, which is what I do 😅. I've thought about writing my own plugin but it seems like it would fit in pretty well here.

Additional context I might be able to contribute this myself if you have any suggestions on how/where to implement this.

IanVS commented 9 months ago

This isn't really related to sorting the imports, which is what this plugin is for. In fact, we don't control the styling of the imports at all, that's handled by prettier itself and whatever line length you've specified. So, I'm not sure this is something we could accomplish even if it was in scope for the plugin, unfortunately.

willhoney7 commented 9 months ago

Ah, that's good to know. If I ever get some time, I'll look into writing a plugin to do this. Seems like it wouldn't conflict with this one (which was my main concern with going that route).

Thanks!