top | item 42598681

(no title)

cxcorp | 1 year ago

I've always wanted to look into writing my own Prettier plugins, how'd you feel about getting started working with their little mini DSL (fill, join, hardline, line, etc.)?

discuss

order

gmasclet|1 year ago

The DSL itself is pretty nice. However, one thing I found annoying is that the printing function itself is hard to unit test: there is no easy way to instantiate its parameters (in particular the `ASTPath` class). So I relied on testing it by calling `Prettier.format()`, which is more a end-to-end test of the whole plugin. Maybe I'll figure out another solution at some point.