fix: lint staged * fix: lint staged Approved-by: Christian Andolf Approved-by: Anton Gunnarsson
22 lines
621 B
JavaScript
22 lines
621 B
JavaScript
import path from "node:path"
|
|
|
|
const WEB_ROOT = path.join(process.cwd(), "apps/scandic-web/")
|
|
|
|
// https://nextjs.org/docs/app/building-your-application/configuring/eslint#lint-staged
|
|
const buildEslintCommand = (filenames) => {
|
|
const cmd = `next lint --fix --max-warnings 0 --file ${filenames
|
|
.map((f) => `'${path.relative(WEB_ROOT, f)}'`)
|
|
.join(" --file ")}`
|
|
|
|
return cmd
|
|
}
|
|
|
|
const config = {
|
|
"*.{js,jsx,ts,tsx}": [buildEslintCommand],
|
|
"*.{ts,tsx}": () => "tsc -p tsconfig.json --noEmit",
|
|
"*.{js,jsx,ts,tsx,json,css}": "prettier --write",
|
|
"i18n/dictionaries/*.json": "jsonsort",
|
|
}
|
|
|
|
export default config
|