Description
Moved from #204
From @Cloud7050,
Using git ls-files --eol, this repo appears to sometimes use LF and sometimes use CRLF in the index (and some files are even mixed). For comparison, the main js-slang repo appears to mainly use LF.
This repo's base eslint config is based on a config I've been carrying with me for a while. As I'm on Windows, that rule's setting is less of a concious choice for this repo. If I'm understanding this correctly, maybe it'll be better to:
- Rely on each user's git core.autocrlf config to handle line endings across platforms (true on Windows, input on Linux/macOS?)
- Turn off the linebreak-style rule in the base eslint config. Users are free to locally checkout LF or CRLF
- Push a commit that converts all existing files to be indexed with LF (could use something like eol-converter-cli on npm)
From there I think the repo may sometimes get CRLF introduced, but they would sometimes get corrected to LF down the line. Any thoughts?
My perspective on this is informed by Prettier, which says:
When people collaborate on a project from different operating systems, it becomes easy to end up with mixed line endings in a shared git repository. It is also possible for Windows users to accidentally change line endings in a previously committed file from LF to CRLF. Doing so produces a large git diff and thus makes the line-by-line history for a file (git blame) harder to explore.
Because of the above reason, I don't really agree with allowing for mixed line endings.
IMO, the best way to fix this issue will be to run prettier or eslint --fix in a pre-commit hook and configuring .gitattributes to ignore line endings project-wide, and then we don't even need to push a commit to convert all existing files.
Any thoughts?