Skip to content

Commit

Permalink
fix line-endings conflict between prettier and git
Browse files Browse the repository at this point in the history
The git attribute normalizes line endings for checkout and pushing depending on
the user's OS.
See https://git-scm.com/docs/gitattributes#_end_of_line_conversion

The prettier config does the same, so the working directory is not polluted when
running prettier.
https://prettier.io/docs/en/options#end-of-line
  • Loading branch information
Vankog committed Nov 6, 2024
1 parent 3e6ac1b commit ccab821
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* text=auto eol=lf

# make sure that script files are always in the correct format, no matter the OS.
# i.e. Windows needs batch files to have CRLF, but shell scripts always need to be LF, which is especially important for WSL contexts.
*.sh text eol=lf
*.bat text eol=crlf
1 change: 1 addition & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
tabWidth: 4
printWidth: 100
trailingComma: "none"
endOfLine: "lf"

0 comments on commit ccab821

Please sign in to comment.