From ec2f766f5e1941e856665cdbbf4cfb41fb76e2ad Mon Sep 17 00:00:00 2001 From: "metabase-bot[bot]" <109303359+metabase-bot[bot]@users.noreply.github.com> Date: Fri, 3 Mar 2023 16:16:30 +0000 Subject: [PATCH] Attempt to improve DX on code navigation (#28215) (#28898) Previously, JS files isn't picked up by VS Code, so they'll have limited intellisence. Also, Jest and Cypress has conflicting names e.g. `describe` or `expect`. So, this commit attempt to resolve that as well. Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> --- e2e/tsconfig.json | 11 +++++++++++ jsconfig.json | 21 --------------------- tsconfig.base.json | 18 ++++++++++++++++++ tsconfig.json | 41 +++++++++++++++-------------------------- 4 files changed, 44 insertions(+), 47 deletions(-) create mode 100644 e2e/tsconfig.json delete mode 100644 jsconfig.json create mode 100644 tsconfig.base.json diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json new file mode 100644 index 00000000000..e3667cd38a1 --- /dev/null +++ b/e2e/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "types": ["cypress", "@testing-library/cypress"], + "paths": { + "*": ["../frontend/src/*"], + "e2e/*": ["./*"] + } + }, + "include": ["**/*"] +} diff --git a/jsconfig.json b/jsconfig.json deleted file mode 100644 index 16599a28685..00000000000 --- a/jsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "include": [ - "frontend/src/**/*", - "enterprise/frontend/src/**/*", - "frontend/test/**/*", - "enterprise/frontend/test/**/*" - ], - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": [ - "./frontend/src/*", - "./frontend/test/*", - "./enterprise/frontend/src/*", - "./enterprise/frontend/test/*" - ] - }, - "experimentalDecorators": true, - "strictBindCallApply": true - } -} diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 00000000000..b8fe21cf549 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "jsx": "react", + "target": "esnext", + "allowSyntheticDefaultImports": true, + "module": "commonjs", + "isolatedModules": true, + "strict": true, + "moduleResolution": "node", + "skipLibCheck": true, + "allowJs": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "lib": ["dom", "dom.iterable", "esnext"] + } +} diff --git a/tsconfig.json b/tsconfig.json index a1901b6d0a7..21118226274 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,38 +1,27 @@ { + "extends": "./tsconfig.base.json", "compilerOptions": { - "jsx": "react", - "target": "esnext", - "lib": ["dom", "dom.iterable", "esnext"], - "allowSyntheticDefaultImports": true, - "module": "commonjs", - "isolatedModules": true, - "strict": true, - "moduleResolution": "node", - "skipLibCheck": true, "paths": { "*": [ "./frontend/src/*", "./frontend/test/*", "./enterprise/frontend/src/*", "./enterprise/frontend/test/*" - ], - "e2e/*": ["./e2e/*"] - }, - "allowJs": true, - "esModuleInterop": true, - "experimentalDecorators": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true + ] + } }, "include": [ - "frontend/src/**/*.ts", - "frontend/src/**/*.tsx", - "enterprise/frontend/src/**/*.ts", - "enterprise/frontend/src/**/*.tsx", - "frontend/test/**/*.ts", - "frontend/test/**/*.tsx", - "enterprise/frontend/test/**/*.ts", - "enterprise/frontend/test/**/*.tsx" + "frontend/src/**/*", + "enterprise/frontend/src/**/*", + "frontend/test/**/*", + "enterprise/frontend/test/**/*" ], - "exclude": ["node_modules"] + "exclude": [ + "node_modules", + // The following files will load `frontend/src/metabase/app` which will conflict with + // `frontend/src/metabase/App.tsx`, since now we're loading both JS and TS files. + "frontend/src/metabase/app-main.js", + "frontend/src/metabase/app-public.js", + "frontend/src/metabase/app-embed.js" + ] } -- GitLab