Quantcast
Viewing all articles
Browse latest Browse all 1813

I'm looking into using ast-grep fo linting ReScript. What rules should I investigate?

Still looking for ideas?

In our codebase we sometimes make use of Obj.magic(x), typically when dealing with JSON or js interop in an area we don’t care that much to do strict decoding

Sometimes though the type resolves to something unexpected and then the error is hard to trace.

A useful lint rule would be to require obj.magic to always specify the type you are expecting to cast it to

let x = Obj.magic(1) // lint error!

let x: int = Obj.magic(1) // Ok!
let x = (Obj.magic(1) : int) // Ok!

Viewing all articles
Browse latest Browse all 1813

Trending Articles