From 45a8fd8c43d5cc1d53eea8820f5c13593919ed0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20J=C3=A4derberg?= Date: Wed, 27 Aug 2025 12:02:37 +0000 Subject: [PATCH] Merged in fix/linting-booking-flow (pull request #2709) Fix/linting booking flow * fix import issues and add lint check no-extraneous-dependencies * fix use type HotelType instead of string * add no-extraneous-dependencies lint check to booking-flow Approved-by: Anton Gunnarsson --- packages/booking-flow/eslint.config.mjs | 26 +++++++++++++++++++++++++ packages/booking-flow/package.json | 4 +++- yarn.lock | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/booking-flow/eslint.config.mjs b/packages/booking-flow/eslint.config.mjs index 3fc50d700..a6e872a08 100644 --- a/packages/booking-flow/eslint.config.mjs +++ b/packages/booking-flow/eslint.config.mjs @@ -1,3 +1,6 @@ +import path from "node:path" +import { fileURLToPath } from "node:url" + import { FlatCompat } from "@eslint/eslintrc" import js from "@eslint/js" import typescriptEslint from "@typescript-eslint/eslint-plugin" @@ -10,6 +13,8 @@ const compat = new FlatCompat({ allConfig: js.configs.all, }) +const packageDir = path.dirname(fileURLToPath(import.meta.url)) + export default defineConfig([ { extends: compat.extends("next/core-web-vitals", "plugin:import/typescript"), @@ -22,10 +27,31 @@ export default defineConfig([ parser: tsParser, }, + settings: { + // Ensure the plugin can resolve workspace packages and TS path aliases + "import/resolver": { + typescript: { + project: [path.join(packageDir, "tsconfig.json")], + alwaysTryTypes: true, + }, + node: { + extensions: [".js", ".jsx", ".ts", ".tsx"], + }, + }, + }, + rules: { "no-unused-vars": "off", "react/function-component-definition": "error", "import/no-relative-packages": "error", + "import/no-extraneous-dependencies": [ + "warn", + { + includeInternal: true, + includeTypes: true, + packageDir: [packageDir], + }, + ], "simple-import-sort/imports": [ "warn", { diff --git a/packages/booking-flow/package.json b/packages/booking-flow/package.json index 5e212f211..cc4975e8b 100644 --- a/packages/booking-flow/package.json +++ b/packages/booking-flow/package.json @@ -38,13 +38,15 @@ "@scandic-hotels/design-system": "workspace:*", "@scandic-hotels/trpc": "workspace:*", "class-variance-authority": "^0.7.1", + "date-fns": "^4.1.0", "downshift": "^9.0.9", "motion": "^12.10.0", "react-aria-components": "^1.8.0", "react-day-picker": "^9.6.7", "react-hook-form": "^7.56.2", "react-intl": "^7.1.11", - "usehooks-ts": "3.1.1" + "usehooks-ts": "3.1.1", + "zustand": "^4.5.2" }, "peerDependencies": { "next": "^15", diff --git a/yarn.lock b/yarn.lock index 3256bead1..04ed6e05c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6115,6 +6115,7 @@ __metadata: "@typescript-eslint/eslint-plugin": "npm:^8.32.0" "@typescript-eslint/parser": "npm:^8.32.0" class-variance-authority: "npm:^0.7.1" + date-fns: "npm:^4.1.0" dotenv: "npm:^16.5.0" downshift: "npm:^9.0.9" eslint: "npm:^9" @@ -6129,6 +6130,7 @@ __metadata: usehooks-ts: "npm:3.1.1" vitest: "npm:^3.2.4" zod: "npm:^3.24.4" + zustand: "npm:^4.5.2" peerDependencies: next: ^15 react: ^19