Implement baseline comparison for eslint in the CI

This commit is contained in:
Julie Lenaerts 2024-12-05 16:13:07 +01:00
parent 40d733c290
commit 3ca126804b

View File

@ -112,7 +112,17 @@ lint:
- export PATH="./node_modules/.bin:$PATH"
script:
- yarn install --ignore-optional
- eslint --fix-dry-run --quiet
- apt-get update && apt-get install -y jq
- eslint "**/*.{js,vue}" --format json | jq '[.[] | select(.messages | length > 0)]' > eslint-current.json
- new_errors=$(diff <(jq -S . eslint-baseline.json) <(jq -S . eslint-current.json))
- |
if [ -n "$new_errors" ]; then
echo "New ESLint errors detected:"
echo "$new_errors"
exit 1
else
echo "No new ESLint errors detected."
fi
cache:
paths:
- node_modules/