rescript format: aborts on a syntax error, unstable output, raw compiler errors

オープン
#9,243 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@cknitt がすでに取り組んでいます。

2026年11月6日 から。

  • #9249 @cknitt による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ocaml
領域
cli, tooling

調査の方向性

Start in rewatch-ocaml/format.ml, especially the referenced lines 113, 116, 142–143, 148, 200, and 209; reproduce the listed cases with ReScript 13.0.0-alpha.8. Check formatting behavior for syntax errors, output ordering and paths, duplicate arguments, invalid inputs, and --stdin errors. Done means each case reports all files and useful errors consistently, with deterministic unique paths and <stdin> shown for stdin errors.

索引モデルが issue の本文から書いたものです。

説明

Problems with rescript format. All reproduce with rescript 13.0.0-alpha.8 (found while reviewing #9238); paths are in rewatch-ocaml/.

  • One file with a syntax error aborts the run. In a project with unformatted files and one file containing let x =, rescript format --check lists some files, then Error formatting <path>/B.res: with the syntax error, exit 1, and no summary. Without --check, some of the other files are left unformatted (with 40 unformatted files, 26–33 remained, varying per run). format.ml:142-143 raises inside the job callback, which stops the whole job graph. Format and report every file, then fail.

  • --check output order is nondeterministic, and paths are inconsistent. With 8 unformatted files, six runs of rescript format --check listed them in six different orders: each line is printed when its job finishes (format.ml:148). In project mode the paths are absolute; for explicit file arguments they are relative (format.ml:113, :209). Sort the list and print paths relative to the current directory.

  • Duplicate arguments are counted twice. rescript format --check src/F.res src/F.res lists the file twice and reports The 2 files listed above need formatting (format.ml:209).

  • Invalid arguments surface raw compiler errors.

    • rescript format src/Missing.res: Error formatting src/Missing.res: (trailing space), then We've found a bug for you!, _none_, I/O error: …: No such file or directory.
    • rescript format src and rescript format README.md: Error formatting src: don't know what to do with src.

    Nothing checks existence or extension before calling the compiler; format.ml:116 prefixes the compiler's stderr, which starts with a newline.

  • --stdin errors name a temporary file. echo 'let x =' | rescript format --stdin .res reports the syntax error at /tmp/rescript-format-7546c4.res:1:8-2:0 (format.ml:200); it should say <stdin>.

主要言語
OCaml
スター
7.5k
フォーク
485
平均マージ
16時間 51分
マージ済み PR(30日)
268

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rescript-lang/rescript のほかの issue

rescript-lang/rescript の issue をすべて見る

似ている issue

CLI の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。