Puffin'sJAVASCRIPT FORMATTER
& VALIDATOR

Learn

A script is a list of statements. A statement can be a declaration (const, function, class), a block, or an expression followed by a semicolon. JavaScript will insert some missing semicolons at a line break. This formatter prints the semicolon so the next line cannot be read as part of the previous statement. That is why return and a value on the next line stay separate.

Modules use import and export, and they may await at the top level. This tool tries that reading first. If the module reading is a syntax error and the file is valid as a classic script, the script reading is used, and with or a legacy octal is reported as a warning. Classes and modules are strict either way.

JSX writes markup in the same places an expression can go: <Card title={name} />. A comparison such as a < b is still a comparison. Whitespace that is only a line break between tags is dropped when the element is pretty-printed.