Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: refactor calculating range and loc in no-useless-escape #13964

Merged
merged 1 commit into from Jan 1, 2021

Conversation

@mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Dec 28, 2020

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:

Changes a few lines where no-useless-escape calculates range and loc of the reported backslash.

What changes did you make? (Give an overview)

Replaced sourceCode.getIndexFromLoc(node.loc.start) with node.range[0].

Is there anything you'd like reviewers to focus on?

Am I missing something, it seems unnecessary to get index from the loc when we have range?

nzakas
nzakas approved these changes Jan 1, 2021
Copy link
Member

@nzakas nzakas left a comment

I suspect this was probably leftover from early on before we had formalized how to do such things.

Loading

@mdjermanovic mdjermanovic merged commit cc48713 into master Jan 1, 2021
13 checks passed
Loading
@mdjermanovic mdjermanovic deleted the nouselessescape-refactorrange branch Jan 1, 2021
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jul 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants