Skip to content

Commit cb8d3fa

Browse files
authored
Merge pull request #610 from jfly/more-complete-formatter-spec
chore: require that formatters exit nonzero on error
2 parents 719031f + 69fd1bf commit cb8d3fa

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 formatter _SHOULD_ be idempotent. 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)