Files
iNaturalistReactNative/.husky/pre-commit
Amanda Bullington a89ed25283 Speed up precommits (#2693)
* Speed up precommit hook by only checking staged files with eslint and using eslint cache

* Linting test

* Add rubocop cache to gitignore

* Try to speed up flow
2025-02-22 07:28:12 -08:00

27 lines
876 B
Plaintext
Executable File

# If ggshield is installed, run it
if command -v ggshield &> /dev/null; then
ggshield secret scan pre-commit
# Otherwise require that inaturalist.org git users install it
elif git config --list | grep -q "user.email.*inaturalist.org"; then
echo
echo "Git users w/ inaturalist.org emails must install ggshield: https://docs.gitguardian.com/ggshield-docs/getting-started"
echo
exit 1
else
echo
echo "If you are iNat staff, you should install ggshield: https://docs.gitguardian.com/ggshield-docs/getting-started"
echo
fi
# Run lint on staged files and run flow
npm run lint:staged:fix
# Generate translations from strings.ftl
npm run translate
# ...and add them to the commit; this assumes src/i18n/l10n/ *only* contains
# files you want to add
git status --porcelain --untracked-files src/i18n/l10n/ \
| grep -v "D .*" \
| cut -c 4- \
| xargs git add