Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brundonsmith committed Dec 12, 2023
1 parent 5d74246 commit b2deb7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
17 changes: 5 additions & 12 deletions front-end/src/sw.ts → front-end/src/sw.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
/* eslint-env serviceworker */

// @ts-check
/// <reference no-default-lib="true"/>
/// <reference lib="webworker" />

// Default type of `self` is `WorkerGlobalScope & typeof globalThis`
// https://github.com/microsoft/TypeScript/issues/14877
const swSelf = self as unknown as ServiceWorkerGlobalScope

// @ts-expect-error BUNDLE_HASH is injected via build.js
// BUNDLE_HASH is injected via build.js
// eslint-disable-next-line no-undef
const VERSION = BUNDLE_HASH // ensures that if anything in app.js changes, we get a new sw.js
const CACHE_NAME = `my_vibecamp_${VERSION}`

Expand All @@ -31,7 +24,7 @@ const APP_STATIC_RESOURCES = [
'/roboto-700.woff2'
]

swSelf.addEventListener('install', e => {
self.addEventListener('install', e => {
e.waitUntil(
(async () => {
const cache = await caches.open(CACHE_NAME)
Expand All @@ -40,7 +33,7 @@ swSelf.addEventListener('install', e => {
)
})

swSelf.addEventListener('fetch', async e => {
self.addEventListener('fetch', async e => {
e.respondWith((async () => {
if (
e.request.destination === 'script' ||
Expand All @@ -56,7 +49,7 @@ swSelf.addEventListener('fetch', async e => {
})())
})

swSelf.addEventListener('activate', e => {
self.addEventListener('activate', e => {
e.waitUntil(
(async () => {
const keys = await caches.keys()
Expand Down
8 changes: 4 additions & 4 deletions front-end/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"noUncheckedIndexedAccess": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"next-sitemap.config.js"
"next-sitemap.config.js",
"build.js",
"src/sw.js"
],
"exclude": [
"node_modules",
"src/sw.ts"
"node_modules"
]
}

0 comments on commit b2deb7d

Please sign in to comment.