[eslint] autofix fixable lint errors on ci (#129147) (#129156)

(cherry picked from commit e0928efac0)

Co-authored-by: Spencer <spencer@elastic.co>
This commit is contained in:
Kibana Machine 2022-04-01 02:21:23 -04:00 committed by GitHub
parent 5bdb075673
commit 3010959f7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,25 @@ source .buildkite/scripts/common/util.sh
echo '--- Lint: stylelint'
checks-reporter-with-killswitch "Lint: stylelint" \
node scripts/stylelint
echo "stylelint ✅"
# disable "Exit immediately" mode so that we can run eslint, capture it's exit code, and respond appropriately
# after possibly commiting fixed files to the repo
set +e;
echo '--- Lint: eslint'
checks-reporter-with-killswitch "Lint: eslint" \
node scripts/eslint --no-cache
node scripts/eslint --no-cache --fix
eslint_exit=$?
# re-enable "Exit immediately" mode
set -e;
check_for_changed_files 'node scripts/eslint --no-cache --fix' true
if [[ "${eslint_exit}" != "0" ]]; then
exit 1
fi
echo "eslint ✅"