Created
July 7, 2025 14:00
-
-
Save crshmk/640e8704129271892a8bc21b1da04728 to your computer and use it in GitHub Desktop.
ts ignore an entire folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Author
crshmk
commented
Jul 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment