Update coding standard to v3.0.0

This commit is contained in:
Alejandro Celaya
2024-06-20 14:56:32 +02:00
parent e4fcfdbdcd
commit f530fb4ceb
8 changed files with 834 additions and 99 deletions

View File

@@ -9,7 +9,7 @@
import { clientsClaim } from 'workbox-core';
import { ExpirationPlugin } from 'workbox-expiration';
import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching';
import { createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching';
import { registerRoute } from 'workbox-routing';
import { StaleWhileRevalidate } from 'workbox-strategies';
import pack from '../package.json';
@@ -50,7 +50,7 @@ registerRoute(
// Return true to signal that we want to use the handler.
return true;
},
createHandlerBoundToURL(`${pack.homepage}/index.html`)
createHandlerBoundToURL(`${pack.homepage}/index.html`),
);
// An example runtime caching route for requests that aren't handled by the
@@ -66,7 +66,7 @@ registerRoute(
// least-recently used images are removed.
new ExpirationPlugin({ maxEntries: 50 }),
],
})
}),
);
// This allows the web app to trigger skipWaiting via

View File

@@ -9,14 +9,14 @@
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://cra.link/PWA
import pack from'../package.json';
import pack from '../package.json';
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/),
);
type Config = {
@@ -47,7 +47,7 @@ export function register(config?: Config) {
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://cra.link/PWA'
'worker. To learn more, visit https://cra.link/PWA',
);
});
} else {
@@ -75,7 +75,7 @@ function registerValidSW(swUrl: string, config?: Config) {
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://cra.link/PWA.'
'tabs for this page are closed. See https://cra.link/PWA.',
);
// Execute callback