Skip to content

Instantly share code, notes, and snippets.

@noherczeg
Last active September 26, 2019 22:22
Show Gist options
  • Save noherczeg/1c55c4d2107510e9d1269acb4777eb7f to your computer and use it in GitHub Desktop.
Save noherczeg/1c55c4d2107510e9d1269acb4777eb7f to your computer and use it in GitHub Desktop.
How to properly set up a project so that no file-ending related issues should occur

Setting up a project to utilize proper line endings

Git Configuration

Git should always check out every text file with LF. This needs to be ensured on a project level, so that environment specific settings do not interfere.

.gitattributes

* text=auto eol=lf

Editor Configuration

Our editor should always insert LF as a new line.

.editorconfig

[*]
end_of_line = lf

Generated sources

Use proper tooling / API-s which provide the option to set proper line endings to generated sources, so that the process should not cause any issues for non-ignored generated files.

E.g.: Prettier options

{
  endOfLine: 'lf',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment