Prettier should cause CI to fail if code contains formatting issues
See original GitHub issueWhen I run yarn format
locally, it fixes files which I didn’t touch myself.
Shouldn’t CI pipeline fail for these formatting issues so they don’t land on develop branch?
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Add diff in output of --check (for CI use cases) #6885 - GitHub
When formatted with Prettier, the comment is moved to the next line causing ESLint (which shouldn't have thrown an error) to throw an...
Read more >CLI - Prettier
Applying this practice will minimise the number of times the CI fails because of code formatting problems. If you need to pipe the...
Read more >Why does Prettier not format code in VS Code? - Stack Overflow
Select File -> Preferences -> Settings ( Ctrl + comma ) and search form formatter; Set Prettiers as Default formatter. enter image ...
Read more >Fail pipelines which fail prettier code formatting standards
Let's "prettify" the remainder of our frontend codebase and then make this a hard failure in CI once we're done.
Read more >Integrating and Enforcing Prettier & ESLint
code processed with prettier-eslint can still be considered incorrectly formatted by Prettier because this is just a hack · we're assuming that ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What about changing the
build
script inpackage.json
to:"build": "prettier --check src/ && eslint src/ && CI=true react-scripts build",
I think it’s better to use the same image as frontend and the version of Prettier already installed in the dev dependencies, since Prettier are pretty aggressive at changing the formatting rules between even non-major versions, so using
npx
will likely introduce discrepancies from what we got installed locally.