forked from jsnbuchanan/crowd-funder-for-time-pwa
feat(git-hooks): enhance pre-commit hook with whitelist support for console statements
Add whitelist functionality to debug checker to allow intentional console statements in specific files: - Add WHITELIST_FILES configuration for platform services and utilities - Update pre-commit hook to skip console pattern checks for whitelisted files - Support regex patterns in whitelist for flexible file matching - Maintain security while allowing legitimate debug code in platform services This resolves the issue where the hook was blocking commits due to intentional console statements in whitelisted files like WebPlatformService and CapacitorPlatformService.
This commit is contained in:
@@ -61,6 +61,22 @@ SKIP_PATTERNS=(
|
||||
"\.yaml$" # YAML config files
|
||||
)
|
||||
|
||||
# Files that are whitelisted for console statements
|
||||
# These files may contain intentional console.log statements that are
|
||||
# properly whitelisted with eslint-disable-next-line no-console comments
|
||||
WHITELIST_FILES=(
|
||||
"src/services/platforms/WebPlatformService.ts" # Worker context logging
|
||||
"src/services/platforms/CapacitorPlatformService.ts" # Platform-specific logging
|
||||
"src/services/platforms/ElectronPlatformService.ts" # Electron-specific logging
|
||||
"src/services/QRScanner/.*" # QR Scanner services
|
||||
"src/utils/logger.ts" # Logger utility itself
|
||||
"src/utils/LogCollector.ts" # Log collection utilities
|
||||
"scripts/.*" # Build and utility scripts
|
||||
"test-.*/.*" # Test directories
|
||||
".*\.test\..*" # Test files
|
||||
".*\.spec\..*" # Spec files
|
||||
)
|
||||
|
||||
# Logging level (debug, info, warn, error)
|
||||
LOG_LEVEL="info"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user