{"id":20445,"library":"prettier-plugin-tsconfig","title":"prettier-plugin-tsconfig","description":"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.","status":"active","version":"0.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/lokshunhung/prettier-plugin-tsconfig","tags":["javascript"],"install":[{"cmd":"npm install prettier-plugin-tsconfig","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-tsconfig","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-tsconfig","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to run as a Prettier plugin","package":"prettier","optional":false}],"imports":[{"note":"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.","wrong":"import 'prettier-plugin-tsconfig'","symbol":"default","correct":"module.exports = { plugins: ['prettier-plugin-tsconfig'] }"},{"note":"Named export is not available; the plugin is a single default export object. Use require or import default.","wrong":"import { Plugin } from 'prettier-plugin-tsconfig'","symbol":"Plugin","correct":"const plugin = require('prettier-plugin-tsconfig')"},{"note":"Property must be 'plugins' (array), not 'plugin' (string).","wrong":"// .prettierrc\n{ \"plugin\": \"prettier-plugin-tsconfig\" }","symbol":"prettierConfig","correct":"// .prettierrc\n{ \"plugins\": [\"prettier-plugin-tsconfig\"] }"}],"quickstart":{"code":"// Install dependencies\nnpm install --save-dev prettier prettier-plugin-tsconfig\n\n// Configure .prettierrc\n{\n  \"plugins\": [\"prettier-plugin-tsconfig\"]\n}\n\n// Format files\nnpx prettier --write \"**/tsconfig.json\"","lang":"javascript","description":"Installation and basic usage: install prettier and plugin, add plugin to config, run prettier to format tsconfig.json files."},"warnings":[{"fix":"Remove comments from tsconfig.json before formatting, or use a different tool.","message":"This plugin does NOT support comments in tsconfig.json. Comments will be removed during formatting.","severity":"gotcha","affected_versions":"0.0.1"},{"fix":"Review diff before committing; manually verify key ordering is as expected.","message":"Plugin is a work-in-progress. Always check the formatted tsconfig.json before committing.","severity":"gotcha","affected_versions":"0.0.1"},{"fix":"Ensure file is named exactly 'tsconfig.json', or use a custom prettier override pattern.","message":"Only 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.","severity":"gotcha","affected_versions":"0.0.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev prettier-plugin-tsconfig' to install the plugin.","cause":"Plugin not installed or not in node_modules","error":"Error: Cannot find module 'prettier-plugin-tsconfig'"},{"fix":"Remove comments from tsconfig.json before running prettier.","cause":"tsconfig.json contains // or /* */ comments","error":"Error: [prettier-plugin-tsconfig] Comments are not supported"},{"fix":"Ensure tsconfig.json is valid JSON; remove trailing commas and malformed syntax.","cause":"Invalid JSON due to trailing comma or syntax error","error":"Unexpected token } in JSON at position X"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}