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

Improved TSConfigs in examples #6396

Merged
merged 7 commits into from
Nov 13, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions docs/pages/repo/docs/handbook/linting/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,18 @@ Inside `packages/tsconfig`, we have a few `json` files which represent different
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true
"target": "es2022",
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"strict": true,
"noUncheckedIndexedAccess": true,
"moduleResolution": "Bundler",
"module": "ESNext",
"noEmit": true,
"lib": ["es2022", "dom", "dom.iterable"],
},
"exclude": ["node_modules"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ You'll also need to add a `tsconfig.json` at `packages/math-helpers/tsconfig.jso
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"moduleResolution": "node",
"module": "ESNext",
"moduleResolution": "Bundler",
"preserveWatchOutput": true,
"skipLibCheck": true,
"noEmit": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsconfig": "workspace:*",
"turbo": "^1.10.12"
"turbo": "^1.10.16"
},
"packageManager": "pnpm@8.9.0"
}
20 changes: 9 additions & 11 deletions examples/basic/packages/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"target": "es2022",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattpocock is this needed? Doesn't "lib": ["es2022", "dom", "dom.iterable"] already implies "target": "es2022"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusingly, the TS team recommends you keep "target" in place. I still haven't quite grokked why - but I think TS always expects there to be a "target" field. So going against that assumption could result in some funky behaviour.

"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"strict": true,
"strictNullChecks": true
"noUncheckedIndexedAccess": true,
"moduleResolution": "Bundler",
anthonyshew marked this conversation as resolved.
Show resolved Hide resolved
"module": "ESNext",
"noEmit": true,
"lib": ["es2022", "dom", "dom.iterable"],
},
"exclude": ["node_modules"]
}
12 changes: 2 additions & 10 deletions examples/basic/packages/tsconfig/nextjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@
"extends": "./base.json",
"compilerOptions": {
"plugins": [{ "name": "next" }],
"allowJs": true,
"declaration": false,
"declarationMap": false,
"incremental": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"noEmit": true,
"resolveJsonModule": true,
"strict": false,
"target": "es5"
"allowJs": true,
"jsx": "preserve"
},
"include": ["src", "next-env.d.ts"],
"exclude": ["node_modules"]
Expand Down
3 changes: 0 additions & 3 deletions examples/basic/packages/tsconfig/react-library.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx",
"lib": ["ES2015", "DOM"],
"module": "ESNext",
"target": "es6"
}
}
45 changes: 22 additions & 23 deletions examples/basic/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.