New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: throw error to prevent empty commits unless --allow-empty is used #762
Conversation
BREAKING CHANGE: Previously, lint-staged would allow empty commits in the situation where a linter task like "prettier --write" reverts all staged changes automatically. Now the default behaviour is to throw an error with a helpful warning message. The --allow empty option can be used to allow empty commits, or `allowEmpty: true` for the Node.js API.
Codecov Report
@@ Coverage Diff @@
## beta #762 +/- ##
===================================
Coverage 100% 100%
===================================
Files 13 13
Lines 417 429 +12
Branches 90 97 +7
===================================
+ Hits 417 429 +12
Continue to review full report at Codecov.
|
I love it! |
🎉 This PR is included in version 10.0.0-beta.15 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 10.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I do not understand properly how to migrate this change. Previously I had the following config (
When I submit a commit with version I do not want to merge these blocks, due I am not aware if the following
still ensures Any Conclusions how to handle it aside just adding |
@Frozen-byte i have the same problem, how can i make |
you should add the cli flag to the command where you invoke lint-staged itself, maybe from husky: {
"husky": {
"pre-commit": "lint-staged --allow-empty"
}
} |
I tried it but it seems useless |
@jinggk That's too bad to hear. Do you mean it didn't work, or that the feature itself is useless? Make sure have the latest version of lint-staged, at the time of this comment |
@iiroj thank you, i confirm my error again, the detail is:
my configs file content:
and here is my operation detail:
then the error show i do not understand why i need an initial commit?? when i add staged, i think it's enough.. can you help me? add my package.json version
|
@iiroj very thank you ,i will check it |
BREAKING CHANGE: Previously, lint-staged would allow empty commits in the situation where a linter task like "prettier --write" reverts all staged changes automatically. Now the default behaviour is to throw an error with a helpful warning message. The --allow empty option can be used to allow empty commits, or
allowEmpty: true
for the Node.js API.What do you think, @okonet?