-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
Rule proposal: disallow window.document
/window.location
/window.localStorage
in favour of document
/location
/localStorage
#1959
Comments
Personally, I prefer only use ES globals, I even do |
@fisker The generic rule for allowing/disallowing |
It feels like this was already suggested maybe on eslint's repo, I can't find the issue here. I do like the rule, I think There are a couple of things to exclude though:
|
even it was already suggested they will reject this rule since it's stylistic rule |
Adding But I do see value in enforcing no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, self, scrollBy, scrollTo, scrollX, scrollY, status, statusbar, stop, toolbar, top] |
Closing in favor of broader rules: |
Description
since
document
/location
/localStorage
are global variables callingwindow.*
is redundantFail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: