Open JoergAtGithub opened 3 months ago
Weird, sounds why is this only happening for js files? Do you know which tool/hook is responsible?
I think this is due to #12400. Now only the changed lines are modified by eslint. These get another EOL character than the files checked out by git and than the mixed EOL character check fails at th next git operation.
Do I understand correctly that your hypothesis is that eslint introduces EOL characters which are different than the rest of the file in only the changed lines?
Yes, eslint changes the EOL characters, but in the modified lines only.
I see.
https://eslint.org/docs/latest/rules/linebreak-style#using-this-rule-with-version-control-systems
But I guess that's not really desired? Should we instead remove the rule outright?
Maybe we can introduce a postprocessing after eslint
Pre-commit should be able to do that easily, but wouldn't that fight with the postprocessing done by git again?
I guess we can only set it to --fix=auto
?
Bug Description
If I commit a JavaScript mapping file with changes and pre-commit modifies it, it does not use the EOL characters as written by the Git client at checkout. It seems to use always Unix EOL for the modified lines. In the next run it complains about the mixed line end characters in the file.
I'm on Windows and my
.gitconfig
file contains the unmodified Git default setting ofautocrlf = true
Version
2.4
OS
Windows 11