Hacker News new | ask | show | jobs
by _odey 482 days ago
A note on one of the changes: "New package EditorConfig. This package provides support for the EditorConfig standard..."

Honestly the only reason to use this, and don't get me wrong, it's a huge reason, is to ensure windows users don't add CRLFs in their commits, and mess up diffs. Set `end_of_line = lf` and you're done.

`charset = utf-8` and `trim_trailing_whitespace = true` are also nice, but not as disruptive as `end_of_line`.

The other (indentation related) functionality should honestly be handled by language specific linters instead, as they can be syntax aware and allow for better control. I always disable those in practice.

This is the CLI tool to use during CI: https://github.com/editorconfig-checker/editorconfig-checker

1 comments

Merely as an observation, if you care about crlf in _commits_, then you almost certainly want https://git-scm.com/book/en/v2/Customizing-Git-Git-Configura... and not that cited EditorConfig setting. The reason is that while on a system that _uses_ crlf if you were to open those lf-only files in any text editor, it'll run the lines together into a jumble
> The reason is that while on a system that _uses_ crlf if you were to open those lf-only files in any text editor, it'll run the lines together into a jumble

This isn’t true. Windows is the only major contemporary platform to use CRLF, and nowadays all major Windows text editors, especially those likely to be used by developers, can read files with LF-only line endings without jumbling all the lines together. 20 years ago, it was a different story, but that was then and this is now.