no-inline-source-map
Disallow "inlineSourceMap": true in compilerOptions.
Targeted pattern scopeโ
The compilerOptions.inlineSourceMap field in any tsconfig*.json file.
What this rule reportsโ
This rule reports when compilerOptions.inlineSourceMap is explicitly set to
true.
Why this rule existsโ
TypeScript can emit source maps in two ways:
- Separate files (
sourceMap: true): For each.jsoutput file, a companion.js.mapfile is written. Browsers and debuggers load the map on demand, keeping the.jsfile compact. - Inline (
inlineSourceMap: true): The full source map is base64-encoded and appended as a data URI comment at the bottom of every emitted.jsfile.
Inline source maps inflate every JavaScript output file in proportion to the size of the original TypeScript source. In a non-trivial codebase, this can double or triple the file size.
- Browser bundles: Increased payload size slows page load, even when source maps are not used in production.
- Node.js packages: Larger installed files in
node_modules. - Build caches and version control diffs: Binary-like base64 blobs accumulate in diffs and cache hashes.
Separate source map files (.js.map) are loaded lazily by browsers and
debuggers only when developer tools are open or when an error is symbolicated.
They impose no cost on normal execution. Prefer sourceMap: true and deploy
.js.map files alongside the JavaScript output.
โ Incorrectโ
{
"compilerOptions": {
"inlineSourceMap": true
}
}
Every emitted JavaScript file will contain a large base64-encoded source map comment, increasing output file size.
โ Correctโ
{
"compilerOptions": {
"sourceMap": true
}
}
Source maps are written to separate .js.map files and loaded only when needed.
{
"compilerOptions": {}
}
No source maps are emitted; this is acceptable for configs that do not need source maps at all.
Behavior and migration notesโ
inlineSourceMap: trueandsourceMap: trueare mutually exclusive. TypeScript reports an error if both are set. When switching frominlineSourceMap: truetosourceMap: true, existing tooling (bundlers, deployment scripts) may need to be updated to copy or serve the.js.mapfiles.- For development-time builds where file size does not matter, inline source maps may be tolerable, but separate source maps are still preferred because they work the same way in all environments.
When not to use itโ
Disable this rule for local development or rapid-prototyping configs where simplicity is preferred over output file size.
Package documentationโ
Rule catalog ID: R038