Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

False positive in prefer-for-of rule when element assigned #1813

Merged
merged 3 commits into from
Dec 6, 2016

Conversation

nchen63
Copy link
Contributor

@nchen63 nchen63 commented Dec 2, 2016

fixes #1807

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good aside from the small nit

const binaryExpression = node as ts.BinaryExpression;
return binaryExpression.operatorToken.kind >= ts.SyntaxKind.FirstAssignment
&& binaryExpression.operatorToken.kind <= ts.SyntaxKind.LastAssignment;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this function should always produce a return value, i.e. have an else { return false; } at the end.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also help us to eventually enable noImplicitReturns in tsc

@nchen63 nchen63 merged commit 66c18fd into master Dec 6, 2016
@nchen63 nchen63 deleted the prefer-bug branch December 6, 2016 20:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

prefer-for-of false positive when index is used to modify array
2 participants