2026-01-06 16:10:08 +01:00

42 lines
1004 B
JavaScript

#!/usr/bin/env node
/**
* Wrapper script to fix Next.js lint command bug
* that interprets "lint" as a directory instead of a command
*/
const { execSync } = require('child_process')
const projectRoot = process.cwd()
try {
// Change to project root and run next lint
process.chdir(projectRoot)
execSync('npx next lint', {
stdio: 'inherit',
cwd: projectRoot,
env: { ...process.env, PWD: projectRoot },
})
} catch {
// If next lint fails, try eslint directly with flat config
console.log('Falling back to eslint directly...')
try {
// Try auto-fix first
try {
execSync('npx eslint . --ext .ts,.tsx --fix', {
stdio: 'inherit',
cwd: projectRoot,
})
} catch {
// If auto-fix fails, run without fix to show remaining errors
execSync('npx eslint . --ext .ts,.tsx', {
stdio: 'inherit',
cwd: projectRoot,
})
}
} catch {
console.error('Both next lint and eslint failed')
process.exit(1)
}
}