Created
August 4, 2021 16:48
-
-
Save omariosouto/5081f13a98514583156db69868934bc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. `yarn add husky -D` | |
2. Adiciona no package.json: `"prepare": "husky install"` | |
3. roda `yarn prepare` | |
4. Adiciona o comando `npx husky add .husky/pre-commit "yarn lint:fix"` | |
==================================================== | |
5. Lint staged | |
- instala `yarn add lint-staged -D` | |
- Ajusta pra rodar | |
```js | |
"lint-staged": "lint-staged" | |
}, | |
"lint-staged": { | |
"*.js": [ | |
"yarn lint:fix" | |
] | |
}, | |
``` | |
- Mexe no arquivo do pre-commit gerado pelo husky | |
==================================================== | |
## Extgras | |
- Se você quiser ignorar por algum motivo --no-verify | |
- Yarn 2 é diferente | |
https://typicode.github.io/husky/#/?id=install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Toda vez que vou mudar de branch, o git fala pra eu fazer o commit de novo, toda santa hora ele faz isso, mas o husky já está commitado:
git checkout master
error: Your local changes to the following files would be overwritten by checkout:
.husky/commit-msg
.husky/pre-commit
.husky/prepare-commit-msg
Please commit your changes or stash them before you switch branches.
Aborting