This is an alternative to jbreckel's flow-result-checker for *flow issue 869 that does not alter the text styling of flow's error output and does not have any dependencies, so to speak: It expects the raw output, which can be provided by using the script command. This has been tested on OS X and Linux.
In package.json
(OS X):
"scripts": {
"flow": "script -q /dev/null flow --show-all-errors | flow-error-suppressor"
}
In package.json
(Linux):
"scripts": {
"flow": "script -q /dev/null -c 'flow --show-all-errors' | flow-error-suppressor"
}
The output will include the number of errors that are shown and that have been suppressed:
Found 10 errors
2 suppressed
8 shown
*We should not have to worry about flow errors reported for third party modules (i.e. from node_modules
). However, it is often the case that one cannot simply [ignore]
a problem module without having provided a libdef, which can be very time-consuming if it is not included in flow-typed.
By default, only unsuppressed errors will result in an exit status of 2.
-a
--error-on-any
Exit with 2 if there are any flow errors, regardless of origin.
-n
--no-error
Always exit with 0. This is useful if you don't want npm run flow
to have that "stupid npm error" and if you want to pass arguments to flow
at the same time (i.e. no more || true
or ; exit 0
getting in the way).
All but the first option provided will be ignored.