hhvm / hhast

Mutable AST library for Hack with linting and code migrations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document how to ignore Lint

xixixao opened this issue · comments

Ideally on this page:
https://github.com/hhvm/hhast/blob/master/docs/linters-usage.md

This should also go on https://docs.hhvm.com/hack/ (ideally) somewhere.

Meanwhile this is how you do it (I dug it up from the implementation):

// HHAST_IGNORE_ERROR[DontAwaitInALoop]

Not the prettiest, // @lint-ignore DontAwaitInALoop would be nice (but that's a lower pri).

// @lint-ignore

There's two reasons for avoiding that syntax:

  • consistency with HH_FIXME and HH_IGNORE_ERROR; though given that FB's decided that we actually want to clarify the distinction between linters and type errors, this is probably worth revisiting - though this was worse at FB due to re-using HH_ instead of a distinct prefix
  • an implication that HHAST is the linter; in general, I'm aiming for FB to provide a way to solve common problems, without implying it's the way. If third-party libraries/tools replace FB libraries/tools, that's a win for the community. The HSL is the major exception to this rule. This doesn't matter much for @lint-ignore as there's little risk of ambiguity, but I think it does matter for @lint-ignore-every (HHAST_IGNORE_ALL)