Minor Changes
-
#1526
630af5f
Thanks @iiroj! - Lint-staged no longer resets to the original state when preventing an empty git commit. This happens when your configured tasks reset all the staged changes, typically when trying to commit formatting changes which conflict with your linter setup like ESLint or Prettier.Example with Prettier
By default Prettier prefers double quotes.
Previously
- Stage
file.js
with only double quotes"
changed to'
- Run
git commit -am "I don't like double quotes"
- Lint-staged runs
prettier --write file.js
, converting all the'
back to"
- Because there are now no changes, lint-staged fails, cancels the commit, and resets back to the original state
- Commit was not done, original state is restored and single quotes
'
are staged
Now
- Stage
file.js
with only double-quotes"
changed to'
- Run
git commit -am "I don't like double quotes"
- Lint-staged runs
prettier --write file.js
, converting all the'
back to"
- Because there are now no changes, lint-staged fails and cancels the commit
- Commit was not done, and there are no staged changes
- Stage