I’m new to Turborepo and I’m trying to understand some best practices. I want my builds to fail on linting errors.
With a Next app I have the script setup like this, since next build
internally runs the linter the build fails if theres any warnings.
"build": "next build",
"lint": "next lint --max-warnings 0",
Now with a Vite app similarly setup like this, if I run lint directly it fails, but if I run build the vite doesn’t call lint by default:
"build": "tsc && vite build",
"lint": "eslint \"src/**/*.ts\" --max-warnings 0"
Is the correct way to fix this to add lint to build script (make it act like the Next apps):
"build": "tsc && pnpm lint && vite build",
Or modify my turbo.json to always run lint before build (feels unnecessary for the Next apps that already do it):
"tasks": {
"build": {
"dependsOn": ["lint", "^build"],
}
}
Or maybe target just the specific Vite app (seems funky to have a #lint run in the #build pipeline):
"tasks": {
"viteapp#build": {
"dependsOn": ["viteapp#lint"]
}
"build": {
"dependsOn": ["^build"],
}
}
Or disabling the built in Next build linting so turbo can handle it all:
const nextConfig = {
eslint: {
// Handled by Turbo
ignoreDuringBuilds: true,
},
};
export default nextConfig;
Or is there a better way to handle this? I’m aware I could probably vite-plugin-eslint to force the build to run the lint but I wanted to see if there way a more correct “turbo way”.