Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#### :nail_care: Polish

- Better error message for extension point https://github.com/rescript-lang/rescript-compiler/pull/6057
- Improve format check help https://github.com/rescript-lang/rescript-compiler/pull/6056

# 10.1.3

Expand Down
12 changes: 11 additions & 1 deletion scripts/rescript_format.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ the formatted code to stdout in ReScript syntax`,
[
"-check",
{ kind: "Unit", data: { kind: "Unit_set", data: check } },
"Check formatting only",
"Check formatting for file or the whole project. Use `-all` to check the whole project",
],
];
var formattedStdExtensions = [".res", ".resi", ".ml", ".mli"];
Expand Down Expand Up @@ -130,6 +130,16 @@ async function main(argv, rescript_exe, bsc_exe) {

var format_project = format.val;
var use_stdin = stdin.val;

// Only -check arg
// Require: -all or path to a file
if (check.val && !format_project && files.length == 0) {
console.error(
"format check require path to a file or use `-all` to check the whole project"
);
process.exit(2);
}

if (format_project) {
if (use_stdin || files.length !== 0) {
console.error("format -all can not be in use with other flags");
Expand Down