Registry / devops / prettier-plugin-tsconfig

prettier-plugin-tsconfig

JSON →
library0.0.1jsnpmunverified

A Prettier plugin that formats tsconfig.json files by sorting keys according to the official TypeScript tsconfig reference order. Version 0.0.1 is an early release with basic functionality, no comment support, and is marked as work-in-progress. It requires Prettier ^2.0.0 as a peer dependency and Node >=12. Differs from general JSON formatters by applying a specific key ordering for TypeScript configuration files, making tsconfig.json more predictable and easier to navigate.

npm install prettier-plugin-tsconfig
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-TS
P
prettier-plugin-tsconfig
devopsjavascriptv0.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
module.exports = { plugins: ['prettier-plugin-tsconfig'] }
import 'prettier-plugin-tsconfig'
Plugins are typically configured in .prettierrc or prettier.config.js, not imported directly in code. The plugin auto-registers when installed, but requiring it in the config ensures it's used.
Plugin
const plugin = require('prettier-plugin-tsconfig')
import { Plugin } from 'prettier-plugin-tsconfig'
Named export is not available; the plugin is a single default export object. Use require or import default.
prettierConfig
// .prettierrc { "plugins": ["prettier-plugin-tsconfig"] }
// .prettierrc { "plugin": "prettier-plugin-tsconfig" }
Property must be 'plugins' (array), not 'plugin' (string).

Installation and basic usage: install prettier and plugin, add plugin to config, run prettier to format tsconfig.json files.

// Install dependencies npm install --save-dev prettier prettier-plugin-tsconfig // Configure .prettierrc { "plugins": ["prettier-plugin-tsconfig"] } // Format files npx prettier --write "**/tsconfig.json"
Debug
Known issues
gotchaThis plugin does NOT support comments in tsconfig.json. Comments will be removed during formatting.
fix
Remove comments from tsconfig.json before formatting, or use a different tool.
affects: 0.0.1
gotchaPlugin is a work-in-progress. Always check the formatted tsconfig.json before committing.
fix
Review diff before committing; manually verify key ordering is as expected.
affects: 0.0.1
gotchaOnly formats files named 'tsconfig.json'. Other JSON files with TypeScript config extensions (e.g., tsconfig.app.json) are not formatted unless glob is explicitly changed.
fix
Ensure file is named exactly 'tsconfig.json', or use a custom prettier override pattern.
affects: 0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'prettier-plugin-tsconfig'
Plugin not installed or not in node_modules
fix
Run 'npm install --save-dev prettier-plugin-tsconfig' to install the plugin.
Error: [prettier-plugin-tsconfig] Comments are not supported
tsconfig.json contains // or /* */ comments
fix
Remove comments from tsconfig.json before running prettier.
Unexpected token } in JSON at position X
Invalid JSON due to trailing comma or syntax error
fix
Ensure tsconfig.json is valid JSON; remove trailing commas and malformed syntax.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
prettierrequiredPeer dependency required to run as a Prettier plugin
Agent activity
6 hits · last 30 days
node
6
Resources
prettier-plugin-tsconfig — npm install prettier-plugin-tsconfig · libregistry