diff --git a/src/rules/useIsnanRule.ts b/src/rules/useIsnanRule.ts index 8a458560753..71c164a7395 100644 --- a/src/rules/useIsnanRule.ts +++ b/src/rules/useIsnanRule.ts @@ -30,9 +30,8 @@ export class Rule extends Lint.Rules.AbstractRule { } class UseIsnanRuleWalker extends Lint.RuleWalker { - protected visitBinaryExpression(node: ts.BinaryExpression): void { - if (this.isExpressionNaN(node.left) || this.isExpressionNaN(node.right) + if ((this.isExpressionNaN(node.left) || this.isExpressionNaN(node.right)) && node.operatorToken.kind !== ts.SyntaxKind.EqualsToken) { this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING + node.getText())); } diff --git a/test/configurationTests.ts b/test/configurationTests.ts index b17a294408b..c7ea4f2dcdc 100644 --- a/test/configurationTests.ts +++ b/test/configurationTests.ts @@ -87,6 +87,7 @@ describe("Configuration", () => { describe("with config not relative to tslint", () => { let tmpfile: string; + beforeEach(() => { for (let i = 0; i < 5; i++) { const attempt = path.join(os.tmpdir(), `tslint.test${Math.round(Date.now() * Math.random())}.json`); @@ -99,11 +100,13 @@ describe("Configuration", () => { throw new Error("Couldn't create temp file"); } }); + afterEach(() => { if (tmpfile !== undefined) { fs.unlinkSync(tmpfile); } }); + it("extends with package installed relative to tslint", () => { fs.writeFileSync(tmpfile, JSON.stringify({ extends: "tslint-test-config-non-relative" })); let config = loadConfigurationFromPath(tmpfile);