Skip to content

Commit 41b12f4

Browse files
authored
ENG-1434 change eslint ci to only check changed lines (#790)
* test * test existing lints * . * Enhance CI workflow to capture ESLint output and improve linting failure handling. This update allows reviewdog to determine pass/fail status based on filtered ESLint results, preventing pre-existing issues from failing PRs. Additionally, it ensures proper cleanup of temporary files after linting. * fail ci again * .
1 parent 84db740 commit 41b12f4

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,30 @@ jobs:
140140
for workspace in "${!workspace_to_files[@]}"; do
141141
echo "Linting changed files in ${workspace}"
142142
mapfile -t files < <(printf '%s' "${workspace_to_files[$workspace]}" | sed '/^$/d')
143-
if ! pnpm --dir "$workspace" exec eslint --max-warnings 0 "${files[@]}" | reviewdog \
143+
eslint_output="$(mktemp)"
144+
eslint_exit_code=0
145+
146+
# Capture ESLint output and let reviewdog decide pass/fail after diff filtering.
147+
# This avoids failing a PR for pre-existing issues elsewhere in touched files.
148+
pnpm --dir "$workspace" exec eslint --no-color --format stylish "${files[@]}" >"$eslint_output" 2>&1 || eslint_exit_code=$?
149+
150+
if [ "$eslint_exit_code" -ge 2 ]; then
151+
cat "$eslint_output"
152+
rm -f "$eslint_output"
153+
lint_failed=1
154+
continue
155+
fi
156+
157+
if ! reviewdog \
144158
-f=eslint \
145159
-name="eslint (${workspace})" \
146160
-reporter=github-pr-check \
147161
-filter-mode=added \
148-
-level=warning; then
162+
-level=warning \
163+
-fail-level=warning < "$eslint_output"; then
149164
lint_failed=1
150165
fi
166+
167+
rm -f "$eslint_output"
151168
done
152169
exit $lint_failed

0 commit comments

Comments
 (0)