-
Notifications
You must be signed in to change notification settings - Fork 231
Inconsistent line endigs #21
Comments
Hmm. This may be because I'm publishing from a Windows machine, and Git is auto-checking out files with native line endings. Can you file a PR to force Git to always treat the template files as LF endings? |
I found this instructions, but I will have to figure out how to do this. When I clone this repo everything is fine. When I run I guess when git is checking files, it depends on It might be necessary to both push correct files to repo and set |
Yeah, I expect that the line endings on disk at the time of publish (ie, on my computer) are what end up in the published NPM package, so we need to convince Git to always check them out as LF. |
I found this in git book:
|
That's for converting files to and from the local file system. The problem is that setting gives all checked-out files on a Windows machine CRLF endings. What we want is to force some set of files to always have LF endings, no matter what machine they get checked out on. |
I believe we can achieve this via |
Just noticed that Prettier 2.0 includes this (breaking) config change: Change default value for Could this fix the issue? I'd be happy to start a PR if you want to test a publish on Windows. |
The best thing to do to get control over the LF/CRLF situation is to ensure git is not doing any magic for you upon commit and checkout, so what you have on your working dir on your computer (no matter what OS) is the same that is in the repo and coworkers and/or CI servers working directory. This is done by putting the following in
It basically says: For all files [the asterisk], don't [the minus] treat it as text file. It's when git is treating files as text it can do magic line ending tricks for you. You don't want that. In addition to this, now that the files (in the repo) is stored with CRLF, you need to do one commit (after the |
@markerikson wrote
You can achieve EOL control by the above feature. You can apply it to a subset of the files if you want. |
When a new project is created with
npx create-react-app my-app --template redux
, almost all of the files haveCRLF
line endings.package.json
andyarn.lock
haveLF
line endings.This is also the opposite of the default
create-react-app
template where all files haveLF
endings.The text was updated successfully, but these errors were encountered: