Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 455689

Summary: [eslint] no-cond-assign rule incorrectly marks assignment in impl in test
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 8.0   
Target Milestone: 8.0   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Michael Rennie CLA 2014-12-18 16:24:16 EST
Consider the following snippet (a trimmed down version from a snippet found in editor.js)

function getHighlightLines(selections) {
	if (selections.some(function(selection) {
		lines[model.getLineAtOffset(selection.start).toString()] = true;
	})) {}
}

Once linted the assignment statement will be marked as a problem. While technically true (it is within the test node of the if statement test object) it is completely bogus.

We want to make sure that we check follow-on statements to catch assignments like:

if(a = b && (c = d)) {}

but we need to avoid entering scope-like statements like FunctionExpression, ObjectExpression, CallExpression and ArrayExpression