From f14a029da6f0f15db498738a3ca7539876ba4ddb Mon Sep 17 00:00:00 2001 From: Pavel <14926950+prichodko@users.noreply.github.com> Date: Wed, 2 Mar 2022 18:08:35 +0100 Subject: [PATCH] Support relative imports in packages (#234) * Update tsconfigs * Add ESLint support for relative paths --- .eslintrc | 8 ++++++-- packages/status-core/tsconfig.json | 6 +++++- packages/status-react/tsconfig.json | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.eslintrc b/.eslintrc index b6e99f82..7f231e0d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,6 +3,8 @@ "parser": "@typescript-eslint/parser", "parserOptions": { // TODO: Enable type-aware linting (https://typescript-eslint.io/docs/linting/type-linting) + // "tsconfigRootDir": ".", + // "project": ["./packages/*/tsconfig.json"], "sourceType": "module", "ecmaFeatures": { "jsx": true @@ -70,10 +72,12 @@ }, "import/resolver": { "node": { - "extensions": [".js", ".jsx", ".ts", ".tsx"] + "extensions": [".js", ".jsx", ".ts", ".tsx"], + "project": ["tsconfig.base.json", "packages/*/tsconfig.json"] }, "typescript": { - "alwaysTryTypes": true + "alwaysTryTypes": true, + "project": ["tsconfig.base.json", "packages/*/tsconfig.json"] } } } diff --git a/packages/status-core/tsconfig.json b/packages/status-core/tsconfig.json index ed816987..e29a253e 100644 --- a/packages/status-core/tsconfig.json +++ b/packages/status-core/tsconfig.json @@ -3,6 +3,10 @@ "include": ["src"], "compilerOptions": { "outDir": "dist", - "declarationDir": "dist/types" + "declarationDir": "dist/types", + "baseUrl": ".", + "paths": { + "~/*": ["./*"] + } } } diff --git a/packages/status-react/tsconfig.json b/packages/status-react/tsconfig.json index bbbb84f2..73a8ae4a 100644 --- a/packages/status-react/tsconfig.json +++ b/packages/status-react/tsconfig.json @@ -4,6 +4,10 @@ "compilerOptions": { "outDir": "./dist", "declarationDir": "dist/types", - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "~/*": ["./*"] + } } }