Comments (9)
Ah the fun of platform line endings.
The issue is, some people (including me) have the setting for git line endings doing automatic conversions to CRLF on Windows.
I have revisited my decision and now I have git settings to checkout line endings as LF no matter what, which seems like a saner way to go.
from node-typescript-boilerplate.
Thank you for reporting. I don't have Windows to test this so I'm going to fix it on a separate branch and ask you to validate before merging.
from node-typescript-boilerplate.
I will be happy to do that. Thank you for a great project.
from node-typescript-boilerplate.
@eugenious I've read about linebreak-style
check and I'm against setting it to false
as the default for this starter. Line breaks should be consistent in source files.
If you're mixing CRLFs with LFs, then in my opinion you should correct those files and settle for one style with either "linebreak-style": [true, "LF"]
or "linebreak-style": [true, "CRLF"]
.
from node-typescript-boilerplate.
@eugenious Please check if #7 fixes npm run lint
on Windows.
from node-typescript-boilerplate.
Git can handle line endings by auto-converting CRLF into LF when you add a file to the index, and vice versa when it checks out code onto your filesystem. You can enable this with the core.autocrlf
setting.
On Windows, set it to true
– this converts LF endings into CRLF on checkout
$ git config --global core.autocrlf true
On Mac and Linux you may want Git to fix files with CRLF endings that were accidentally introduced. To convert CRLF to LF on commit but not the other way around, set core.autocrlf
to input
from node-typescript-boilerplate.
Yes I know, and that's exactly the problem!
By setting core.autocrlf to true, projects will be cloned into Windows with CRLF.
And running "npm run lint" locally on Windows will fail, as it expects line endings to be LF, not CRLF.
Of course, I could then in my project enforce: "linebreak-style": [true, "CRLF"].
But then that makes my project ONLY work under Windows. It's no longer cross platform.
from node-typescript-boilerplate.
I still think that enforcing unified line endings across files is a safe default option (and a desired one). It's possible to opt-out - disable this setting or change it to CRLF
if you want to.
from node-typescript-boilerplate.
I think I'm still not being clear enough.
Unified line endings across files is normal and expected.
Unified line endings across PLATFORMS, for the same git repository, isn't a universal practice.
Anyway, my solution for this is working fine: I've now adopted the practice of using only LF
regardless of platform, and probably this is what everybody should be doing.
Thanks!
from node-typescript-boilerplate.
Related Issues (20)
- Live reloading HOT 1
- Packages need to be updated
- Running npm run test hangs HOT 4
- Documentation: index.d.ts HOT 3
- please add nodemon to auto restart server app HOT 1
- Migrate TSLint -> ESLint
- Error when using your boilerplate HOT 3
- Change "TSLint" in the repository description to "ESLint". HOT 2
- Jest issue HOT 3
- What is `tsutils` ? HOT 1
- After building, import file using relative path show module not found error HOT 1
- Misleading ESLint error suppression comment HOT 2
- tsconfig lib option and node-fetch HOT 1
- wrong paths in the build HOT 1
- Remove tsutils HOT 1
- Just a question: What should I do if I am publishing a project using this template to npm ? HOT 3
- Discussing plan to use renovate bot to update dependencies HOT 1
- Import file without .js extension HOT 2
- Use Yarn HOT 1
- Webstorm Debugging HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-typescript-boilerplate.