We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
pre-commit
We want to update the husky pre-commit file fmt (i.e. prettier, shfmt) and lint (i.e. jshint, shellcheck) so that:
fmt
prettier
shfmt
lint
jshint
shellcheck
Here's an example that can be used to "autofix" with prettier (and there's a link to a similar script for shellcheck - both may need tweaking):
#!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" # from https://prettier.io/docs/en/precommit.html#option-6-shell-script # Should be functionally equivalent to `npm run fmt` # We're not using basetag #npx basetag rebase FILES=$( git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g' ) if [ -z "$FILES" ]; then exit 0 fi echo "$FILES" | xargs npx prettier@2 --ignore-unknown --write echo "$FILES" | xargs git add # Should be functionally equivalent to `npm run lint` JS_FILES=$( echo "$FILES" | grep '\.js$' || true ) if [ -z "$JS_FILES" ]; then exit 0 fi echo "$JS_FILES" | xargs npx jshint@2 -c .jshintrc.lax
See also:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
We want to update the husky pre-commit file
fmt
(i.e.prettier
,shfmt
) andlint
(i.e.jshint
,shellcheck
) so that:prettier
andshellcheck
where possibleHere's an example that can be used to "autofix" with prettier (and there's a link to a similar script for shellcheck - both may need tweaking):
See also:
The text was updated successfully, but these errors were encountered: