From f885760608cd987e09ab78652be2be9ccefe9cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20J=C3=A4derberg?= Date: Thu, 27 Feb 2025 09:42:26 +0000 Subject: [PATCH] Merged in fix/lint-staged (pull request #1432) fix: lint staged * fix: lint staged Approved-by: Christian Andolf Approved-by: Anton Gunnarsson --- apps/scandic-web/lint-staged.config.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/scandic-web/lint-staged.config.js b/apps/scandic-web/lint-staged.config.js index 1959b0716..0de8ce559 100644 --- a/apps/scandic-web/lint-staged.config.js +++ b/apps/scandic-web/lint-staged.config.js @@ -1,15 +1,20 @@ 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) => - `next lint --fix --max-warnings 0 --file ${filenames - .map((f) => path.relative(process.cwd(), f)) +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", - "*": "prettier --write", + "*.{js,jsx,ts,tsx,json,css}": "prettier --write", "i18n/dictionaries/*.json": "jsonsort", }