Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app-vite&app-webpack): upgrade tsconfig preset #17301

Merged
merged 5 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app-vite/stricter-tsconfig-preset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig-preset.json",
"compilerOptions": {
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true
}
}
32 changes: 23 additions & 9 deletions app-vite/tsconfig-preset.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
{
"compilerOptions": {
"allowImportingTsExtensions": true,
"allowJs": true,
// `baseUrl` must be placed on the extending configuration in devland, or paths won't be recognized

// `"baseUrl": "."` option should be defined in the tsconfig file in devland which extends this preset
// That way, the `paths` we defined in this preset are resolved starting from the devland project root
// instead of this TS preset file's location
// This allows Quasar to centralize the management of default paths in the preset,
// instead of asking the dev to keep them in sync when something changes

"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
// Needed to address https://github.com/quasarframework/app-extension-typescript/issues/36
"noEmit": true,
"resolveJsonModule": true,
// Avoid cross-os errors due to inconsistent file casing
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"strict": true,
"target": "esnext",
"isolatedModules": true,
"useDefineForClassFields": true,
// Fix Volar issue https://github.com/johnsoncodehk/volar/issues/1153
"jsx": "preserve",
"lib": ["esnext", "dom"],
"isolatedModules": true,

"paths": {
"src/*": ["src/*"],
"app/*": ["*"],
Expand All @@ -27,6 +30,17 @@
"assets/*": ["src/assets/*"],
"boot/*": ["src/boot/*"],
"stores/*": ["src/stores/*"]
}
},

// Fix Volar issue https://github.com/johnsoncodehk/volar/issues/1153
"jsx": "preserve",

// Rules preventing code smells and enforcing best practices, partially overlapping with linting
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noImplicitOverride": true,
"noUnusedLocals": true,
// Avoid cross-os errors due to inconsistent file casing
"forceConsistentCasingInFileNames": true,
}
}
9 changes: 9 additions & 0 deletions app-webpack/stricter-tsconfig-preset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig-preset.json",
"compilerOptions": {
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true
}
}
29 changes: 22 additions & 7 deletions app-webpack/tsconfig-preset.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
{
"compilerOptions": {
"allowImportingTsExtensions": true,
"allowJs": true,
// `baseUrl` must be placed on the extending configuration in devland, or paths won't be recognized

// `"baseUrl": "."` option should be defined in the tsconfig file in devland which extends this preset
// That way, the `paths` we defined in this preset are resolved starting from the devland project root
// instead of this TS preset file's location
// This allows Quasar to centralize the management of default paths in the preset,
// instead of asking the dev to keep them in sync when something changes

"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
// Needed to address https://github.com/quasarframework/app-extension-typescript/issues/36
"noEmit": true,
"resolveJsonModule": true,
// Avoid cross-os errors due to inconsistent file casing
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"strict": true,
"target": "es6",
// Fix Volar issue https://github.com/johnsoncodehk/volar/issues/1153
"jsx": "preserve",
"lib": ["esnext", "dom"],

"paths": {
"src/*": ["src/*"],
"app/*": ["*"],
Expand All @@ -25,6 +29,17 @@
"assets/*": ["src/assets/*"],
"boot/*": ["src/boot/*"],
"stores/*": ["src/stores/*"]
}
},

// Fix Volar issue https://github.com/johnsoncodehk/volar/issues/1153
"jsx": "preserve",

// Rules preventing code smells and enforcing best practices, partially overlapping with linting
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noImplicitOverride": true,
"noUnusedLocals": true,
// Avoid cross-os errors due to inconsistent file casing
"forceConsistentCasingInFileNames": true,
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@quasar/app/tsconfig-preset",
"compilerOptions": {
// `baseUrl` should be set to the current folder to allow Quasar TypeScript preset to manage paths on your behalf
"baseUrl": "."<% if (sfcStyle === 'class') { %>,
"experimentalDecorators": true<% } %><% if (preset.ie) { %>,
"target": "es5"<% } %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@quasar/app-vite/tsconfig-preset",
"compilerOptions": {
// `baseUrl` should be set to the current folder to allow Quasar TypeScript preset to manage paths on your behalf
"baseUrl": "."
},
"exclude": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@quasar/app-vite/tsconfig-preset",
"compilerOptions": {
// `baseUrl` should be set to the current folder to allow Quasar TypeScript preset to manage paths on your behalf
"baseUrl": "."
},
"exclude": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@quasar/app-webpack/tsconfig-preset",
"compilerOptions": {
// `baseUrl` should be set to the current folder to allow Quasar TypeScript preset to manage paths on your behalf
"baseUrl": "."
},
"exclude": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@quasar/app-webpack/tsconfig-preset",
"compilerOptions": {
// `baseUrl` should be set to the current folder to allow Quasar TypeScript preset to manage paths on your behalf
"baseUrl": "."
},
"exclude": [
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/quasar-cli-vite/supporting-ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Create `/tsconfig.json` file at the root of you project with this content:
{
"extends": "@quasar/app-vite/tsconfig-preset",
"compilerOptions": {
// `baseUrl` should be set to the current folder to allow Quasar TypeScript preset to manage paths on your behalf
"baseUrl": "."
},
"exclude": [
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/quasar-cli-webpack/supporting-ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Then create `/tsconfig.json` file at the root of you project with this content:
{
"extends": "@quasar/app-webpack/tsconfig-preset",
"compilerOptions": {
// `baseUrl` should be set to the current folder to allow Quasar TypeScript preset to manage paths on your behalf
"baseUrl": "."
},
"exclude": [
Expand Down
3 changes: 1 addition & 2 deletions ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"jsx": "preserve",
"allowJs": true,
"target": "esnext",
"module": "esnext",
"module": "nodenext",
"skipLibCheck": true,
"moduleResolution": "node",
"outDir": "./dist"
},
"include": ["./src/**/*"]
Expand Down
Loading