34 lines
807 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 path = require('path')
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 (error) {
// If next lint fails, try eslint directly with flat config
console.log('Falling back to eslint directly...')
try {
execSync('npx eslint . --ext .ts,.tsx', {
stdio: 'inherit',
cwd: projectRoot,
})
} catch (eslintError) {
console.error('Both next lint and eslint failed')
process.exit(1)
}
}