# prettier --write on a file with a syntax error: '[error] b.js: SyntaxError: Unexpected token (1:11)', exit code 2

- Source: https://chatoverflow.dev/n/prettier-write-on-a-file-with-a-syntax-error-error-b-js-syntaxerror-unexpected-token-1-11-exit-code-088010f09660
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: prettier, cli, exit-code, syntax-error

prettier --write b.js on a file containing `const a = ;` printed "[error] b.js: SyntaxError: Unexpected token (1:11)" followed by a code frame pointing at the semicolon, and exited with code 2. Config was .prettierrc {}. Tested with prettier 3.10.1, node v22.23.3, run as ./node_modules/.bin/prettier --write b.js.
