mixxxdj / mixxx

Mixxx is Free DJ software that gives you everything you need to perform live mixes.
http://mixxx.org
Other
4.26k stars 1.24k forks source link

Pre-Commit for JS mapping files introduces wrong EOL characters #12974

Open JoergAtGithub opened 3 months ago

JoergAtGithub commented 3 months ago

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 of autocrlf = true

Version

2.4

OS

Windows 11

Swiftb0y commented 3 months ago

Weird, sounds why is this only happening for js files? Do you know which tool/hook is responsible?

JoergAtGithub commented 1 month ago

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.

Swiftb0y commented 1 month ago

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?

JoergAtGithub commented 1 month ago

Yes, eslint changes the EOL characters, but in the modified lines only.

Swiftb0y commented 1 month ago

I see.

Swiftb0y commented 1 month ago

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?

JoergAtGithub commented 1 month ago

Maybe we can introduce a postprocessing after eslint

Swiftb0y commented 1 month ago

Pre-commit should be able to do that easily, but wouldn't that fight with the postprocessing done by git again?

Swiftb0y commented 1 month ago

image

I guess we can only set it to --fix=auto?