question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Bailing": Failing when `prettier --write` (or similar) fixes a file? (No "git add" task)

See original GitHub issue

Description

I’m trying to replace pretty-quick (automated with a Git pre-commit hook) with this tool. The former has the --bail behavior which allows me to review any changes done by Prettier by using git diff, before adding them myself (so no "git add" task in lint-staged config) and trying to commit again. I haven’t found a way to set this up 🙁 Is it possible?

Environment

  • OS: macOS Catalina
  • Node.js: v10.16.3
  • lint-staged: 9.4.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
okonetcommented, Nov 29, 2019

Okay that actually make sense to me now. Let’s try to keep changes unstated and exit with a special code?

2reactions
iirojcommented, Nov 28, 2019

In v10 this is easy, because we automatically do the git add . step. With the --bail flag we would just fail at that point instead of continuing. I can add this if you’re fine with it, @okonet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pre-commit Hook - Prettier
You can use Prettier with a pre-commit tool. This can re-format your files that are marked as “staged” via `git add` before you...
Read more >
Code style issues found in the above file(s). Forgot to run ...
I have this problem when I try to check style with prettier --check. Code style issues found in the above file(s). Forgot to...
Read more >
Using lint-staged, husky, and pre-commit hooks to fail fast and ...
Let's look at using lint-staged and husky to fail earlier and faster. ... either fixing the error or using the --no-verify commit flag....
Read more >
ESLint and Prettier with Husky git hooks - YouTube
Using eslint and the prettier formatter are considered best practices at this point, especially for projects that will have lot's of ...
Read more >
How to add ESlint, Prettier, and Husky (Git Hook) in React JS ...
Today we are going to fix the problem together. Let's enforce a coding style using eslint and format our code automatically using prettier!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found