feat: run 'next lint' in lint-staged

This commit is contained in:
Michael Zetterberg
2024-04-18 18:09:24 +02:00
parent a512cd04b5
commit abdc48f57f

View File

@@ -1,4 +1,13 @@
import path from "node:path"
// https://nextjs.org/docs/app/building-your-application/configuring/eslint#lint-staged
const buildEslintCommand = (filenames) =>
`next lint --max-warnings 0 --file ${filenames
.map((f) => path.relative(process.cwd(), f))
.join(" --file ")}`
const config = { const config = {
"*.{js,jsx,ts,tsx}": [buildEslintCommand],
"*.{ts,tsx}": () => "tsc -p tsconfig.json --noEmit", "*.{ts,tsx}": () => "tsc -p tsconfig.json --noEmit",
"*": "prettier --write", "*": "prettier --write",
} }