Skip to content

Commit 69fd1bf

Browse files
committed
chore: require that formatters exit nonzero on error
I opted to put this in what felt like a logical order, but it does mean that other rules ("Idempotent" and "Reliable") got renumbered. How do we feel about that? IMO, we should probably have version number for the spec.
1 parent b33ed00 commit 69fd1bf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

docs/site/reference/formatter-spec.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,19 @@ original location.
5252

5353
If there are no changes to the original file, the formatter **MUST NOT** write to the original location.
5454

55-
### 3. Idempotent
55+
### 3. Exit nonzero on error
56+
57+
When something goes wrong when formatting (for example, the source code is
58+
syntactically invalid), the formatter **MUST** exit nonzero.
59+
60+
The formatter _SHOULD_ print useful information about what went wrong to
61+
stderr.
62+
63+
### 4. Idempotent
5664

5765
The code formatter _SHOULD_ be indempotent. Meaning that it produces stable
5866
outputs.
5967

60-
### 4. Reliable
68+
### 5. Reliable
6169

6270
We expect the formatter to be reliable and not break the semantics of the formatted files.

0 commit comments

Comments
 (0)