style-sync
v1.0.0
Published
Detect and fix style inconsistencies (semicolons, trailing commas) across your codebase
Downloads
126
Maintainers
Readme
style-sync
Detect and fix style inconsistencies across your JavaScript/TypeScript codebase — automatically.
Ever noticed some files use semicolons and some don't? Some have trailing commas and some don't? style-sync scans your entire project, figures out your dominant style, and fixes every file to match — in one command.
Usage
No install needed. Just run inside any JS/TS project:
npx style-syncWhat happens
- Scans all
.js,.ts,.jsx,.tsxfiles (ignoresnode_modules,dist,build) - Reports your current style breakdown
- Asks you to choose if a style is ambiguous (close to 50/50)
- Fixes every file using Prettier under the hood
Example output
style-sync — fixing your codebase style inconsistencies
Scanning /your/project...
Files scanned: 24
Semicolons: 58 with · 12 without · dominant: always
Trailing commas: 10 with · 22 without · dominant: ambiguous
⚠ Trailing commas are ambiguous. Which style do you want?
❯ Always use trailing commas
Never use trailing commas
Apply these fixes to 24 files? › Yes
Fixing...
✔ Fixed: 18 files
Skipped: 6 files (already correct)
Done! Your codebase is now consistent.What it fixes (v1)
| Rule | Description |
|------|-------------|
| semi | Enforce or remove semicolons consistently |
| trailingComma | Enforce or remove trailing commas in objects, arrays, and function params |
More rules coming in v2 (quotes, bracket spacing, arrow function parens).
How it works
- Uses @babel/parser to parse your code into an AST — so it never mistakes a semicolon inside a string for a real one
- Uses Prettier's Node.js API to do the actual formatting — battle-tested, no reinventing the wheel
- Respects any existing
.prettierrcconfig you have, overriding only the rules it manages
Requirements
- Node.js 16+
- Works with JavaScript and TypeScript projects
License
MIT
