Skip to content

Commit

Permalink
tsconfig: Introduce new tsconfig.app.json
Browse files Browse the repository at this point in the history
The change in 2aa6462 is resulting in a vite.config.js and
vite.config.d.ts being generated which we don't want. The work
around, to be able to have type checking of both src files
and vite.config.ts during build is to create a dedicated
tsconfig.app.json and tsconfig.node.json.

See:
* vitejs/vite#15913
* https://github.com/vuejs/create-vue/blob/f75fd9813a624b8e44b012608335721901aba00b/template/tsconfig/base/tsconfig.json
  • Loading branch information
philbates35 committed Feb 24, 2024
1 parent b1657bc commit ed6e058
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 27 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Except...:
!resources/
!package.json
!tsconfig.app.json
!tsconfig.json
!tsconfig.node.json
!vite.config.ts
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.json", "./tsconfig.node.json"],
project: ["./tsconfig.json", "./tsconfig.app.json", "./tsconfig.node.json"],
tsconfigRootDir: __dirname,
},
plugins: ["import"],
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
!resources/
!.eslintrc.cjs
!package.json
!tsconfig.app.json
!tsconfig.json
!tsconfig.node.json
!vite.config.ts
28 changes: 28 additions & 0 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,

/* Absolute imports */
"paths": {
"@/*": ["./resources/js/*"]
},

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["resources/js"]
}
34 changes: 8 additions & 26 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,

/* Absolute imports */
"paths": {
"@/*": ["./resources/js/*"]
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["resources/js"],
"references": [{ "path": "./tsconfig.node.json" }]
{
"path": "./tsconfig.node.json"
}
]
}
1 change: 1 addition & 0 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"noEmit": true,
"allowSyntheticDefaultImports": true,
"strict": true
},
Expand Down

0 comments on commit ed6e058

Please sign in to comment.