Move prettier to linter rather than pre-commit

This commit is contained in:
Oliver Blanthorn 2026-06-06 13:42:52 +02:00
parent 06457ee187
commit 5cddc889fa
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 27 additions and 10 deletions

View file

@ -12,3 +12,18 @@ if [ "$incompatible_sed" ]; then
fi
yarn run lint
"$(yarn bin)/eslint" --rulesdir custom-eslint-rules --ext .ts .
if [ "$(git rev-parse --abbrev-ref HEAD)" = "master" ]; then
if ! yarn prettier --check '**/*.ts' ; then
echo "Warning: the files above have prettier formatting issues. Run 'yarn run prettier -w [files]' to fix them."
fi
else
git fetch origin master 2>/dev/null || true
changed=$(git diff --name-only origin/master...HEAD -- '*.ts' 2>/dev/null || true)
if [ -n "$changed" ]; then
if ! yarn prettier --check $changed; then
echo "The files above have prettier formatting issues. Run 'yarn run prettier -w [files]' to fix them."
exit 1
fi
fi
fi

View file

@ -30,17 +30,19 @@ if [ -n "$consoleFiles" ]; then
echo
fi
if [ -n "$jsfiles" ]; then
yarn git-format-staged \
--formatter "yarn --silent prettier --stdin-filepath \"{}\"" \
"*.ts" "*.tsx"
fi
# # disabled because it was too noisy
#
# if [ -n "$jsfiles" ]; then
# yarn git-format-staged \
# --formatter "yarn --silent prettier --stdin-filepath \"{}\"" \
# "*.ts" "*.tsx"
# fi
if [ -n "$otherfiles" ]; then
yarn git-format-staged \
--formatter "yarn --silent prettier --stdin-filepath \"{}\"" \
"*.md" "*.css"
fi
# if [ -n "$otherfiles" ]; then
# yarn git-format-staged \
# --formatter "yarn --silent prettier --stdin-filepath \"{}\"" \
# "*.md" "*.css"
# fi
if [ -n "$jsfiles" ]; then
echo "Linting staged files..."