| Summary: | [eslint] no-cond-assign rule incorrectly marks assignment in impl in test | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Michael Rennie <Michael_Rennie> |
| Component: | JS Tools | Assignee: | 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: | |||
Fix + test as part of commit: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=07d431cdfa854426be6de7fff632d493272ab0cb |
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