flyntwp / flynt

Component based WordPress starter theme, powered by ACF Pro and Timber, optimized for a11y and fast page load results.
https://flyntwp.com
MIT License
731 stars 83 forks source link

A lot of PHPCBF errors on fresh install #240

Closed Elschnuppero closed 4 years ago

Elschnuppero commented 4 years ago

Hello, i made a fresh install with the latest node (13.12.0) and when i run npm run build i get for every php file an error:

Example:

1 | ERROR | [x] End of line character is invalid; expected "\n" but | | found "\r\n" | | (Generic.Files.LineEndings.InvalidEOLChar) PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY

Along with

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! flynt@1.2.1 build: run-s --silent checkVersion clean lint build:production build:rev npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the flynt@1.2.1 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

domtra commented 4 years ago

hi @Elschnuppero , i assume that you are on a windows machine. please correct me if i am wrong. psr-2 expects unix line endings. all files committed to this repo do have them. i think there is an option when setting up git on windows to tell it, what to do with with line ending of all files. keep original, convert to windows (crlf) or convert to unix (lf). you might have set it up to use crlf endings. now, there are ways to configure that per repo as well (check here https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings). unfortunately i am not that experienced with all the possible windows configs. i hope i could point you in the right direction. if not, maybe post the relevant parts of your global git config, and the repo ./git/config file as well as the .gitattributes.

if you do not care about linting, you can also remove the lint execution from the build script. so in you package.json, replace

run-s --silent checkVersion clean lint build:production build:rev

with

run-s --silent checkVersion clean build:production build:rev

hope this helps.

Elschnuppero commented 4 years ago

Thank you for pointing me in the right direction. I removed the lint task.