Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Avoid usage of unguarded getRangeAt and add eslint rule #16212
This PR addresses #15606. I ran a grep through all
Types of changes
The PR introduces a Bug fix (non-breaking change which fixes an issue), and also adds a rule
aduth left a comment
Thanks for this proposal!
Each custom ESLint rule should have its own documentation:
It should also be included in the "Rules" tab of the
It's a fairly targeted rule, which makes me wonder if it's the sort of thing where we could generalize the guarding. That said, it's a pretty specific issue with this one function affecting some browsers and not others. I guess we'd really only care to revise it if there were other range functions which are similarly problematic when unguarded.
Some last-minute thoughts / feedback:
I was also wondering about the developer experience for someone who encounters this warning. Will it be obvious what they need to do to resolve the issue, when the message is simply "Avoid unguarded getRangeAt" ? I wonder if we could expand the message and/or implement a fixer (depending on difficulty).
It still looks good in its current form, and we could merge it as-is if you're okay with the proposed changes.