@langri-sha/tsconfig
v1.0.1
Published
A set of [TypeScript] configuration files, focused on type-checking all your TypeScript and JavaScript modules
Readme
@langri-sha/tsconfig
A set of TypeScript configuration files, focused on type-checking all your TypeScript and JavaScript modules
Provides configurations for composite projects, React and Emotion, using the next JSX runtime for transforming.
Usage
Install the necessary dependencies:
npm install -D typescript @langri-sha/tsconfigFor basic settings, for example:
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@langri-sha/tsconfig"
}For projects in monorepos:
// /workspace/tsconfig.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@langri-sha/tsconfig",
"references": [
{ "path": "./packages/app" }
]
}
// /workspace/packages/app/tsconfig.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@langri-sha/tsconfig/project.json"
}When combining configurations, list the complete configuration first, then
aspects in the order they should apply, with later entries winning. react.json
sets lib to add the DOM types, so it must come after whichever complete
configuration you use, or that configuration's plain lib silently wins
instead. emotion.json only overrides jsxImportSource, and depends on
react.json already having set jsx and lib — it must come after
react.json, not instead of it.
For React applications:
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": ["@langri-sha/tsconfig", "@langri-sha/tsconfig/react.json"]
}For Emotion applications:
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": [
"@langri-sha/tsconfig",
"@langri-sha/tsconfig/react.json",
"@langri-sha/tsconfig/emotion.json"
]
}For a React (or Emotion) package inside a monorepo, use project.json as
the complete configuration instead:
// /workspace/packages/app/tsconfig.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": [
"@langri-sha/tsconfig/project.json",
"@langri-sha/tsconfig/react.json"
]
}