Files
blackcanyontickets/reactrebuild0825/scripts/check-hardcoded-colors.js
dzinesco aa81eb5adb feat: add advanced analytics and territory management system
- Add comprehensive analytics components with export functionality
- Implement territory management with manager performance tracking
- Add seatmap components for venue layout management
- Create customer management features with modal interface
- Add advanced hooks for dashboard flags and territory data
- Implement seat selection and venue management utilities
- Add type definitions for ticketing and seatmap systems

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-26 09:25:10 -06:00

74 lines
1.8 KiB
JavaScript

#!/usr/bin/env node
/**
* Check for hardcoded colors in the codebase
* This script scans for hex colors, rgb(), rgba(), and other hardcoded color patterns
*/
import { exec } from 'child_process';
import { promisify } from 'util';
const execAsync = promisify(exec);
const colorPatterns = [
// Hex colors
'#[0-9a-fA-F]{3,8}',
// RGB/RGBA functions
'rgb\\s*\\(',
'rgba\\s*\\(',
// HSL/HSLA functions
'hsl\\s*\\(',
'hsla\\s*\\(',
// Hardcoded Tailwind classes
'bg-white',
'bg-black',
'text-white',
'text-black'
];
const excludePaths = [
'node_modules',
'dist',
'build',
'.git',
'scripts',
'tailwind.config.js',
'tokens.ts',
'tokens.css'
];
async function checkHardcodedColors() {
console.log('🎨 Checking for hardcoded colors in codebase...\n');
let hasViolations = false;
for (const pattern of colorPatterns) {
const excludeArgs = excludePaths.map(path => `--exclude-dir=${path}`).join(' ');
const command = `grep -r -n --color=never ${excludeArgs} "${pattern}" src/ || true`;
try {
const { stdout } = await execAsync(command);
if (stdout.trim()) {
console.log(`❌ Found hardcoded color pattern: ${pattern}`);
console.log(stdout);
hasViolations = true;
}
} catch (error) {
// grep returns non-zero exit code when no matches found, which is expected
if (error.code !== 1) {
console.error(`Error checking pattern ${pattern}:`, error);
}
}
}
if (hasViolations) {
console.log('\n❌ Hardcoded colors found! Please use design tokens instead.');
console.log('📖 See src/theme/tokens.ts for available tokens.');
process.exit(1);
} else {
console.log('✅ No hardcoded colors found! All colors are using design tokens.');
}
}
checkHardcodedColors().catch(console.error);