Skip to content

Commit

Permalink
Chore: refactor calculating range and loc in no-useless-escape (#13964)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Jan 1, 2021
1 parent 535fe47 commit cc48713
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rules/no-useless-escape.js
Expand Up @@ -109,9 +109,9 @@ module.exports = {
* @returns {void}
*/
function report(node, startOffset, character) {
const start = sourceCode.getLocFromIndex(sourceCode.getIndexFromLoc(node.loc.start) + startOffset);
const rangeStart = sourceCode.getIndexFromLoc(node.loc.start) + startOffset;
const rangeStart = node.range[0] + startOffset;
const range = [rangeStart, rangeStart + 1];
const start = sourceCode.getLocFromIndex(rangeStart);

context.report({
node,
Expand Down

0 comments on commit cc48713

Please sign in to comment.