Skip to content

Commit

Permalink
Stop creating unnecessary arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
lo1tuma committed May 26, 2021
1 parent f9c360c commit 2a95e3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rules/no-mocha-arrows.js
Expand Up @@ -63,9 +63,9 @@ function fixArrowFunction(fixer, sourceCode, fn) {
);
}

const bodyText = sourceCode.text.slice(fn.body.range[0], fn.body.range[1]);
const bodyText = sourceCode.text.slice(...fn.body.range);
return fixer.replaceTextRange(
[ fn.range[0], fn.range[1] ],
fn.range,
`${formatFunctionHead(sourceCode, fn)}{ return ${bodyText}; }`
);
}
Expand Down

0 comments on commit 2a95e3e

Please sign in to comment.