Deduplication for husky.add()
#1012
Replies: 2 comments
-
There may be some cases where people would really want to have two times the same command: date
# some long command
date I prefer to keep husky simple and not too smart about it. There's If checking for duplication is really needed, I'd use an |
Beta Was this translation helpful? Give feedback.
-
Then what about something like a |
Beta Was this translation helpful? Give feedback.
-
It's a common use case that we use
husky
API to build something like amrm
task, e.g.mrm-task-lint-staged
. The script addsnpx lint-staged
intopre-commit
hook usinghusky.add()
API. But if the script was run multiple times, there would also be multiple duplicated lines ofnpx lint-staged
insidepre-commit
script. I believe it would be really helpful ifhusky.add()
supports deduplication.Expected behavior
.husky/pre-commit
script as shown below:Calling
husky.add('.husky/pre-commit', 'npx lint-staged')
should not take effect because there is already a line with exact same content..husky/pre-commit
script as shown below:Calling
husky.add('.husky/pre-commit', 'npx lint-staged')
should not take effect because there is already a line with the same command called in a sequence.Beta Was this translation helpful? Give feedback.
All reactions