fix: improve lint-staged configuration and add batch linting script
- Fix lint-staged to properly pass file arguments to ESLint - Add batch linting script for processing large file sets - Increase Node.js memory limit to 4GB for ESLint - Add lint:batch npm script for manual batch processing
This commit is contained in:
29
scripts/lint-batch.sh
Executable file
29
scripts/lint-batch.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Lint files in batches to avoid memory issues
|
||||
# Usage: ./scripts/lint-batch.sh [files...]
|
||||
|
||||
set -e
|
||||
|
||||
BATCH_SIZE=20
|
||||
FILES=("$@")
|
||||
|
||||
if [ ${#FILES[@]} -eq 0 ]; then
|
||||
echo "No files provided"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Linting ${#FILES[@]} files in batches of $BATCH_SIZE..."
|
||||
|
||||
for ((i=0; i<${#FILES[@]}; i+=BATCH_SIZE)); do
|
||||
BATCH=("${FILES[@]:i:BATCH_SIZE}")
|
||||
echo "Processing batch $((i/BATCH_SIZE + 1)): ${#BATCH[@]} files"
|
||||
|
||||
NODE_OPTIONS='--max-old-space-size=4096' \
|
||||
eslint --fix --config eslint.config.js "${BATCH[@]}" || {
|
||||
echo "ESLint failed on batch $((i/BATCH_SIZE + 1))"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
echo "All batches processed successfully"
|
||||
|
||||
Reference in New Issue
Block a user