Files
odoo_source/addons/web/tooling/hooks/pre-commit
T
Simon Genin (ges) 1d4164b729 [FIX] dx: js tooling: remove prettier cmp command from pre-commit
In this version of the tooling, the prettier files do not exist anymore.
We don't want to check if the files have changed, it will always be true
and trigger a reload of the tooling.

closes odoo/odoo#107825

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-12-13 13:51:52 +01:00

17 lines
796 B
Bash
Executable File

#!/bin/bash
# run tooling only on branches that start with master to avoid linting noise in stable
if [[ $(git branch --show-current) == master* || $(git branch --show-current) == 16.0* ]]; then
tooling_dir=$(cd -- "$(dirname "$0")" &> /dev/null && cd .. && pwd)
if ! cmp -s -- "$tooling_dir/_package.json" package.json; then
echo "Your package.json is out of date, reloading the tooling using the reload script"
"$tooling_dir/reload.sh"
elif
! cmp -s -- "$tooling_dir/_eslintignore" .eslintignore ||
! cmp -s -- "$tooling_dir/_eslintrc.json" .eslintrc.json
then
echo "Some of your eslint/prettier config files are out of date, refreshing them using the refresh script"
"$tooling_dir/refresh.sh"
fi
npm run format-staged
fi