Files
2025-08-16 23:31:26 -04:00

38 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
# Find files with // @ts-nocheck at line start (allow leading spaces)
mapfile -t TARGETS < <(grep -RIl -E '^[[:space:]]*//[[:space:]]*@ts-nocheck' "$ROOT/src" || true)
if [[ ${#TARGETS[@]} -eq 0 ]]; then
echo "No files with @ts-nocheck found under src/."
exit 0
fi
echo "Targets:"
for f in "${TARGETS[@]}"; do
rel="${f#$ROOT/}"
echo " - $rel"
done
if [[ "${1:-}" == "--apply" ]]; then
echo "== Removing @ts-nocheck headers =="
for f in "${TARGETS[@]}"; do
# Remove any lines that are a ts-nocheck comment (with optional leading spaces)
sed -i.bak -E '/^[[:space:]]*\/\/[[:space:]]*@ts-nocheck/d' "$f" && rm -f "$f.bak"
done
echo "== ESLint (focused on touched files; overrides ignore) =="
npx eslint --no-ignore --max-warnings=0 --fix "${TARGETS[@]}" || true
echo "== Vitest smoke (non-watch) =="
CI=1 npx vitest run -t "a11y smoke" || true
echo "Done. Review the diffs, run 'git add -p' and commit in a tiny PR."
else
echo
echo "Dry run. Pass --apply to edit files and run focused eslint/vitest."
fi