-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Description
Upgrading to eslint-config-airbnb broke my service worker linting and the fix is not clear.
Inside a service worker, self is a global variable referring to the ServiceWorkerGlobalScope and is the standard method for setting event listeners. However, the new no-restricted-globals rule disallows the use of self, even if the top of the file includes /* global self */.
One possible solution to the problem would be to set const self = this explicitly on top of the file, but this poses an issue with es modules, where you cannot have this on the global context, and bundlers like rollup actually rewrite this as undefined.
Maybe removing self as a restricted global would be the way to go, or maybe the restricted globals should depend on the environment itself...