Skip to content

Commit

Permalink
Chore: trivial fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Feb 19, 2017
1 parent 815965a commit 91963e5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/rule-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ function mergeFixes(fixes, sourceCode) {
let text = "";
let lastPos = start;

for (let i = 0; i < fixes.length; ++i) {
const fix = fixes[i];

for (const fix of fixes) {
assert(fix.range[0] >= lastPos, "Fix objects must not be overlapped in a report.");

text += originalText.slice(lastPos, fix.range[0]);
Expand All @@ -119,13 +117,12 @@ function getFix(descriptor, sourceCode) {
}

// @type {null | Fix | Fix[] | IterableIterator<Fix>}
let fix = descriptor.fix(new RuleFixer(sourceCode));
const fix = descriptor.fix(new RuleFixer(sourceCode));

// Merge to one.
if (fix && Symbol.iterator in fix) {
fix = mergeFixes(Array.from(fix), sourceCode);
return mergeFixes(Array.from(fix), sourceCode);
}

return fix;
}

Expand Down

0 comments on commit 91963e5

Please sign in to comment.