Skip to content

Instantly share code, notes, and snippets.

@crshmk
Created July 7, 2025 14:00
Show Gist options
  • Save crshmk/640e8704129271892a8bc21b1da04728 to your computer and use it in GitHub Desktop.
Save crshmk/640e8704129271892a8bc21b1da04728 to your computer and use it in GitHub Desktop.
ts ignore an entire folder
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 path_to_folder"
exit 1
fi
TARGET_DIR="$1"
find "$TARGET_DIR" -type f \( -name "*.ts" -o -name "*.tsx" \) | while read -r file; do
if ! head -n 1 "$file" | grep -q '@ts-nocheck'; then
# macOS sed
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' '1s;^;// @ts-nocheck\n;' "$file"
else
# Linux sed
sed -i '1s;^;// @ts-nocheck\n;' "$file"
fi
echo "Added @ts-nocheck to $file"
fi
done
@crshmk
Copy link
Author

crshmk commented Jul 7, 2025

./ts-ignore /path/to/folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment