ppx_js_style
is an identity ppx rewriter that enforces Jane Street coding
styles.
The following rules are enforced by ppx_js_style
:
[@@deprecated]
attributes must contain the date of deprecation, using the
format "[since MM-YYYY] ..."
N.B. this check, on by default at Jane Street, but off by default externally. It
can also be disabled with the flag -no-dated-deprecation
.
Ignored expressions must come with a type annotation, such as:
ignore (expr : typ)
let (_ : type) = expr
Note that aliases need not be annotated:
let _ = Foo.bar in
Comments in mli must either be documentation comments or explicitly "ignored":
(** documentation comment *)
(*_ ignored comment *)
Normal (* comment *)
comments are disallowed.
This flag additionally enables warning 50, which checks the placement of documentation comments.
Finally, doc comments are checked to be syntactically valid.
Checks that calling ocamlc on the input would produce bytecode that works on 32
bits architectures (including js_of_ocaml
), ie that all constant are
representable on 32 bits architectures. Compared to the compiler flag by the
same name, it allows to perform this check without building any bytecode.
This check is enabled by default, and can be disabled by passing the flag.
Check for misleading usage of underscores in number literals. Currrently it means that underscores must be:
- in positions that are multiple of 3 for numbers in decimal notation.
- in positions that are multiple of 2 for numbers in hexadecimal, octal or binary notation.
Two consecutive underscores in a number disables the check for that number. This
is useful to turn off the check for integers that are really fixed point
decimals, like 1_000__0000
to represent 1000.0
with four implied decimal
places.