Parser mode
JavaScript and JSON share punctuation but follow different grammars
JSON requires double-quoted keys and strings and does not allow comments, functions, undefined, or trailing commas. JavaScript modules, scripts, and newer syntax also differ by runtime. Select the actual input type and target environment before treating a successful parse as meaningful.
Semantics
Formatting choices can interact with automatic semicolon insertion and directive-sensitive code
A capable formatter protects token boundaries, but minified or transformed code still needs tests. Comments may carry licenses, source-map hints, bundler instructions, or coverage directives. Quote changes can affect escaping, and trailing-comma policy can affect older targets. Review the diff rather than trusting appearance.
Production build
Online formatting is useful for snippets; projects need repeatable tooling and source maps
Use the repository's configured Prettier, ESLint, compiler, bundler, and minifier for shipped code. Those tools know parser versions, module targets, transpilation, tree shaking, and source maps. Never execute untrusted JavaScript merely to see whether it works.