From 5f0015f522e6df15635c00cb4a8047908cfee70b Mon Sep 17 00:00:00 2001 From: Himself65 Date: Fri, 17 Feb 2023 20:08:52 -0600 Subject: [PATCH] chore: simplify tsconfig.json (#1108) --- apps/desktop/tsconfig.json | 33 ++---------------------------- apps/web/tsconfig.json | 6 +----- packages/component/tsconfig.json | 26 ++--------------------- packages/data-center/tsconfig.json | 30 ++------------------------- packages/i18n/tsconfig.json | 25 ++-------------------- packages/logger/tsconfig.json | 25 ++-------------------- tsconfig.json | 29 +++++++++++++++++++++----- 7 files changed, 35 insertions(+), 139 deletions(-) diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.json index 888fc03876..7513033f03 100644 --- a/apps/desktop/tsconfig.json +++ b/apps/desktop/tsconfig.json @@ -1,33 +1,4 @@ { - "compilerOptions": { - "target": "ESNext", - "module": "ESNext", - "lib": ["ESNext", "DOM", "DOM.Iterable"], - "moduleResolution": "Node" /* can't use NodeNext, otherwise can't find styled-components and @emotion/styled 's type, because ts won't follow `type` field in @emotion/styled 's packagejson, will follow `main` instead */, - "strict": true, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": true /* Enable strict checking of function types. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - "sourceMap": true, - "resolveJsonModule": true, - "jsx": "react-jsx" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, - "allowJs": false /* Allow javascript files to be compiled. */, - "esModuleInterop": true, - "types": ["vite/client"], - "typeRoots": ["types"], - "noEmit": true, - "experimentalDecorators": true, - "isolatedModules": true, - "skipLibCheck": true, - "noImplicitReturns": true, - "paths": { - "@/*": ["../web/src/*"], - "@affine/component": ["../../packages/component/src/index"], - "@affine/i18n": ["../../packages/i18n/src/index"] - } - }, - "include": ["./src"], - "exclude": ["node_modules"] + "extends": "../../tsconfig.json", + "include": ["./src"] } diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index af61aede2b..aa306830c9 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -18,11 +18,7 @@ "experimentalDecorators": true, "baseUrl": ".", "paths": { - "@/*": ["src/*"], - "@affine/component": ["../../packages/component"], - "@affine/i18n": ["../../packages/i18n"], - "@affine/datacenter": ["../../packages/data-center"], - "@toeverything/pathfinder-logger": ["../../packages/logger"] + "@/*": ["src/*"] } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], diff --git a/packages/component/tsconfig.json b/packages/component/tsconfig.json index 71481d0ed1..7513033f03 100644 --- a/packages/component/tsconfig.json +++ b/packages/component/tsconfig.json @@ -1,26 +1,4 @@ { - "compilerOptions": { - "target": "ES2020", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "experimentalDecorators": true, - "baseUrl": ".", - "paths": { - "@/*": ["src/*"], - "@affine/i18n": ["../i18n/src/index"] - } - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] + "extends": "../../tsconfig.json", + "include": ["./src"] } diff --git a/packages/data-center/tsconfig.json b/packages/data-center/tsconfig.json index 9b54c0195b..7513033f03 100644 --- a/packages/data-center/tsconfig.json +++ b/packages/data-center/tsconfig.json @@ -1,30 +1,4 @@ { - "compilerOptions": { - "target": "ESNext", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": false, - "esModuleInterop": true, - "module": "ESNext", - "moduleResolution": "Node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "experimentalDecorators": true, - "declaration": true, - "baseUrl": ".", - "rootDir": ".", - "outDir": "./dist" - }, - "include": ["next-env.d.ts", "src/**/*.ts", "pages/**/*.tsx"], - "exclude": [ - "node_modules", - "dist", - "src/provider/affine/sync.js", - "src/**/*.spec.ts" - ] + "extends": "../../tsconfig.json", + "include": ["./src"] } diff --git a/packages/i18n/tsconfig.json b/packages/i18n/tsconfig.json index e13f7340ab..7513033f03 100644 --- a/packages/i18n/tsconfig.json +++ b/packages/i18n/tsconfig.json @@ -1,25 +1,4 @@ { - "compilerOptions": { - "target": "ESNext", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": false, - "esModuleInterop": true, - "module": "ESNext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "react-jsx", - "incremental": true, - "experimentalDecorators": true, - "declaration": true, - "baseUrl": ".", - "rootDir": ".", - "outDir": "./dist" - }, - "include": ["src/**/*.ts"], - "exclude": ["node_modules", "dist"] + "extends": "../../tsconfig.json", + "include": ["./src"] } diff --git a/packages/logger/tsconfig.json b/packages/logger/tsconfig.json index 6d5228c9c0..7513033f03 100644 --- a/packages/logger/tsconfig.json +++ b/packages/logger/tsconfig.json @@ -1,25 +1,4 @@ { - "compilerOptions": { - "target": "ES2020", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": false, - "esModuleInterop": true, - "module": "CommonJS", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "react-jsx", - "incremental": true, - "experimentalDecorators": true, - "declaration": true, - "baseUrl": ".", - "rootDir": ".", - "outDir": "./dist" - }, - "include": ["next-env.d.ts", "src/**/*.ts", "pages/**/*.tsx"], - "exclude": ["node_modules", "dist"] + "extends": "../../tsconfig.json", + "include": ["./src"] } diff --git a/tsconfig.json b/tsconfig.json index a2d46c87bc..5e5b4c08be 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,17 +17,36 @@ "experimentalDecorators": true, "baseUrl": ".", "paths": { - "@affine/component": ["packages/component/src/index"], - "@affine/datacenter": ["packages/datacenter/src"], - "@affine/i18n": ["packages/i18n/src"], - "@affine/logger": ["packages/logger/src"] + "@affine/component": ["./packages/component/src/index"], + "@affine/datacenter": ["./packages/datacenter/src"], + "@affine/i18n": ["./packages/i18n/src"], + "@affine/logger": ["./packages/logger/src"], + "@toeverything/pathfinder-logger": ["./packages/logger"] } }, "references": [ { "path": "./tests" + }, + { + "path": "./apps/web" + }, + { + "path": "./apps/desktop" + }, + { + "path": "./packages/data-center" + }, + { + "path": "./packages/component" + }, + { + "path": "./packages/i18n" + }, + { + "path": "./packages/logger" } ], - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "files": [], "exclude": ["node_modules"] }