Set Visual Studio Code workspace to create new files in the LF line endings.
Hello, daring code adventurers.
If you are fiddling between Mac and Windows OS for the project that you are working on. You might have come across where your VScode is creating new files with CRLF line endings.
If you have ESlint warning enabled for line endings. You might get warning time to time due to the different line endings.
To simply create a new file permanently in the LF line endings for your workspace instead of CRLF line ending. You can create VScode setting file in your workspace by creating .vscode
folder and create a file name settings.json
{ "files.eol": "\n",}
You can also permanently set for your VScode to always create in LF format by changing in VScode preference.
To open your user and workspace settings, use the following VS Code menu command:
- On Windows/Linux — File > Preferences > Settings
- On macOS — Code > Preferences > Settings
Happy coding everyone. 🙂