Unexpected use of 'self' no-restricted-globals React : <p>Trying to write a Service Worker for my PWA app, caugth this error. I used Google/Mozilla samples for service workers, but, anyway. </p>

<pre><code>var CACHE_NAME = 'test-cache';
var urlsToCache = [
    '/'
];

self.addEventListener('install', function (event) {
    event.waitUntil(
        caches.open(CACHE_NAME)
            .then(function (cache) {
                console.log('Opened cache');
                return cache.addAll(urlsToCache);
            })
    );
});
</code></pre>
