What is JSX?
JSX is a syntax extension for JavaScript created by the React team. It lets you write XML/HTML-like tags directly in JavaScript — <Button label="OK" /> — which a build step (Babel, esbuild, SWC, TypeScript) compiles to React.createElement(Button, { label: "OK" }) calls. JSX is not HTML: className replaces class, htmlFor replaces for, attributes are camelCase, and braces { } embed JavaScript expressions inside markup.
How does the formatter decide between < as a JSX tag and < as a less-than operator?
The formatter uses a context heuristic: a < is treated as JSX if it follows = , ( , , , { , } , ; , > , a newline, or the start of file, AND the next character is a letter or /. A < that follows an identifier, ) , ] , or > is treated as a comparison or generic. This matches what Babel and TypeScript do at parse time.
What does attribute alignment do?
When alignAttrs is enabled and a tag has more than one attribute, each attribute is placed on its own line, indented one level deeper than the tag, with the closing > or /> on its own line aligned to the tag. This is the standard Prettier wrap style for components with many props.
Does the formatter handle self-closing tags and fragments?
Yes. Self-closing tags (<Image src="..." />) keep the leading space before /> per the Prettier convention. Fragments (<>...</>) are recognised — they are treated as tags with empty names, indented and dedented like any other element. Named fragments (<Fragment>) are formatted identically.
Why are some attributes left inline even with alignment turned on?
Tags with a single attribute are left inline because wrapping a one-prop component on three lines hurts readability. The threshold is two or more attributes. If you always want one-per-line — including for single-attribute tags — Prettier with --jsx-bracket-same-line=false enforces that project-wide.
Does it preserve comments and JSX expression containers?
Yes. // line comments, /* block */, JSDoc /** */, and JSX comments {/* ... */} are kept in their original position. Expression containers — {props.title}, {items.map(i => …)} — are tokenised first so their internal braces never trip up the brace-depth counter.
Is my JSX uploaded to your servers?
No. Formatting runs entirely in JavaScript inside your browser. Components containing API keys, proprietary algorithms, or unreleased features never leave the device. You can verify this in DevTools → Network — no requests are made when you click Format.
How is this different from Prettier?
Prettier is a full AST-based printer with hundreds of options and dozens of edge-case fixes. This formatter is a lightweight tag-aware indenter — it rewrites whitespace and brace placement without touching token order. For a one-off readability pass on a snippet, this is faster. For project-wide enforcement, install Prettier and add a pre-commit hook so every file is normalised before it lands.