Skip to content

Commit

Permalink
don't remove failure that starts at end of disabled range (palantir#3177
Browse files Browse the repository at this point in the history
)

Fixes: palantir#3174
  • Loading branch information
ajafff authored Aug 29, 2017
1 parent ca42fe9 commit 2ee8023
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/enableDisableRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function removeDisabledFailures(sourceFile: ts.SourceFile, failures: Rule
return disabledIntervals === undefined || !disabledIntervals.some(({ pos, end }) => {
const failPos = failure.getStartPosition().getPosition();
const failEnd = failure.getEndPosition().getPosition();
return failEnd >= pos && (end === -1 || failPos <= end);
return failEnd >= pos && (end === -1 || failPos < end);
});
});
}
Expand Down
18 changes: 18 additions & 0 deletions test/rules/_integration/enable-disable/test.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,21 @@ var AAAaA = 'test'; //tslint:enable-line quotemark all
~~~~~ [variable name must be in lowerCamelCase or UPPER_CASE]
~~~~~~ [' should be "]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [comment must start with a space]

// ensure line switches only switch the next line
//tslint:enable-next-line:quotemark
'foo';
~~~~~ [' should be "]
'bar';
'baz'; // tslint:enable-line:quotemark
~~~~~ [' should be "]
'bas';

//tslint:enable:quotemark
//tslint:disable-next-line:quotemark
'foo';
'bar';
~~~~~ [' should be "]
'baz'; // tslint:disable-line:quotemark
'bas';
~~~~~ [' should be "]

0 comments on commit 2ee8023

Please sign in to comment.