JavaScript Formatter
Run Prettier over a JavaScript snippet. This page opens with the Babel parser selected, which handles modern syntax including JSX.
Prettier parses to a syntax tree and reprints it, so the original layout is discarded entirely and the output depends only on the code structure and your print width.
What it will and will not preserve
Blank lines between statements survive, collapsed to at most one, because they carry authorial intent about grouping. Everything else about your layout does not.
The one deliberate escape hatch: an object literal whose first property sits on its own line stays expanded. That is the documented way to stop a config object being crushed onto a single line.
Formatting is not linting
Prettier will not tell you about an unused variable, a missing await or a condition that is always true. That is a linter, and the two are complementary. Where ESLint rules encode layout opinions they will fight Prettier, which is what eslint-config-prettier exists to switch off.
Print width is a ceiling, not a target
The default 80 characters is a limit Prettier tries to stay under rather than a length it aims for. Raising it produces fewer, longer lines and often worse diffs, because a change anywhere in a long line rewrites the whole line in the patch.
Whatever value you choose, commit it to a config file and format the repository once in an isolated commit. A print width that varies between contributors turns every pull request into a formatting diff, and adding that commit hash to a .git-blame-ignore-revs file keeps blame pointing at the real authors.