From b8e4d06bcb2911820971e38f146dd0f3c34ce8be Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 17 Oct 2023 15:43:17 +0200 Subject: [PATCH 1/3] 2026: better tsconfig breakdown --- .circleci/config.yml | 2 +- .circleci/src/jobs/check.yml | 2 +- .eslintrc.js | 2 +- api-client/tsconfig.json | 6 +++--- build-configs/tsconfig.json | 1 + native/tsconfig.json | 18 ++++++++++++++---- package.json | 3 ++- tools/tsconfig.json | 4 +++- translations/tsconfig.json | 4 +++- tsconfig.json | 13 ++++++++++++- web/tsconfig.json | 14 +++++++++----- 11 files changed, 50 insertions(+), 19 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index da5a9f98d3..c68ff073a4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -493,7 +493,7 @@ jobs: command: yarn workspace web stylelint name: Stylelint - run: - command: yarn workspaces run ts:check + command: yarn ts:check name: TS check - unit_test: directory: api-client diff --git a/.circleci/src/jobs/check.yml b/.circleci/src/jobs/check.yml index bde0fe8fa6..3bd141df1c 100644 --- a/.circleci/src/jobs/check.yml +++ b/.circleci/src/jobs/check.yml @@ -22,7 +22,7 @@ steps: command: yarn workspace web stylelint - run: name: TS check - command: yarn workspaces run ts:check + command: yarn ts:check - unit_test: directory: api-client - unit_test: diff --git a/.eslintrc.js b/.eslintrc.js index e2f8204d01..65649ea2cd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -132,7 +132,7 @@ module.exports = { ], }, parserOptions: { - project: './tsconfig.json', + project: true, }, overrides: [ { diff --git a/api-client/tsconfig.json b/api-client/tsconfig.json index eb628215f7..2ed94f3a86 100644 --- a/api-client/tsconfig.json +++ b/api-client/tsconfig.json @@ -4,7 +4,7 @@ "composite": true, "lib": ["ES5", "ES6", "dom"], "outDir": "dist", - "types": ["jest", "node"], - "typeRoots": ["src/@types", "node_modules/@types", "../node_modules/@types"] - } + "types": ["jest"] + }, + "include": ["src/**/*", "jest.config.ts", "jest.setup.ts"] } diff --git a/build-configs/tsconfig.json b/build-configs/tsconfig.json index 8f6fa89a68..1e743a0c13 100644 --- a/build-configs/tsconfig.json +++ b/build-configs/tsconfig.json @@ -8,6 +8,7 @@ "node" // for scripts in tools/ ] }, + "include": ["**/*"], "references": [ { "path": "../translations" diff --git a/native/tsconfig.json b/native/tsconfig.json index e3b3eaed30..29f24ffeeb 100644 --- a/native/tsconfig.json +++ b/native/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../tsconfig.json", "compilerOptions": { + "composite": true, "allowJs": true, "allowSyntheticDefaultImports": true, "baseUrl": ".", @@ -9,9 +10,6 @@ "module": "es2020", "outDir": "dist", "paths": { - "api-client/*": ["../api-client/*"], - "build-configs/*": ["../build-configs/*"], - "translations/*": ["../translations/*"], "normalize-strings": ["../api-client/src/@types/normalize-strings"], "@dr.pogodin/react-native-static-server": ["src/@types/react-native-static-server"], "@react-native-async-storage/async-storage/jest/async-storage-mock": ["src/@types/untyped"] @@ -20,7 +18,19 @@ "typeRoots": ["./src/@types", "./node_modules/@types", "../node_modules/@types"], "types": ["jest", "node", "react-native", "styled-components-react-native"] }, - "include": ["src/**/*", "./jest.setup.ts", "index.ts", "jest.config.ts", "metro.config.ci.js", "metro.config.js"], + "include": [ + "src/**/*", + "jest.setup.ts", + "index.ts", + "jest.config.ts", + "babel.config.js", + "metro.config.ci.js", + "metro.config.js", + ".yarn/plugins/root-command.js", + "react-native.config.js", + "run.js", + "src/assets/licenses.json" + ], "references": [ { "path": "../translations" diff --git a/package.json b/package.json index c0213995e4..f0155ee660 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "test:changed": "yarn workspace native test -o && yarn workspace web test -o && yarn workspace api-client test -o && yarn workspace translations test -o", "circleci:update-config": "{ cat .circleci/autogenerated_header.yml; circleci config pack .circleci/src; } > .circleci/config.yml && circleci config validate", "prettier:check": "prettier --check .", - "prettier:write": "prettier --write ." + "prettier:write": "prettier --write .", + "ts:check": "tsc --build" }, "resolutions": { "luxon": "^3.4.2", diff --git a/tools/tsconfig.json b/tools/tsconfig.json index e5ceffb975..ecf33aa590 100644 --- a/tools/tsconfig.json +++ b/tools/tsconfig.json @@ -8,8 +8,10 @@ "noUncheckedIndexedAccess": true, "resolveJsonModule": true, "skipLibCheck": true, - "strict": true + "strict": true, + "outDir": "dist" }, + "include": ["*"], "ts-node": { "esm": true } diff --git a/translations/tsconfig.json b/translations/tsconfig.json index 29bd493810..6c32824e8c 100644 --- a/translations/tsconfig.json +++ b/translations/tsconfig.json @@ -5,13 +5,15 @@ "outDir": "dist", "types": [ "jest", - "node" // for require() in src/__tests__/loadTranslations.spec.ts + "node" // for scripts in tools in src/__tests__/loadTranslations.spec.ts ] }, "include": [ "translations.json", "override-translations/aschaffenburg.json", "override-translations/malte.json", + "jest.config.ts", + "jest.setup.ts", "src/**/*", "tools/**/*" ] diff --git a/tsconfig.json b/tsconfig.json index e6a42b1160..d77734d805 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "composite": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "lib": ["ES5", "ES6"], @@ -11,5 +12,15 @@ "strict": true, "target": "ESNext", "useDefineForClassFields": false - } + }, + "include": ["jest.config.ts", ".prettierrc.js", ".eslintrc.js", ".eslintrc_changed.js"], + "references": [ + { "path": "api-client" }, + { "path": "build-configs" }, + { "path": "e2e-tests" }, + { "path": "native" }, + { "path": "tools" }, + { "path": "translations" }, + { "path": "web" } + ] } diff --git a/web/tsconfig.json b/web/tsconfig.json index 6e94d9a567..06fc4bb423 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -12,17 +12,21 @@ "outDir": "dist", "sourceMap": true, "paths": { - "api-client/*": ["../api-client/*"], - "build-configs/*": ["../build-configs/*"], - "translations/*": ["../translations/*"], "normalize-strings": ["../api-client/src/@types/normalize-strings"] }, "skipLibCheck": true, "target": "ES2019", - "typeRoots": ["./src/@types", "./node_modules/@types", "../node_modules/@types"], "types": ["jest", "node", "react"] }, - "include": ["src/**/*", "tools/*", "./jest.setup.ts", "jest.config.ts"], + "include": [ + "src/**/*", + "tools/*", + "jest.setup.ts", + "jest.config.ts", + "stylelint.config.js", + "www/iframe.js", + "assets/licenses.json" + ], "references": [ { "path": "../translations" From 6c094d50b599ab6d4cc2ac94d73fb9e3972131a8 Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 19 Oct 2023 14:11:32 +0200 Subject: [PATCH 2/3] 2026: run yarn install for tools for typescript --- .circleci/config.yml | 1 + .circleci/src/jobs/check.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index c68ff073a4..b52b1ef98a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -483,6 +483,7 @@ jobs: - skip_job - check_config - restore_yarn_cache + - restore_yarn_tools_cache - run: command: yarn prettier:check name: Prettier diff --git a/.circleci/src/jobs/check.yml b/.circleci/src/jobs/check.yml index 3bd141df1c..8173b8057a 100644 --- a/.circleci/src/jobs/check.yml +++ b/.circleci/src/jobs/check.yml @@ -11,6 +11,7 @@ steps: - skip_job - check_config - restore_yarn_cache + - restore_yarn_tools_cache - run: name: Prettier command: yarn prettier:check From a705b96119a0e3d0de5c1b0dafc8d95a7942f0cc Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 6 Nov 2023 08:38:14 +0100 Subject: [PATCH 3/3] 2026: emit files into separate folder in root --- jest.config.d.ts | 4 ---- jest.config.js | 17 ----------------- tsconfig.json | 4 +++- 3 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 jest.config.d.ts delete mode 100644 jest.config.js diff --git a/jest.config.d.ts b/jest.config.d.ts deleted file mode 100644 index 96e76cfc77..0000000000 --- a/jest.config.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { Config } from '@jest/types' - -declare const config: Partial -export default config diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 66acd90f5f..0000000000 --- a/jest.config.js +++ /dev/null @@ -1,17 +0,0 @@ -const config = { - rootDir: '.', - verbose: true, - projects: ['web', 'native', 'api-client', 'translations'], - reporters: [ - ['default', {}], - [ - 'jest-junit', - { - outputDirectory: '/reports/unit-test', - }, - ], - ], - coverageDirectory: '/reports/coverage', - collectCoverageFrom: ['**/src/**/*.{ts,tsx}'], -} -export default config diff --git a/tsconfig.json b/tsconfig.json index 3b4c78bb88..e818fc3f3a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "composite": true, + "allowJs": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "lib": ["ES5", "ES6"], @@ -12,7 +13,8 @@ "strict": true, "target": "ESNext", "skipLibCheck": true, - "useDefineForClassFields": false + "useDefineForClassFields": false, + "outDir": "dist" }, "include": ["jest.config.ts", ".prettierrc.js", ".eslintrc.js", ".eslintrc_changed.js"], "references": [