File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,33 +5,29 @@ import * as Lint from "tslint";
55 * Curly statement newlines rule.
66 */
77export class Rule extends Lint . Rules . AbstractRule {
8-
9- public static FAILURE_STRING = "curly statements must separate with newlines" ;
8+ public static FAILURE_STRING = "Curly statements must separate with newlines" ;
109
1110 /**
1211 * Apply the rule.
1312 */
1413 public apply ( sourceFile : ts . SourceFile ) : Lint . RuleFailure [ ] {
1514 return this . applyWithWalker ( new CurlyStatementNewlinesWalker ( sourceFile , this . getOptions ( ) ) ) ;
1615 }
17-
1816}
1917
2018/**
2119 * Curly statement newlines walker.
2220 */
2321class CurlyStatementNewlinesWalker extends Lint . RuleWalker {
24-
2522 /**
2623 * Visit if statements.
2724 */
2825 public visitIfStatement ( node : ts . IfStatement ) : void {
29- const splitLength = node . getFullText ( ) . split ( "\n" ) . length ;
26+ const splitLength = node . getFullText ( ) . trim ( ) . split ( "\n" ) . length ;
3027 if ( splitLength <= 2 ) {
3128 this . addFailureAt ( node . getStart ( ) , node . getWidth ( ) , Rule . FAILURE_STRING ) ;
3229 }
3330
3431 super . visitIfStatement ( node ) ;
3532 }
36-
3733}
You can’t perform that action at this time.
0 commit comments