Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Created August 27, 2018 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phenomnomnominal/0057ea707b12e5d0a857c6522c3957f6 to your computer and use it in GitHub Desktop.
Save phenomnomnominal/0057ea707b12e5d0a857c6522c3957f6 to your computer and use it in GitHub Desktop.
Example of the Rule API from TSLint, using a Walker
// Dependencies:
import { RuleFailure, Rules } from 'tslint';
import { SourceFile } from 'typescript';
export class Rule extends Rules.AbstractRule {
public apply (sourceFile: SourceFile): Array<RuleFailure> {
return this.applyWithWalker(new MyCustomRuleWalker(sourceFile));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment