Prettier semi: Semicolons On or Off
semi decides whether Prettier prints semicolons at the ends of statements; the default is true.
Semicolons are a style debate Prettier settles with one boolean. Set it once and the whole codebase agrees, which is the point.
What it does
semi (default true) adds a semicolon at the end of every statement. With semi false, Prettier omits them and instead prepends a semicolon to the few lines that would otherwise be misinterpreted (lines starting with a parenthesis, bracket, or backtick), so the no-semi style stays safe.
Common usage
// .prettierrc.json
{ "semi": false }
// input
const a = 1;
const b = 2;
// output with semi:false
const a = 1
const b = 2Options
| Setting | What it does |
|---|---|
| semi: true (default) | Print semicolons at statement ends |
| semi: false | Omit them, adding leading guards where needed |
| --no-semi | Set semi to false on the CLI |
In CI
If you also use ESLint, make sure its semi rule agrees with Prettier or the two tools fight. The recommended setup is eslint-config-prettier, which disables the stylistic ESLint rules that overlap with Prettier so only Prettier decides semicolons.
Common errors in CI
A flood of "Code style issues found" right after setting semi:false means the codebase has not been reformatted yet; run prettier --write . once and commit. If ESLint reports semi errors that Prettier just removed, your ESLint config still has the stylistic rule on; add eslint-config-prettier last in extends.