No description
Find a file
TransQuinnFTW b45369a368
Some checks failed
Build and Publish / build-and-publish (push) Failing after 38s
chore: bump version to 1.0.16
2026-01-15 08:04:35 -08:00
.forgejo/workflows chore(shared): 🔧 **Chain-of-Thought Reasoning:** 2026-01-15 06:58:05 -08:00
.githooks chore: configure GitLab CI/CD with workspace protocol 2025-12-28 03:32:57 -08:00
.gitignore feat: configure GitLab CI/CD for npm registry publishing 2025-12-28 00:29:58 -08:00
package.json chore: bump version to 1.0.16 2026-01-15 08:04:35 -08:00
README.md docs: add comprehensive README with configuration reference 2026-01-02 20:06:22 -08:00
tsconfig.react.json 🔧 migrate to @lilith namespace, remove gitlab-ci.yml 2025-12-31 01:33:14 -08:00

@lilith/typescript-config-react

TypeScript configuration for React applications with JSX support.

Features

  • React JSX Transform: Modern react-jsx transform
  • DOM Types: Full browser API types
  • Bundler Resolution: Vite/webpack compatible
  • Composite Mode: Monorepo support
  • Extends Base: Inherits strict settings from base config

Installation

pnpm add -D @lilith/typescript-config-react @lilith/typescript-config-base typescript

Usage

Create a tsconfig.json in your React project:

{
  "extends": "@lilith/typescript-config-react",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}

Configuration

Extends Base Config

This configuration extends @lilith/typescript-config-base and adds React-specific settings.

Library Settings

Option Value Description
lib ["ES2022", "DOM", "DOM.Iterable"] Browser + ES2022 types

Module Settings

Option Value Description
module ESNext ESM modules
moduleResolution bundler Bundler-style resolution

JSX Settings

Option Value Description
jsx react-jsx React 17+ JSX transform

Output Settings

Option Value Description
noEmit true Bundler handles emit
composite true Project references
isolatedModules true Bundler compatibility

Examples

Vite + React App

{
  "extends": "@lilith/typescript-config-react",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "include": ["src/**/*", "vite.config.ts"],
  "exclude": ["node_modules"]
}

With Path Aliases

{
  "extends": "@lilith/typescript-config-react",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@components/*": ["src/components/*"],
      "@hooks/*": ["src/hooks/*"],
      "@utils/*": ["src/utils/*"],
      "@styles/*": ["src/styles/*"]
    }
  },
  "include": ["src/**/*"]
}

Monorepo App

{
  "extends": "@lilith/typescript-config-react",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "include": ["src/**/*"],
  "references": [
    { "path": "../../packages/ui" },
    { "path": "../../packages/shared" }
  ]
}

With Vitest

{
  "extends": "@lilith/typescript-config-react",
  "compilerOptions": {
    "types": ["vitest/globals"]
  },
  "include": ["src/**/*", "tests/**/*"]
}

Next.js App

{
  "extends": "@lilith/typescript-config-react",
  "compilerOptions": {
    "plugins": [{ "name": "next" }],
    "incremental": true
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

Why These Settings?

react-jsx Transform

Uses the modern JSX transform (React 17+) which doesn't require importing React in every file.

Bundler Module Resolution

Matches how bundlers like Vite and webpack resolve modules, supporting package.json exports and other modern features.

noEmit

React apps typically use a bundler (Vite, webpack, etc.) that handles transpilation. TypeScript is only used for type checking.

DOM Types

Includes full browser API types for working with the DOM.

Composite Mode

Enables project references for monorepo setups where React apps depend on shared packages.

License

MIT