Search code examples
gitwebstormline-endings

WebStorm - how change CRLF line endings into LF


I have error with WebStorm IDE. In current project, team uses TSLint, for static code analysis. One of the rules, is

    "linebreak-style": [
      true,
      "LF"
    ],

Before every commit, I need to change line endings in every changed file, because line endings were CRLF. I see also, that files changed and commited by team members have this incorrect CRLF line endings.

I think, that somewhere in process, take place automatic conversion of line endings to wrong format.

In WebStorm, I setted line separator to Unix and macOs (\n)

Can I change something in WebStorm setup to always use LF line endings?

Maybe this problem is related with Git?

Here is my Git config

[core]
    autocrlf = true
    eol = lf

Other team members do not have this problem, that's why, I think, that is something wrong with my setup.


Solution

  • One of the possible answer, is refresh all git repo files. This will convert all files to LF endings.

    https://help.github.com/en/articles/dealing-with-line-endings#refreshing-a-repository-after-changing-line-endings

    I'm afraid of loosing/overriding history of multiple files. Other possible option is cloning project again with correct Git setup.

    At this moment I decided do not deal with this problem, because files, that I fixed, works ok. Even when someone from team make rewrite content of my files, after pull, line endings works ok.