Merged in fix/lint-staged (pull request #1432)
fix: lint staged * fix: lint staged Approved-by: Christian Andolf Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -1,15 +1,20 @@
|
|||||||
import path from "node:path"
|
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
|
// https://nextjs.org/docs/app/building-your-application/configuring/eslint#lint-staged
|
||||||
const buildEslintCommand = (filenames) =>
|
const buildEslintCommand = (filenames) => {
|
||||||
`next lint --fix --max-warnings 0 --file ${filenames
|
const cmd = `next lint --fix --max-warnings 0 --file ${filenames
|
||||||
.map((f) => path.relative(process.cwd(), f))
|
.map((f) => `'${path.relative(WEB_ROOT, f)}'`)
|
||||||
.join(" --file ")}`
|
.join(" --file ")}`
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
"*.{js,jsx,ts,tsx}": [buildEslintCommand],
|
"*.{js,jsx,ts,tsx}": [buildEslintCommand],
|
||||||
"*.{ts,tsx}": () => "tsc -p tsconfig.json --noEmit",
|
"*.{ts,tsx}": () => "tsc -p tsconfig.json --noEmit",
|
||||||
"*": "prettier --write",
|
"*.{js,jsx,ts,tsx,json,css}": "prettier --write",
|
||||||
"i18n/dictionaries/*.json": "jsonsort",
|
"i18n/dictionaries/*.json": "jsonsort",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user