Introspection of the TypeScript AST involves flipping between AST
Explorer and your editor trying to get TypeScript to
auto-complete the corresponding type guard, but then realizing that
TrueKeyword doesn’t have a type guard and that you need to check the
attribute against the
Although AST Explorer is much nicer than
Python AST has greater simplicity in refinement where the Python AST is just
isinstance() functions as the universal type guard.
Overall, TSLint’s docs for creating a custom rule are quite thorough and provide you with everything you need to create a lint.
A couple minor things I ran into:
- make sure your rule files end in
Rule, otherwise you will run into lint not found issues.
Could not find implementations for the following rules specified in the configuration: jsx-no-true-attribute Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed. If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up. No valid rules have been specified for TypeScript files
- create a
tslint-$PKG_NAME.jsonfile so that installing the lint is easier. This allows for
tslint.jsoninstead of having to configure the rules directories