kibana/.buildkite/scripts/steps/lint.sh
Spencer e474e9460d
[ci] support skip:auto-commit label on CI (#132138)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-05-12 17:00:57 -05:00

39 lines
835 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
source .buildkite/scripts/common/util.sh
.buildkite/scripts/bootstrap.sh
echo '--- Lint: stylelint'
checks-reporter-with-killswitch "Lint: stylelint" \
node scripts/stylelint
echo "stylelint ✅"
echo '--- Lint: eslint'
# 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;
if is_pr && ! is_auto_commit_disabled; then
node scripts/eslint --no-cache --fix
else
node scripts/eslint --no-cache
fi
eslint_exit=$?
# re-enable "Exit immediately" mode
set -e;
desc="node scripts/eslint --no-cache"
if is_pr && ! is_auto_commit_disabled; then
desc="$desc --fix"
fi
check_for_changed_files "$desc" true
if [[ "${eslint_exit}" != "0" ]]; then
exit 1
fi
echo "eslint ✅"