@jmlweb/tsconfig-react 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +61 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @jmlweb/tsconfig-react
|
|
2
2
|
|
|
3
|
+
## 1.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4a9ece1: Update documentation to use pnpm commands instead of npm
|
|
8
|
+
- Updated dependencies [4a9ece1]
|
|
9
|
+
- @jmlweb/tsconfig-base@1.0.4
|
|
10
|
+
|
|
11
|
+
## 1.0.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 6b73301: Add changelog section with link to CHANGELOG.md in package READMEs
|
|
16
|
+
- Updated dependencies [6b73301]
|
|
17
|
+
- @jmlweb/tsconfig-base@1.0.3
|
|
18
|
+
|
|
3
19
|
## 1.0.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
## 📦 Installation
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
|
|
23
|
+
pnpm add -D @jmlweb/tsconfig-react typescript @jmlweb/tsconfig-base
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
27
|
+
|
|
26
28
|
## 🚀 Quick Start
|
|
27
29
|
|
|
28
30
|
Create a `tsconfig.json` file in your project root:
|
|
@@ -97,6 +99,38 @@ Create a `tsconfig.json` file in your project root:
|
|
|
97
99
|
}
|
|
98
100
|
```
|
|
99
101
|
|
|
102
|
+
## 🤔 Why Use This?
|
|
103
|
+
|
|
104
|
+
> **Philosophy**: React development should leverage modern JSX transforms and bundler optimizations for the best developer experience and runtime performance.
|
|
105
|
+
|
|
106
|
+
This package provides a TypeScript configuration specifically optimized for React library and application development. It extends the strict base configuration while adding React-specific settings that work seamlessly with modern build tools and the latest React features.
|
|
107
|
+
|
|
108
|
+
### Design Decisions
|
|
109
|
+
|
|
110
|
+
**Modern JSX Transform (`jsx: "react-jsx"`)**: Uses the new JSX runtime from React 17+
|
|
111
|
+
|
|
112
|
+
- **Why**: Eliminates the need to import React in every file, reduces bundle size, and improves build performance. The automatic JSX runtime is the recommended approach for all modern React projects
|
|
113
|
+
- **Trade-off**: Requires React 17+ (which is several years old at this point). Older projects need to upgrade
|
|
114
|
+
- **When to override**: Only if you're stuck on React 16 or need the classic `React.createElement` transform for legacy compatibility
|
|
115
|
+
|
|
116
|
+
**Bundler Module Resolution (`moduleResolution: "bundler"`)**: Optimized for modern build tools
|
|
117
|
+
|
|
118
|
+
- **Why**: Modern bundlers like Vite, Webpack 5+, and esbuild benefit from bundler resolution, which enables better tree-shaking and handles modern module features. This matches how your build tool actually resolves modules
|
|
119
|
+
- **Trade-off**: Not suitable for direct Node.js execution without a build step. But React projects always use bundlers anyway
|
|
120
|
+
- **When to override**: Never for React libraries - this is the optimal choice. Use `@jmlweb/tsconfig-node` for Node.js projects instead
|
|
121
|
+
|
|
122
|
+
**DOM Type Definitions (`lib: ["ES2022", "DOM", "DOM.Iterable"]`)**: Includes browser APIs
|
|
123
|
+
|
|
124
|
+
- **Why**: React components interact with the DOM. Including DOM types prevents type errors when using `window`, `document`, event handlers, and other browser APIs that are fundamental to React development
|
|
125
|
+
- **Trade-off**: Includes types you won't use in server-side code. But React Server Components and SSR still need DOM types for shared components
|
|
126
|
+
- **When to override**: For purely server-side React code (rare). But even Next.js server components often need DOM types for shared code
|
|
127
|
+
|
|
128
|
+
**ESNext Modules (`module: "ESNext"`)**: Modern module syntax for optimal bundling
|
|
129
|
+
|
|
130
|
+
- **Why**: Bundlers work best with ESNext modules. They can perform advanced optimizations like scope hoisting and dead code elimination. Your bundler transpiles to the target environment anyway
|
|
131
|
+
- **Trade-off**: Can't run the TypeScript output directly in Node.js without a bundler. But React projects always use bundlers
|
|
132
|
+
- **When to override**: Never for React projects - let your bundler handle the final module format
|
|
133
|
+
|
|
100
134
|
## 📋 Configuration Details
|
|
101
135
|
|
|
102
136
|
### What's Included
|
|
@@ -239,9 +273,35 @@ See real-world usage examples:
|
|
|
239
273
|
|
|
240
274
|
## 🔗 Related Packages
|
|
241
275
|
|
|
276
|
+
### Internal Packages
|
|
277
|
+
|
|
242
278
|
- [`@jmlweb/tsconfig-base`](../tsconfig-base) - Base TypeScript configuration (extended by this package)
|
|
243
279
|
- [`@jmlweb/eslint-config-react`](../eslint-config-react) - ESLint configuration for React libraries
|
|
244
280
|
- [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier config for consistent formatting
|
|
281
|
+
- [`@jmlweb/vite-config`](../vite-config) - Vite configuration for React projects
|
|
282
|
+
|
|
283
|
+
### External Tools
|
|
284
|
+
|
|
285
|
+
- [TypeScript](https://www.typescriptlang.org/) - Strongly typed programming language that builds on JavaScript
|
|
286
|
+
- [React](https://react.dev/) - JavaScript library for building user interfaces
|
|
287
|
+
- [Vite](https://vite.dev/) - Build tool with first-class TypeScript support
|
|
288
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react) - Official React plugin for Vite
|
|
289
|
+
|
|
290
|
+
## 🔄 Migration Guide
|
|
291
|
+
|
|
292
|
+
### Upgrading to a New Version
|
|
293
|
+
|
|
294
|
+
> **Note:** If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.
|
|
295
|
+
|
|
296
|
+
**No breaking changes have been introduced yet.** This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.
|
|
297
|
+
|
|
298
|
+
For version history, see the [Changelog](./CHANGELOG.md).
|
|
299
|
+
|
|
300
|
+
**Need Help?** If you encounter issues during migration, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
|
|
301
|
+
|
|
302
|
+
## 📜 Changelog
|
|
303
|
+
|
|
304
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
|
|
245
305
|
|
|
246
306
|
## 📄 License
|
|
247
307
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmlweb/tsconfig-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "TypeScript configuration for React libraries with JSX support and modern defaults",
|
|
5
5
|
"main": "tsconfig.json",
|
|
6
6
|
"exports": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@jmlweb/tsconfig-base": "1.0.
|
|
38
|
+
"@jmlweb/tsconfig-base": "1.0.4"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {}
|
|
41
41
|
}
|