sindresorhus / atom-editorconfig

Helps developers maintain consistent coding styles between different editors
https://atom.io/packages/editorconfig
MIT License
812 stars 80 forks source link

Developer should have a preference for disabling "newline conversion on save" feature #241

Closed curiousercreative closed 4 years ago

curiousercreative commented 4 years ago

Involved .editorconfig-files

[*]
end_of_line = lf

Problem

Release 2.5.0 included a behavior change in how "end_of_line" setting behaves. Prior to 2.5.0, existing new line characters would NOT be conformed to the value defined on save. After 2.5.0, existing new line characters ARE conformed to the value defined on save.

This new behavior may be problematic for teams as it may yield difficult to decipher merge conflicts and inflate diff sizes.

Possible solutions

  1. Revert this behavior since it goes against documented behavior (#3 from getting started).
  2. Introduce a preference flag for toggling this behavior and update documentation

Possible temporary solution

The last release before the behavior change can be installed. Restart Atom after running command.

apm install editorconfig@2.4.0
Alhadis commented 4 years ago

@curiousercreative What's the point of using end_of_line = lf if it won't be respected, then? Converting newlines on-save was fixing a bug that had been quietly plaguing the package for quite some time.

If you don't want to enforce a particular newline style in a project, then I suggest not adding end_of_line to your project's .editorconfig.

curiousercreative commented 4 years ago

@Alhadis fair enough, but as answer: Our codebase is 20 years old and while our team wants all new files to conform, we'd prefer a 20 year old file that has a single line changed to not be forced into a whole file diff as a result to this conforming. I believe that's what I get when using 2.4.0. Ultimately, my team should probably just update the new lines for the entire project in one go...

Alhadis commented 4 years ago

Ultimately, my team should probably just update the new lines for the entire project in one go...

Definitely. Either that, or enforcing CRLF for new files; like tabs and spaces, it's best to be consistent about one or the other.