mirror of
https://github.com/tridactyl/tridactyl.git
synced 2026-09-10 07:16:33 -04:00
Move prettier to linter rather than pre-commit
This commit is contained in:
parent
06457ee187
commit
5cddc889fa
15
ci/lint.sh
15
ci/lint.sh
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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..."
|
||||
|
|
|
|||
Loading…
Reference in a new issue