Bucklescript (and any Reason project compiled using it) has highly configurable warnings and errors in bsconfig.json
. These are mostly inherited from the OCaml compiler, which has a list of options in its manual. Specifically, we’re interested in the -w
and -warn-error
settings which are equivalent to the bsconfig.json
"warnings"
settings "number"
and "error"
, respectively. There are a ton of options, so it can be a bit overwhelming to try to figure out what settings you might want to use here.
How do you configure your warnings and errors in your projects? What are the must-have settings to catch those most insidious bugs? Are there any that are more trouble than they’re worth? Please share your config and briefly explain what the settings do and why you chose them.
For reference, here are the defaults for BuckleScript and OCaml. You should not need to explicitly set these unless you’re changing the default. A +
enables the warning number that follows, while a -
disables the warning or error immediately following it. A range of numbers is specified by placing ..
in between. The a
means “all”.
BuckleScript defaults to the following, which overrides some of the OCaml defaults:
{
"warnings": {
"number": "-30-40+6+7+27+32..39+44+45+101",
"error": "-a"
}
}
Default in OCaml 4.02:
{
"warnings": {
"number": "+a-4-6-7-9-27-29-32..39-41..42-44-45",
"error": "-a"
}
}
Default in OCaml 4.06:
{
"warnings": {
"number": "+a-4-6-7-9-27-29-32..42-44-45-48-50-60",
"error": "-a+31"
}
}