Last active
May 11, 2019 09:41
-
-
Save andrewborisov/a9a9937232836575f24c7efecd22e683 to your computer and use it in GitHub Desktop.
creating-ts-lint-rule project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Lint from 'tslint'; | |
import * as ts from 'typescript'; | |
// Exported class always should be named "Rule" and extends Lint.Rules.AbstractRule | |
export class Rule extends Lint.Rules.AbstractRule { | |
public static FAILURE_STRING = 'Wrong import order'; | |
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { | |
return this.applyWithWalker(new Walker(sourceFile, 'module-imports-order', this.getOptions())) | |
} | |
} | |
class Walker extends Lint.AbstractWalker<any> { | |
public walk(sourceFile: ts.SourceFile) { | |
// Some code that will implement your rule logic | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment