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

[Feat] keep empty line after HashBang

Open Airkro opened this issue 1 year ago • 4 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 [...]

Currently, this plugin will remove empty line after HashBang.

  #!/usr/bin/env node
-                               
  import foo from 'bar';

Describe the solution you'd like A clear and concise description of what you want to happen.

  • Keep an empty line after HashBang, if it exists.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

  • Enforce an empty line after HashBang.

Additional context Add any other context or screenshots about the feature request here.

Airkro avatar Sep 25 '24 03:09 Airkro

I personally don’t see a problem with this feature change.

I think we already have a special case for shebang-lines, so it’s probably a small tweak to adjust this code.

The biggest problem is deciding if this is a breaking change from a versioning perspective.

fbartho avatar Sep 25 '24 05:09 fbartho

I think it could be considered a "bugfix", though we might want to release in a minor. Even prettier itself allows formatting changes between versions. We should make our stance explicit in the README, though...

IanVS avatar Sep 25 '24 17:09 IanVS

Add a new option to enable that feature, can avoid breaking change.

Airkro avatar Sep 26 '24 08:09 Airkro

Yes, but that's how we ended up with a bajillion options previously, and we worked hard to remove them. Prettier itself is opinionated and has very few options, and we want to follow that same philosophy.

IanVS avatar Sep 26 '24 17:09 IanVS