we-dance / platform

Community platform for dancers
https://wedance.vip
GNU General Public License v3.0
45 stars 56 forks source link

fix: update .eslintrc rules to fix build locally #363

Closed iiio2 closed 1 year ago

iiio2 commented 1 year ago

yarn run build throws error to build the app locally. This happens due to .eslintrc rules. Updating the rules fix the issue.

razbakov commented 1 year ago

That's not a solution to a problem.

You need to configure git in Windows to checkout files with different line ending.

You can use this command:

git config --global core.autocrlf true

Read more here: 1) https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/ 2) https://stackoverflow.com/questions/10418975/how-to-change-line-ending-settings

We had multiple discussions about it.

iiio2 commented 1 year ago

@razbakov, I have already configured git config --global core.autocrlf false for windows. Having configured that it throws error during yarn run build. Only updating the .eslintrc rules fixes the issue.

razbakov commented 1 year ago

Solution

git config --global core.autocrlf false

After global configuration, you need to pull the code again.

Root cause of the problem:

The culprit is git, a configuration property of core.autocrlf

For historical reasons, the line breaks of the text file on windows and linux are different.

Windows At the time of line break, carriage return is used at the same time CR(carriage-return character) and line breaks LF(linefeed character) Mac and Linux only use the newline character LF Old version of Mac uses carriage return CR Therefore, there will be incompatibility problems when text files are created and used in different systems.

When I clone code on Windows, autocrlf is true as default and then each line of the file is automatically converted to CRLF. If you do not make any changes to the file, eslint delete CR by pre-commit since git automatically convert CRLF to LF.

Reference

https://developpaper.com/solution-to-delete-%E2%90%8Deslint-prettier-prettier-error/