Merged in feat/shared-ts-config (pull request #1610)

Add typescript-config package with shared configs

* Move web config to shared

* Move design-system ts config to typescript-config package

* Move redis-api tsconfig to typescript-config package

* Sort tsconfig keys

* Update react-library tsconfig

Move declaration and declarationMap from base
Add sourceMap

This fixes Go-to-Definition, debugging and similar in packages/apps where it is consumed

* Update base config module and moduleResolution


Approved-by: Michael Zetterberg
Approved-by: Christian Andolf
This commit is contained in:
Anton Gunnarsson
2025-03-28 07:07:24 +00:00
parent 45c992dcef
commit b535b53901
10 changed files with 73 additions and 61 deletions

View File

@@ -1,28 +1,6 @@
{
"extends": "@scandic-hotels/typescript-config/bun.json",
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false,
"paths": {
"@/*": ["./src/*"]
}

View File

@@ -104,6 +104,7 @@
"zustand": "^4.5.2"
},
"devDependencies": {
"@scandic-hotels/typescript-config": "workspace:*",
"@svgr/webpack": "^8.1.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",

View File

@@ -1,20 +1,6 @@
{
"extends": "@scandic-hotels/typescript-config/nextjs.json",
"compilerOptions": {
"target": "es2022",
"lib": ["dom", "dom.iterable", "ES2022"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleDetection": "force",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"

View File

@@ -1,25 +1,8 @@
{
"extends": "@scandic-hotels/typescript-config/react-library.json",
"compilerOptions": {
"declaration": true,
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noEmit": true
},
"include": ["example", "lib"],
"exclude": ["node_modules", "**/*.test.ts"]

View File

@@ -0,0 +1,16 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"esModuleInterop": true,
"incremental": false,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleDetection": "force",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022"
}
}

View File

@@ -0,0 +1,11 @@
{
"extends": "@scandic-hotels/typescript-config/base.json",
"compilerOptions": {
"allowImportingTsExtensions": true,
"allowJs": true,
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"target": "ESNext",
"verbatimModuleSyntax": true
}
}

View File

@@ -0,0 +1,12 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"incremental": true,
"jsx": "preserve",
"noEmit": true,
"plugins": [{ "name": "next" }]
}
}

View File

@@ -0,0 +1,5 @@
{
"name": "@scandic-hotels/typescript-config",
"private": true,
"version": "0.0.0"
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"jsx": "react-jsx",
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"sourceMap": true
}
}

View File

@@ -6251,6 +6251,7 @@ __metadata:
"@radix-ui/react-visually-hidden": "npm:^1.1.0"
"@react-aria/ssr": "npm:^3.9.5"
"@scandic-hotels/design-system": "workspace:*"
"@scandic-hotels/typescript-config": "workspace:*"
"@sentry/nextjs": "npm:^8.41.0"
"@svgr/webpack": "npm:^8.1.0"
"@t3-oss/env-nextjs": "npm:^0.9.2"
@@ -6344,6 +6345,12 @@ __metadata:
languageName: unknown
linkType: soft
"@scandic-hotels/typescript-config@workspace:*, @scandic-hotels/typescript-config@workspace:packages/typescript-config":
version: 0.0.0-use.local
resolution: "@scandic-hotels/typescript-config@workspace:packages/typescript-config"
languageName: unknown
linkType: soft
"@sentry-internal/browser-utils@npm:8.55.0":
version: 8.55.0
resolution: "@sentry-internal/browser-utils@npm:8.55.0"