Skip to content

Commit d678bcc

Browse files
committed
chore: update TypeScript configuration files for improved clarity and options
1 parent b4589f1 commit d678bcc

File tree

7 files changed

+30
-18
lines changed

7 files changed

+30
-18
lines changed

packages/@straw-hat/tsconfig/README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ Base TypeScript configurations.
77

88
## References
99

10-
The following is the of available configuration types:
10+
The following is the list of available configuration types:
1111

12-
- `@straw-hat/tsconfig/lib/base`: for the baseline for your projects.
13-
- `@straw-hat/tsconfig/lib/react.nextjs`: for React NextJS applications.
14-
- `@straw-hat/tsconfig/lib/react.cra`: for React CRA-like web applications.
15-
- `@straw-hat/tsconfig/lib/react.lib`: for React libraries.
16-
- `@straw-hat/tsconfig/lib/cypress`: for Cypress tests.
17-
- `@straw-hat/tsconfig/lib/browser.lib`: for libraries that are intended to be used in the browser.
12+
- `@straw-hat/tsconfig/lib/base`: Modern baseline for your projects (skipLibCheck, target es2022, strict, etc).
13+
- `@straw-hat/tsconfig/lib/lib`: For Node.js libraries (declaration, composite, NodeNext, etc).
14+
- `@straw-hat/tsconfig/lib/browser.lib`: For browser libraries (adds DOM libs).
15+
- `@straw-hat/tsconfig/lib/react.lib`: For React libraries (adds JSX and DOM libs).
16+
- `@straw-hat/tsconfig/lib/react.nextjs`: For React Next.js applications (Preserve modules, noEmit, DOM libs).
17+
- `@straw-hat/tsconfig/lib/react.cra`: For React CRA-like web applications (Preserve modules, noEmit, DOM libs).
18+
- `@straw-hat/tsconfig/lib/cypress`: For Cypress tests (CommonJS, DOM libs).
1819

1920
## How-To Guides
2021

@@ -33,3 +34,9 @@ The following is the of available configuration types:
3334
"extends": "@straw-hat/tsconfig/lib/{type}"
3435
}
3536
```
37+
38+
- For libraries in a monorepo, use `lib` or `react.lib` and set `composite: true` and `declarationMap: true`.
39+
- For browser/React projects, use `browser.lib`, `react.lib`, `react.nextjs`, or `react.cra` as appropriate.
40+
- For Cypress, use `cypress`.
41+
42+
See each config file for the exact options included.

packages/@straw-hat/tsconfig/lib/browser.lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json.schemastore.org/tsconfig",
3-
"extends": "./base",
3+
"extends": "./lib",
44
"display": "Browser Library",
55
"compilerOptions": {
66
"lib": ["ESNext", "dom", "dom.iterable"]

packages/@straw-hat/tsconfig/lib/cypress.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"extends": "./base",
44
"display": "Cypress",
55
"compilerOptions": {
6-
"target": "es5",
7-
"module": "commonjs"
6+
"target": "es2022",
7+
"module": "CommonJS",
8+
"lib": ["es2022", "dom", "dom.iterable"]
89
}
910
}

packages/@straw-hat/tsconfig/lib/lib.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"emitDeclarationOnly": false,
99
"module": "Node16",
1010
"moduleResolution": "node16",
11-
"target": "ES2022"
11+
"target": "ES2022",
12+
"verbatimModuleSyntax": true,
13+
"composite": true
1214
}
1315
}

packages/@straw-hat/tsconfig/lib/react.cra.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"declaration": false,
1010
"emitDeclarationOnly": false,
1111
"jsx": "react-jsx",
12-
"lib": ["dom", "dom.iterable", "esnext"]
12+
"lib": ["dom", "dom.iterable", "esnext"],
13+
"module": "Preserve",
14+
"noEmit": true
1315
}
1416
}

packages/@straw-hat/tsconfig/lib/react.lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json.schemastore.org/tsconfig",
3-
"extends": "./base",
3+
"extends": "./lib",
44
"display": "React Library",
55
"compilerOptions": {
66
"jsx": "react-jsx",

packages/@straw-hat/tsconfig/lib/react.nextjs.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
"extends": "./base",
44
"display": "React Next.js",
55
"compilerOptions": {
6-
"target": "ES2017",
6+
"target": "es2022",
77
"jsx": "preserve",
8-
"lib": ["dom", "dom.iterable", "esnext"],
8+
"lib": ["es2022", "dom", "dom.iterable"],
99
"allowJs": true,
1010
"noEmit": true,
11-
"emitDeclarationOnly": false,
1211
"isolatedModules": true,
13-
"incremental": true,
12+
"module": "Preserve",
1413
"moduleResolution": "bundler",
1514
"declaration": false,
1615
"declarationMap": false,
17-
"plugins": [{ "name": "next" }]
16+
"incremental": true,
17+
"verbatimModuleSyntax": true
1818
}
1919
}

0 commit comments

Comments
 (0)