hhvm / hhast

Mutable AST library for Hack with linting and code migrations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document / improve lint rule blacklisting

xixixao opened this issue · comments

To disable a rule the config needs to use the fully namespaced lint rule class name:

{
  "roots": ["bin/", "src/"],
  "builtinLinters": "all",
  "disabledLinters": ["Facebook\\HHAST\\NoStringInterpolationLinter"]
}

That's not super user friendly, and not super obvious even reading the getConfig implementation.

Yeah, the documentation needs to be improved, but the need for fully-qualified names will be remaining: there are multiple users with custom lint rules, including variants of standard lint rules, and don’t want to make non-default linters included with HHAST “special” compared to non-included linters - this applies here because the blacklist syntax should be consistent with the whitelist syntax, and whitelist absolutely requires fully-qualified names - partially due to the lack of anything like FactsDB/meerkat, partially to avoid ambiguity

There are other issues making non-included linters less desirable, but those are bugs/areas for improvement, e.g #13

Fixed by #520, which documents the hhast-lint.json file properties.

Particularly of note:

"namespaceAliases": {
"@H": "Facebook\\HHAST"
}
}
```
The following options support namespace aliasing:
- extraLinters
- disabledLinters
- disabledAutofixes