Skip to content

Commit

Permalink
refactor: pull out common configs into base.json and add total typesc…
Browse files Browse the repository at this point in the history
…ript to vite config
  • Loading branch information
stdavis committed Dec 12, 2024
1 parent b90c8b9 commit 3c7b38e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
15 changes: 15 additions & 0 deletions src/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
/* Project */
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", // keep this file in a place that is already git ignored

/* Modules */
"allowImportingTsExtensions": true,

/* Type Checking */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
}
}
11 changes: 2 additions & 9 deletions src/browser-app.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@total-typescript/tsconfig/bundler/dom/app",
"extends": ["@total-typescript/tsconfig/bundler/dom/app", "./base.json"],

"compilerOptions": {
/* Project */
"composite": true, // required for project references in tsconfig.json
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", // keep this file in a place that is already git ignored

/* Language and Environment */
"useDefineForClassFields": true,
"jsx": "react-jsx",

/* Modules */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,

/* Interop Constraints */
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,

/* Type Checking */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"forceConsistentCasingInFileNames": true
}
}
19 changes: 5 additions & 14 deletions src/vite-config.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": ["@total-typescript/tsconfig/bundler/no-dom", "./base.json"],

/* this comes from the vite typescript react template: https://github.com/vitejs/vite/blob/main/packages/create-vite/template-react-ts/tsconfig.node.json */
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
/* Project */
"composite": true, // required for project references in tsconfig.json

/* Bundler mode */
/* Modules */
"module": "ESNext",
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
Expand Down

0 comments on commit 3c7b38e

Please sign in to comment.