Skip to content

Commit 011548b

Browse files
authored
Document passings args to formatters (#4688)
* Document passings args to formatters
1 parent c14a40f commit 011548b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

docs/developer-guide/formatters.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ And the second argument (`returnValue`) is an object with one or more of the fol
7979
}
8080
```
8181

82+
## Passing arguments
83+
84+
You can use environmental variables in your formatter. For example, pass `SKIP_WARNINGS`:
85+
86+
```console
87+
SKIP_WARNINGS=true stylelint "*.css" --custom-formatter ./my-formatter.js
88+
```
89+
90+
Alternatively, you can create a separate formatting program and pipe the output from the built-in JSON formatter into it:
91+
92+
```console
93+
stylelint -f json "*.css" | my-program-that-reads-JSON --option
94+
```
95+
8296
## `stylelint.formatters`
8397

8498
stylelint's internal formatters are exposed publicly in `stylelint.formatters`.

0 commit comments

Comments
 (0)