CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-sindresorhus--tsconfig

Shared TypeScript configuration for projects targeting Node.js 20 with strict compiler settings

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

index.mddocs/

@sindresorhus/tsconfig

@sindresorhus/tsconfig provides a shared TypeScript configuration for projects targeting Node.js 20+ with strict compiler settings. It enforces modern JavaScript features, comprehensive type safety, and best practices for TypeScript development.

Package Information

  • Package Name: @sindresorhus/tsconfig
  • Package Type: npm
  • Language: TypeScript Configuration
  • Installation: npm install --save-dev @sindresorhus/tsconfig
  • Requirements: TypeScript 5.5+, Node.js 20+

Core Imports

This package exports a TypeScript configuration file that is consumed via the extends property in your project's tsconfig.json:

{
  "extends": "@sindresorhus/tsconfig"
}

The package export path is defined as:

{
  "exports": "./tsconfig.json"
}

Basic Usage

Create or update your project's tsconfig.json to extend this configuration:

{
  "extends": "@sindresorhus/tsconfig",
  "compilerOptions": {
    "outDir": "./dist"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

The extended configuration will provide strict TypeScript settings optimized for Node.js 20+ development with modern ECMAScript features.

Architecture

The configuration provides several key areas of TypeScript compiler settings:

  • Module System: Configured for Node.js 20 with ESNext targeting
  • Type Safety: Comprehensive strict mode settings and error detection
  • Output Configuration: Declaration files, source maps, and output formatting
  • Library Support: DOM and ES2023 libraries with React JSX support
  • Development Experience: Enhanced error reporting and consistency enforcement

Capabilities

Module Configuration

Node.js 20+ module system configuration with ESNext targeting and modern module resolution.

{
  "compilerOptions": {
    "module": "node20",
    "moduleResolution": "node16", 
    "moduleDetection": "force",
    "target": "esnext"
  }
}

Library and Runtime Support

DOM and ES2023 library support optimized for Node.js 20 runtime with React JSX compilation capability.

{
  "compilerOptions": {
    "lib": ["DOM", "DOM.Iterable", "ES2023"],
    "resolveJsonModule": false,
    "jsx": "react-jsx"
  }
}

Output and Build Configuration

Comprehensive output configuration for distribution builds with declaration files and consistent formatting.

{
  "compilerOptions": {
    "outDir": "${configDir}/distribution",
    "declaration": true,
    "newLine": "lf",
    "stripInternal": true,
    "erasableSyntaxOnly": true,
    "noEmitOnError": true
  }
}

Strict Type Safety Settings

Complete strict mode configuration with enhanced error detection and type safety enforcement.

{
  "compilerOptions": {
    "strict": true,
    "noImplicitReturns": true,
    "noImplicitOverride": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "noUncheckedIndexedAccess": true,
    "noPropertyAccessFromIndexSignature": true,
    "noUncheckedSideEffectImports": true
  }
}

Development and Consistency Settings

Additional compiler options for improved development experience and code consistency.

{
  "compilerOptions": {
    "useDefineForClassFields": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true
  }
}

Configuration Override Patterns

When extending this configuration, you can override specific settings for your project needs:

{
  "extends": "@sindresorhus/tsconfig",
  "compilerOptions": {
    // Override output directory
    "outDir": "./build",
    // Add additional libraries
    "lib": ["DOM", "DOM.Iterable", "ES2023", "WebWorker"],
    // Adjust module detection
    "moduleDetection": "auto"
  }
}

Complete Configuration Reference

The exported configuration includes all the following compiler options:

{
  "compilerOptions": {
    "outDir": "${configDir}/distribution",
    "module": "node20",
    "moduleResolution": "node16",
    "moduleDetection": "force",
    "target": "esnext",
    "lib": ["DOM", "DOM.Iterable", "ES2023"],
    "resolveJsonModule": false,
    "jsx": "react-jsx",
    "declaration": true,
    "newLine": "lf",
    "stripInternal": true,
    "erasableSyntaxOnly": true,
    "strict": true,
    "noImplicitReturns": true,
    "noImplicitOverride": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "noUncheckedIndexedAccess": true,
    "noPropertyAccessFromIndexSignature": true,
    "noUncheckedSideEffectImports": true,
    "noEmitOnError": true,
    "useDefineForClassFields": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true
  }
}

docs

index.md

tile.json