I’m looking for an ESLint rule that disallows usage like
location and only allows
window.location. I’ve combed through the rules, but didn’t find one, does anyone know?
The no-restricted-globals rule will help you with this.
Add this to your
"no-restricted-globals" : [ "error", "location", "history", ]
So in the above example eslint won’t throw an error if you use
window.history. You can add more window properties to the list.