forked from trent_larson/crowd-funder-for-time-pwa
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.
87 lines
2.5 KiB
Plaintext
87 lines
2.5 KiB
Plaintext
# TimeSafari Debug Checker Configuration
|
|
# Edit this file to customize protected branches and debug patterns
|
|
|
|
# Protected branches where debug code checking is enforced
|
|
# Add or remove branches as needed
|
|
PROTECTED_BRANCHES=(
|
|
"master"
|
|
"main"
|
|
"production"
|
|
"release"
|
|
"stable"
|
|
)
|
|
|
|
# Debug patterns to detect (regex patterns)
|
|
# Add or remove patterns as needed
|
|
DEBUG_PATTERNS=(
|
|
# Console statements
|
|
"console\."
|
|
|
|
# Template debug text
|
|
"Debug:"
|
|
"debug:"
|
|
|
|
# Debug constants and variables
|
|
"DEBUG_"
|
|
"debug_"
|
|
|
|
# HTML debug comments
|
|
"<!-- debug"
|
|
|
|
# Debug attributes
|
|
"debug.*="
|
|
|
|
# Vue debug patterns
|
|
"v-if.*debug"
|
|
"v-show.*debug"
|
|
|
|
# Common debug text
|
|
"TODO.*debug"
|
|
"FIXME.*debug"
|
|
|
|
# Debug imports (uncomment if you want to catch these)
|
|
# "import.*debug"
|
|
# "require.*debug"
|
|
)
|
|
|
|
# Files and directories to skip during checking
|
|
# Add patterns to exclude from debug checking
|
|
SKIP_PATTERNS=(
|
|
"\.(test|spec)\.(js|ts|vue)$" # Test files (must have .test. or .spec.)
|
|
"^scripts/" # Scripts directory
|
|
"^test-.*/" # Test directories (must end with /)
|
|
"^\.git/" # Git directory
|
|
"^node_modules/" # Dependencies
|
|
"^docs/" # Documentation
|
|
"^\.cursor/" # Cursor IDE files
|
|
"\.md$" # Markdown files
|
|
"\.txt$" # Text files
|
|
"\.json$" # JSON config files
|
|
"\.yml$" # YAML config files
|
|
"\.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"
|
|
|
|
# Exit codes
|
|
EXIT_SUCCESS=0
|
|
EXIT_DEBUG_FOUND=1
|
|
EXIT_ERROR=2
|