require-source-map-in-dev
Require "sourceMap": true (or "inlineSourceMap": true) in tsconfig files
that emit JavaScript so stack traces and debugger sessions map back to original
TypeScript source.
Targeted pattern scopeโ
The compilerOptions.sourceMap, compilerOptions.inlineSourceMap,
compilerOptions.noEmit, and compilerOptions.emitDeclarationOnly fields in
tsconfig*.json files.
What this rule reportsโ
This rule reports when a tsconfig that emits JavaScript does not set either
"sourceMap": true or "inlineSourceMap": true.
The rule does not report when:
"noEmit": trueis set, because no JavaScript output is produced."emitDeclarationOnly": trueis set, because only.d.tsoutput is produced.
Why this rule existsโ
Without source maps, runtime errors and debugger breakpoints reference compiled JavaScript locations. Developers must manually translate line numbers back to TypeScript source, which slows down debugging.
Source maps are small and have no runtime cost โ they are only loaded when developer tools are open. If a config emits runnable JavaScript, enabling either source maps or inline source maps usually makes debugging materially easier.
The auto-fixer adds "sourceMap": true to compilerOptions.
โ Incorrectโ
{
"compilerOptions": {
"target": "ES2022",
"outDir": "./dist"
}
}
Stack traces from compiled code will reference dist/ line numbers, not the
original TypeScript source.
โ Correctโ
{
"compilerOptions": {
"target": "ES2022",
"outDir": "./dist",
"sourceMap": true
}
}
Or using inline source maps:
{
"compilerOptions": {
"target": "ES2022",
"outDir": "./dist",
"inlineSourceMap": true
}
}
When not to use itโ
Disable this rule for configs where emitted source maps are intentionally forbidden, or where the project has a separate debugging workflow that does not depend on TypeScript source maps.
Package documentationโ
Rule catalog ID: R023