LocalExcelTool
はじめる

JS / TS フォーマッター

JavaScript / TypeScript を Prettier で整形。

JS / TS フォーマッターとは

JS/TS フォーマッターは、Prettier(standalone 版)で JavaScript と TypeScript を整形する無料ツールです。パーサー(babel=JS / typescript=TS)を選択でき、セミコロンあり・2 スペースインデント・ダブルクォートの標準スタイルで出力します。Prettier はこのツールの実行時のみ読み込まれ、コードはブラウザ内で処理されます。

🔒 処理はすべてブラウザ内で完結し、データは送信されません。

このツールの前提

処理場所
このページのブラウザ内(JavaScript / Canvas)
アップロード
なし — ファイルは端末の外に出ません
オフライン
ページを開いた後は通信不要

Prettier, loaded on demand

This runs the real Prettier standalone build with the Babel, ESTree and TypeScript plugins, imported dynamically so the page stays light until the tool is used. Input is capped at 200 KB, which covers ordinary source files but not generated bundles.

Supported inputs are JavaScript, TypeScript and JSX. Python, Go, Rust, CSS, SQL and HTML are not handled by these plugins and will either error or produce nonsense — a formatter is language-specific by nature, and Prettier's other parsers are separate packages.

Formatting is opinionated, and that is the point

Prettier rewrites quotes, semicolons, trailing commas, line wrapping and JSX attribute layout according to fixed rules. There is no configuration here, so the output matches Prettier's defaults rather than your project's .prettierrc.

That is fine for reading a snippet and wrong for committing to a repository with its own style. A one-off reformat of a file under a configured project generates a diff of every line, burying the change you actually made.

Where the output can differ semantically

Prettier preserves semantics by design, but it operates on parsed syntax — so a file that only works because of an obscure parsing quirk, or one relying on automatic semicolon insertion in a fragile spot, can change behaviour. TypeScript decorators and JSX pragma comments are the usual places to double-check.

If the code does not parse, nothing is formatted and you get a syntax error with a location. That error is often more useful than the formatting: it points at the exact token the runtime would have rejected.

使い方

  1. 1.コードを貼り付け(200KB まで)
  2. 2.パーサー(JS / TS)を選ぶ
  3. 3.実行して整形結果をコピー

他の方法との比較

同じ変換をする方法は 3 つあります。ブラウザ内(このページ)、サーバー側の変換サービス、デスクトップアプリ。差がつくのは速度ではなく、ファイルがどこへ行くかと、無料でどこまでできるかです。

観点このツールサーバー側の変換サービス
ファイルの処理場所このページのブラウザ内ベンダーのサーバー(アップロード後)
アカウント不要多くの場合必要(無料枠の制限解除に登録を求める)
無料で扱えるサイズサイズ制限なし(回数制限もなし)数ファイル/時間、または 5〜10MB 程度で課金 wall
料金無料。Pro は月 $9(大きいファイルと AI 機能のみ)サブスクが一般的。おおむね月 $7〜15(2026 年 11 月時点)
オフライン一度開けば通信不要不可
20MB を処理し始めるまで待ち時間なし(アップロードが無い)アップロードが支配的(10Mbps 上りで約 16 秒)
保証できないこと不正な入力は「修復」せず、パーサのエラー位置を返します同じ(変換の原理は変わらない)

サーバー側のサービスが優れている点は明確にあります。巨大なファイル、チームでの共有、変換履歴の管理、スクリプトからの自動化。逆に「1 回だけ、手元のファイルを別形式にしたい」という今回の用途では、アップロードの待ち時間と登録の手間だけが増えます。

よくある質問

対応する構文は?

babel パーサーで標準 JavaScript と JSX、TypeScript パーサーで TS 固有構文に対応します。プラグイン系構文(実験的 proposal など)は一部未対応です。

スタイルは変更できる?

このツールは標準スタイル(セミコロンあり / 2 スペース / ダブルクォート)固定のシンプル版です。

この変換で失われるもの

フォーマッタは入力を構文木に解析し、一貫したインデントで出力します。入力が不正なら、黙って壊れたファイルを返すのではなく、パーサのエラー位置を表示します。壊れた JSON は「修復」されず、そのまま壊れたまま示されます。

その他のフォーマット