@igorskyflyer/tsconfig
v1.0.2
Published
🔧 Opinionated, reusable TSConfig base for modern TypeScript projects by igorskyflyer. 🧠
Maintainers
Readme
Table of Contents
- ✨ Features
- 🕵🏼 Usage
- ⚙️ Implementation
- 🎯 Motivation
- 📝 Changelog
- 🪪 License
- 💖 Support
- 🧬 Related
- 👨🏻💻 Author
Features
- 🔧 Strict
TypeScriptrules enabled by default - 📦 Separate configs for
Nodeandbrowserenvironments - 🎯
ES2024target -modernand future-ready - 🗂️ Predefined
src/,dist/andtest/structure - 🔍 Catches
unusedlocals, parameters and implicitany - 🗺️
Source mapsanddeclarationmaps included - ⚡
Zero-configsetup - extend and go
Usage
Install it by executing any of the following, depending on the preferred package manager:
pnpm add -D @igorskyflyer/tsconfigyarn add -D @igorskyflyer/tsconfignpm i -D @igorskyflyer/tsconfigThen extend the preferred config in tsconfig.json:
Node (default):
{
"extends": "@igorskyflyer/tsconfig",
"include": ["src/**/*"],
"exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
}
}Node (explicit):
{
"extends": "@igorskyflyer/tsconfig/node",
"include": ["src/**/*"],
"exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
}
}Browser:
{
"extends": "@igorskyflyer/tsconfig/browser",
"include": ["src/**/*"],
"exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
}
}Base only:
{
"extends": "@igorskyflyer/tsconfig/base",
"include": ["src/**/*"],
"exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
}
}[!NOTE]
include,exclude,rootDirandoutDirare project-specific and must be defined locally.
Implementation
All configs extend base, which defines the shared structure and strict rules.
Base
{
"compilerOptions": {
"declaration": true, // generate .d.ts files
"declarationMap": true, // generate .d.ts.map files
"sourceMap": true, // generate .js.map files
"verbatimModuleSyntax": true, // enforce explicit import/export types
"strict": true, // enable all strict checks
"noUnusedLocals": true, // error on unused local variables
"noUnusedParameters": true, // error on unused function parameters
"noImplicitAny": true, // error on implicit 'any' types
"noImplicitReturns": true, // error on missing return statements
"skipLibCheck": true, // skip type-checking of .d.ts files
"forceConsistentCasingInFileNames": true, // enforce consistent file casing
"noEmitOnError": true // skip emit if type errors exist
}
}Node
Extends base and adds Node environment targeting:
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "ES2024", // modern JS output
"lib": ["ES2024"], // modern built-in types
"module": "NodeNext", // Node ESM-compatible modules
"moduleResolution": "NodeNext" // Node ESM module resolution
}
}Browser
Extends base and adds browser environment targeting:
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "ES2024", // modern JS output
"lib": ["ES2024", "DOM", "DOM.Iterable"], // modern + DOM types
"module": "ESNext", // bundler-compatible modules
"moduleResolution": "Bundler" // bundler module resolution
}
}Motivation
Managing TypeScript configuration across multiple projects is tedious and error-prone. Each project ends up with its own tsconfig.json, slightly different, slightly outdated, with no single source of truth.
@igorskyflyer/tsconfig solves this by providing one opinionated, versioned config that propagates across all projects via a simple extends. Update once, apply everywhere - just like all packages of the @igorskyflyer ecosystem do!
Changelog
Read about the latest changes in the CHANGELOG.
License
Licensed under the MIT license.
Support
Related
✒ DúöScríbî allows you to convert letters with diacritics to regular letters. 🤓
🧠 Zep is a zero-dependency, efficient debounce module. ⏰
🔦 Provides frequently used types for your TypeScript projects. 🦄
🤫 Zitto - quiet config, loud clarity. A zero-dependency TypeScript/JavaScript helper for merging defaults and options across Node, Deno, Bun, and browsers. 🍯
@igorskyflyer/magic-queryselector
🪄 A TypeScript-types patch for querySelector/querySelectorAll, make them return types you expect them to! 🔮
Author
Created by Igor Dimitrijević (@igorskyflyer).
