Component Polish
Automatically clean up and improve your existing components.
Component Polish analyzes your existing code and applies improvements while preserving functionality. It's like having a senior developer review and clean up your code instantly.
What Gets Polished
- JSX Structure — Reorganizes nested elements for better readability and removes unnecessary wrapper divs.
- Tailwind Classes — Removes duplicate classes, orders them consistently, and suggests more efficient alternatives.
- Hook Organization — Moves hooks to the top of components, groups related state, and identifies missing dependencies.
- Type Definitions — Adds missing TypeScript types and improves existing type definitions for better type safety.
- Visual Hierarchy — Improves spacing, sizing, and contrast for better visual consistency.
How to Use
- Select the component code you want to polish
- Press Cmd+Shift+P and type "Polish"
- Review the suggested changes in the diff view
- Accept all changes or cherry-pick specific improvements
💡
Non-destructive
Component Polish never changes your code without showing you the diff first. You're always in control of what gets applied.
Example Before/After
Before:
<div className="flex flex-col flex-col gap-4 p-4 p-4">
<div>
<h2 className="text-xl text-xl font-bold">{title}</h2>
</div>
<div>
<p>{description}</p>
</div>
</div>After:
<div className="flex flex-col gap-4 p-4">
<h2 className="text-xl font-bold">{title}</h2>
<p>{description}</p>
</div>✨
Batch Processing
Polish multiple files at once by selecting a folder in the sidebar and running "Polish All Components" from the command palette.