mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 14:51:44 +00:00
- Revert "revert "bazel: improve ESLint rule" (#52853)" - bazel: fix eslint custom rule so js_binary runfiles are included as tool inputs to ctx.actions.run_shell ## Test plan Tested locally that fix commit resolves the ``` FATAL: aspect_rules_js[js_test]: RUNFILES environment variable is not set ``` flaky issue that prompted the revert
29 lines
692 B
Bash
Executable File
29 lines
692 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# The relative path to the eslint report
|
|
ESLINT_REPORT="$1"
|
|
|
|
# Ensure that the eslint report exists
|
|
if [ ! -f "$ESLINT_REPORT" ]; then
|
|
echo "${ESLINT_REPORT} does not exist."
|
|
exit 1
|
|
fi
|
|
|
|
# Check if the eslint report is empty
|
|
if [ -s "$ESLINT_REPORT" ]; then
|
|
# Get the absolute path to the eslint report.
|
|
absolute_report_path="$(realpath "$ESLINT_REPORT")"
|
|
|
|
# Remove everything before "__main__/" from the absolute path to the report.
|
|
workspace_report_path="${absolute_report_path#*__main__/}"
|
|
|
|
# Print the relative report path.
|
|
echo "ESLint report: $workspace_report_path"
|
|
|
|
cat "$ESLINT_REPORT"
|
|
exit 1
|
|
else
|
|
echo "No ESLint issues found."
|
|
exit 0
|
|
fi
|