Skip to content

Commit

Permalink
Merge pull request #2526 from digitalfabrik/2026-better-tsconfig-setup
Browse files Browse the repository at this point in the history
2026: Better tsconfig breakdown
  • Loading branch information
sarahsporck authored Nov 6, 2023
2 parents d83835b + a705b96 commit 93f18e0
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 36 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ jobs:
- skip_job
- check_config
- restore_yarn_cache
- restore_yarn_tools_cache
- run:
command: yarn prettier:check
name: Prettier
Expand All @@ -490,7 +491,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
- notify
Expand Down
3 changes: 2 additions & 1 deletion .circleci/src/jobs/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ steps:
- skip_job
- check_config
- restore_yarn_cache
- restore_yarn_tools_cache
- run:
name: Prettier
command: yarn prettier:check
Expand All @@ -22,6 +23,6 @@ steps:
command: yarn workspace web stylelint
- run:
name: TS check
command: yarn workspaces run ts:check
command: yarn ts:check
- unit_test
- notify
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ module.exports = {
],
},
parserOptions: {
project: './tsconfig.json',
project: true,
},
overrides: [
{
Expand Down
6 changes: 3 additions & 3 deletions api-client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
1 change: 1 addition & 0 deletions build-configs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"node" // for scripts in tools/
]
},
"include": ["**/*"],
"references": [
{
"path": "../translations"
Expand Down
6 changes: 3 additions & 3 deletions e2e-tests/native/test/pageobjects/dashboard.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ class DashboardPage extends Page {
super('Dashboard-Page')
}

get searchIcon() {
get searchIcon(): ReturnType<typeof $> {
return $('~Search')
}

get headerOverflowButton() {
get headerOverflowButton(): ReturnType<typeof $> {
return $('~More options')
}

get languageIcon() {
get languageIcon(): ReturnType<typeof $> {
return $('~Change language')
}
}
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/native/test/pageobjects/landing.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class LandingPage extends Page {
super('Landing-Page')
}

get cities() {
get cities(): ReturnType<typeof $$> {
return $$('~City-Entry')
}

get search() {
get search(): ReturnType<typeof $> {
return $('~Search-Input')
}

Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/native/test/pageobjects/search.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class SearchPage extends Page {
super('Search-Page')
}

get search() {
get search(): ReturnType<typeof $> {
return $('~Content-Search-Input')
}
}
Expand Down
5 changes: 3 additions & 2 deletions e2e-tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"types": ["node", "@wdio/globals/types", "@wdio/jasmine-framework"],
"sourceMap": false
"sourceMap": false,
"outDir": "dist"
},
"include": ["web", "native", "shared"]
}
6 changes: 3 additions & 3 deletions e2e-tests/web/test/pageobjects/dashboard.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { Routes } from '../../../shared/constants.js'
import { CategoriesPage } from './categories.page.js'

class DashboardPage extends CategoriesPage {
get languageIcon() {
get languageIcon(): ReturnType<typeof $> {
return $("//header//button[@aria-label='Change language']")
}

get searchIcon() {
get searchIcon(): ReturnType<typeof $> {
return $("//header//a[@aria-label='Search']")
}

get locationIcon() {
get locationIcon(): ReturnType<typeof $> {
return $("//header//a[@aria-label='Change location']")
}

Expand Down
6 changes: 3 additions & 3 deletions e2e-tests/web/test/pageobjects/landing.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import Page from './page.js'
* sub page containing specific selectors and methods for a specific page
*/
class LandingPage extends Page {
get cities() {
get cities(): ReturnType<typeof $$> {
return $$('//main//a')
}

get search() {
get search(): ReturnType<typeof $> {
return $('//main//input')
}

city(name: string) {
city(name: string): ReturnType<typeof $> {
return $(`=${name}`)
}

Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/web/test/pageobjects/search.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Routes } from '../../../shared/constants.js'
import Page from './page.js'

class SearchPage extends Page {
get search() {
get search(): ReturnType<typeof $> {
return $('//input')
}

Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/web/wdio-browserstack.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const capabilities = browsers
.filter(browser => process.argv.includes(`--${browser}`))
.map(browser => browserstackCapabilities[browser])

export const config = Object.assign(defaultConfig, {
export const config: WebdriverIO.Config = Object.assign(defaultConfig, {
maxInstances: 1,

user: process.env.E2E_BROWSERSTACK_USER,
Expand Down
18 changes: 14 additions & 4 deletions native/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"composite": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
Expand All @@ -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"]
Expand All @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"test:ci": "yarn test --coverage --ci",
"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",
Expand Down
5 changes: 4 additions & 1 deletion tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"composite": true,
"esModuleInterop": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
Expand All @@ -8,8 +9,10 @@
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true
"strict": true,
"outDir": "dist"
},
"include": ["*"],
"ts-node": {
"esm": true
}
Expand Down
4 changes: 3 additions & 1 deletion translations/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*"
]
Expand Down
18 changes: 16 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"composite": true,
"allowJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["ES5", "ES6"],
Expand All @@ -10,6 +12,18 @@
"resolveJsonModule": true,
"strict": true,
"target": "ESNext",
"useDefineForClassFields": false
}
"skipLibCheck": true,
"useDefineForClassFields": false,
"outDir": "dist"
},
"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" }
]
}
14 changes: 9 additions & 5 deletions web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 93f18e0

Please sign in to comment.