Skip to content
Snippets Groups Projects

Add linting to CI

Merged Nayeem Rahman requested to merge (removed):ci-lint into master
4 files
+ 457
16
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 4
15
@@ -19,14 +19,14 @@ const normalizeUrl = (url) => {
return url_.href
}
self.addEventListener("install", async (event) => {
self.addEventListener("install", async () => {
const cache = await caches.open(CACHE_NAME)
const additions = cache.addAll(FILES_TO_CACHE)
await additions
console.info(`Files cached: [\n ${FILES_TO_CACHE.join(`,\n `)}\n]`)
})
self.addEventListener("activate", async (event) => {
self.addEventListener("activate", async () => {
const oldCacheKeys = (await caches.keys()).filter((key) => key != CACHE_NAME)
oldCacheKeys.forEach((key) => caches.delete(key))
})
@@ -42,18 +42,7 @@ self.addEventListener("fetch", (event) => {
return response
})
.catch(() => caches.match(normalizedUrl))
.catch((e) => null)
.catch(() => null)
}
event.respondWith(
fetch(event.request)
.then(async (response) => {
if (FILES_TO_CACHE.includes(new URL(normalizedUrl).pathname)) {
const cache = await caches.open(CACHE_NAME)
await cache.put(normalizedUrl, response.clone())
}
return response
})
.catch(() => caches.match(normalizedUrl))
.catch((e) => null),
)
event.respondWith(response)
})
Loading