feat: run 'next lint' in lint-staged
This commit is contained in:
@@ -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",
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user