Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update eslint to 9.16.0 #806

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The `vite-plugin-pwa` repo includes a set of examples where you can test the cha
- `pnpm run examples`: select `sveltekit` framework and default options on the cli (you can also test another options)
- `pnpm run examples`: select `solid` framework and default options on the cli (you can also test another options)

> The default options from the `cli` are just to check your changes are not breaking major ui/app frameworks build: `generateSW` strategy, `Prompt for update` behavior and `Enable periodic SW updates` to `no`.
> The default options from the `cli` are just to check your changes are not breaking major ui/app frameworks build: `generateSW` strategy, `Prompt for update` behavior and `Enable periodic SW updates` to `no`.

> If your changes are specific to some behavior, just use the corresponding option on the `cli`.

Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Zero-config PWA Framework-agnostic Plugin for Vite
</a>
</p>


## 🚀 Features

- 📖 [**Documentation & guides**](https://vite-pwa-org.netlify.app/)
Expand All @@ -53,12 +52,12 @@ Zero-config PWA Framework-agnostic Plugin for Vite
> From v0.13, `vite-plugin-pwa` requires **Vite 3.1 or above**.
```bash
npm i vite-plugin-pwa -D
npm i vite-plugin-pwa -D

# yarn
# yarn
yarn add vite-plugin-pwa -D

# pnpm
# pnpm
pnpm add vite-plugin-pwa -D
```

Expand All @@ -77,8 +76,7 @@ export default {
}
```

Read the [📖 documentation](https://vite-pwa-org.netlify.app/guide/) for a complete guide on how to configure and use
this plugin.
Read the [📖 documentation](https://vite-pwa-org.netlify.app/guide/) for a complete guide on how to configure and use this plugin.

Check out the client type declarations [client.d.ts](./client.d.ts) for built-in frameworks support.

Expand All @@ -89,7 +87,6 @@ Check out the type declaration [src/types.ts](./src/types.ts) and the following
- [Web app manifests](https://developer.mozilla.org/en-US/docs/Web/Manifest)
- [Workbox](https://developers.google.com/web/tools/workbox)


## 📄 License

[MIT](./LICENSE) License &copy; 2020-PRESENT [Anthony Fu](https://github.com/antfu)
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import antfu from '@antfu/eslint-config'
export default await antfu(
{
ignores: [
'netlify.toml',
'**/build/**',
'**/dist/**',
'**/docs/**',
'**/dev-dist/**',
],
},
Expand Down
2 changes: 1 addition & 1 deletion examples/assets-generator/src/pwa.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pwaInfo } from 'virtual:pwa-info'
import { pwaAssetsHead } from 'virtual:pwa-assets/head'
import { pwaAssetsIcons } from 'virtual:pwa-assets/icons'
import { pwaInfo } from 'virtual:pwa-info'
import { registerSW } from 'virtual:pwa-register'

console.log(pwaInfo)
Expand Down
2 changes: 1 addition & 1 deletion examples/assets-generator/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite'
import type { PWAAssetsOptions } from 'vite-plugin-pwa'
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'

const pwaAssets: PWAAssetsOptions = process.env.INLINE_PWA_ASSETS
Expand Down
4 changes: 2 additions & 2 deletions examples/preact-router/src/ReloadPrompt.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './ReloadPrompt.css'
import { pwaInfo } from 'virtual:pwa-info'

import { useRegisterSW } from 'virtual:pwa-register/preact'
import { pwaInfo } from 'virtual:pwa-info'
import './ReloadPrompt.css'

console.log(pwaInfo)

Expand Down
4 changes: 2 additions & 2 deletions examples/preact-router/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Router } from 'preact-router'

import ReloadPrompt from './ReloadPrompt'
import Home from './pages/Home'
import About from './pages/About'
import Hi from './pages/hi/[name]'
import Home from './pages/Home'
import ReloadPrompt from './ReloadPrompt'

import './App.css'

Expand Down
2 changes: 1 addition & 1 deletion examples/preact-router/src/claims-sw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { clientsClaim } from 'workbox-core'
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { NavigationRoute, registerRoute } from 'workbox-routing'

declare let self: ServiceWorkerGlobalScope
Expand Down
2 changes: 1 addition & 1 deletion examples/preact-router/src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'preact/hooks'
import { route } from 'preact-router'
import { useState } from 'preact/hooks'
import './Home.css'

function Home() {
Expand Down
6 changes: 3 additions & 3 deletions examples/preact-router/test/build.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync, readFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import process from 'node:process'
import { fileURLToPath } from 'node:url'

import { describe, expect, it } from 'vitest'

Expand Down Expand Up @@ -32,13 +32,13 @@ describe('preact: test-build', () => {
const workboxName = resolvePath(_dirname, `../dist/${match?.[1]}.js`)
expect(existsSync(workboxName), `${workboxName} doesn't exist`).toBeTruthy()
const workboxContent = readFileSync(workboxName, 'utf-8')
match = workboxContent.match(/self\['workbox:core:[0-9.]+']/)
match = workboxContent.match(/self\['workbox:core:[0-9.]+'\]/)
expect(match && match.length === 1, 'missing workbox:core module').toBeTruthy()
match = swContent.match(/self\.skipWaiting\(\);?\s*workbox\.clientsClaim\(\)/)
expect(match && match.length === 1, 'missing self.skipWaiting and clientsClaim workbox calls').toBeTruthy()
}
else {
match = swContent.match(/self\['workbox:core:[0-9.]+']/)
match = swContent.match(/self\['workbox:core:[0-9.]+'\]/)
expect(match && match.length === 1, 'missing workbox:core module').toBeTruthy()
match = swContent.match(/self\.skipWaiting\(\);?\s*clientsClaim\(\)/)
expect(match && match.length === 1, 'missing self.skipWaiting and clientsClaim workbox calls').toBeTruthy()
Expand Down
6 changes: 3 additions & 3 deletions examples/preact-router/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ManifestOptions, VitePWAOptions } from 'vite-plugin-pwa'
import process from 'node:process'
import { defineConfig } from 'vite'
import preact from '@preact/preset-vite'
import { VitePWA } from 'vite-plugin-pwa'
import type { ManifestOptions, VitePWAOptions } from 'vite-plugin-pwa'
import replace from '@rollup/plugin-replace'
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'

const pwaOptions: Partial<VitePWAOptions> = {
mode: 'development',
Expand Down
4 changes: 2 additions & 2 deletions examples/react-router/src/ReloadPrompt.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import './ReloadPrompt.css'
import { pwaInfo } from 'virtual:pwa-info'

import { useRegisterSW } from 'virtual:pwa-register/react'
import { pwaInfo } from 'virtual:pwa-info'
import './ReloadPrompt.css'

console.log(pwaInfo)

Expand Down
2 changes: 1 addition & 1 deletion examples/react-router/src/claims-sw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { clientsClaim } from 'workbox-core'
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { NavigationRoute, registerRoute } from 'workbox-routing'

declare let self: ServiceWorkerGlobalScope
Expand Down
6 changes: 3 additions & 3 deletions examples/react-router/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react'
import { BrowserRouter, Route, Routes } from 'react-router-dom'
import { createRoot } from 'react-dom/client'
import './index.css'
import { BrowserRouter, Route, Routes } from 'react-router-dom'
import App from './App'
import Home from './pages/Home'
import About from './pages/About'
import Hi from './pages/hi/[name]'
import Home from './pages/Home'
import './index.css'

createRoot(document.getElementById('app')!).render(
<BrowserRouter>
Expand Down
6 changes: 3 additions & 3 deletions examples/react-router/test/build.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync, readFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import process from 'node:process'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'

const _dirname = typeof __dirname !== 'undefined'
Expand Down Expand Up @@ -31,13 +31,13 @@ describe('react: test-build', () => {
const workboxName = resolvePath(_dirname, `../dist/${match?.[1]}.js`)
expect(existsSync(workboxName), `${workboxName} doesn't exist`).toBeTruthy()
const workboxContent = readFileSync(workboxName, 'utf-8')
match = workboxContent.match(/self\['workbox:core:[0-9.]+']/)
match = workboxContent.match(/self\['workbox:core:[0-9.]+'\]/)
expect(match && match.length === 1, 'missing workbox:core module').toBeTruthy()
match = swContent.match(/self\.skipWaiting\(\);?\s*workbox\.clientsClaim\(\)/)
expect(match && match.length === 1, 'missing self.skipWaiting and clientsClaim workbox calls').toBeTruthy()
}
else {
match = swContent.match(/self\['workbox:core:[0-9.]+']/)
match = swContent.match(/self\['workbox:core:[0-9.]+'\]/)
expect(match && match.length === 1, 'missing workbox:core module').toBeTruthy()
match = swContent.match(/self\.skipWaiting\(\);?\s*clientsClaim\(\)/)
expect(match && match.length === 1, 'missing self.skipWaiting and clientsClaim workbox calls').toBeTruthy()
Expand Down
6 changes: 3 additions & 3 deletions examples/react-router/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ManifestOptions, VitePWAOptions } from 'vite-plugin-pwa'
import process from 'node:process'
import { defineConfig } from 'vite'
import replace from '@rollup/plugin-replace'
import react from '@vitejs/plugin-react'
import type { ManifestOptions, VitePWAOptions } from 'vite-plugin-pwa'
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
import replace from '@rollup/plugin-replace'

const pwaOptions: Partial<VitePWAOptions> = {
mode: 'development',
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-router/src/ReloadPrompt.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Component } from 'solid-js'
import { Show } from 'solid-js'
import { useRegisterSW } from 'virtual:pwa-register/solid'
import { pwaInfo } from 'virtual:pwa-info'
import { useRegisterSW } from 'virtual:pwa-register/solid'
import styles from './ReloadPrompt.module.css'

console.log(pwaInfo)
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-router/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Component } from 'solid-js'
import { useRoutes } from '@solidjs/router'
import { routes } from './routes'
import styles from './app.module.css'
import ReloadPrompt from './ReloadPrompt'
import { routes } from './routes'

const App: Component = () => {
// replaced dynamically
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-router/src/claims-sw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { clientsClaim } from 'workbox-core'
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { NavigationRoute, registerRoute } from 'workbox-routing'

declare let self: ServiceWorkerGlobalScope
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-router/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from 'solid-js/web'
import { Router } from '@solidjs/router'
import { render } from 'solid-js/web'
import App from './app'

render(
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-router/src/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSignal } from 'solid-js'
import { useNavigate } from '@solidjs/router'
import { createSignal } from 'solid-js'
import styles from './home.module.css'

export default function Home() {
Expand Down
4 changes: 2 additions & 2 deletions examples/solid-router/src/routes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { lazy } from 'solid-js'
import type { RouteDefinition } from '@solidjs/router'
import { lazy } from 'solid-js'

import Home from './pages/home'
import HiData from './pages/hi/[name].data'
import Home from './pages/home'

export const routes: RouteDefinition[] = [
{
Expand Down
6 changes: 3 additions & 3 deletions examples/solid-router/test/build.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync, readFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import process from 'node:process'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'

const _dirname = typeof __dirname !== 'undefined'
Expand Down Expand Up @@ -31,13 +31,13 @@ describe('solid: test-build', () => {
const workboxName = resolvePath(_dirname, `../dist/${match?.[1]}.js`)
expect(existsSync(workboxName), `${workboxName} doesn't exist`).toBeTruthy()
const workboxContent = readFileSync(workboxName, 'utf-8')
match = workboxContent.match(/self\['workbox:core:[0-9.]+']/)
match = workboxContent.match(/self\['workbox:core:[0-9.]+'\]/)
expect(match && match.length === 1, 'missing workbox:core module').toBeTruthy()
match = swContent.match(/self\.skipWaiting\(\);?\s*workbox\.clientsClaim\(\)/)
expect(match && match.length === 1, 'missing self.skipWaiting and clientsClaim workbox calls').toBeTruthy()
}
else {
match = swContent.match(/self\['workbox:core:[0-9.]+']/)
match = swContent.match(/self\['workbox:core:[0-9.]+'\]/)
expect(match && match.length === 1, 'missing workbox:core module').toBeTruthy()
match = swContent.match(/self\.skipWaiting\(\);?\s*clientsClaim\(\)/)
expect(match && match.length === 1, 'missing self.skipWaiting and clientsClaim workbox calls').toBeTruthy()
Expand Down
6 changes: 3 additions & 3 deletions examples/solid-router/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ManifestOptions, VitePWAOptions } from 'vite-plugin-pwa'
import process from 'node:process'
import replace from '@rollup/plugin-replace'
import { defineConfig } from 'vite'
import solidPlugin from 'vite-plugin-solid'
import { VitePWA } from 'vite-plugin-pwa'
import type { ManifestOptions, VitePWAOptions } from 'vite-plugin-pwa'
import replace from '@rollup/plugin-replace'
import solidPlugin from 'vite-plugin-solid'

const pwaOptions: Partial<VitePWAOptions> = {
mode: 'development',
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte-routify/src/claims-sw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { clientsClaim } from 'workbox-core'
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { NavigationRoute, registerRoute } from 'workbox-routing'

declare let self: ServiceWorkerGlobalScope
Expand Down
4 changes: 2 additions & 2 deletions examples/svelte-routify/test/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ describe('svelte: test-build', () => {
const workboxName = resolvePath(_dirname, `../dist/${match?.[1]}.js`)
expect(existsSync(workboxName), `${workboxName} doesn't exist`).toBeTruthy()
const workboxContent = readFileSync(workboxName, 'utf-8')
match = workboxContent.match(/self\['workbox:core:[0-9.]+']/)
match = workboxContent.match(/self\['workbox:core:[0-9.]+'\]/)
expect(match && match.length === 1, 'missing workbox:core module').toBeTruthy()
match = swContent.match(/self\.skipWaiting\(\);?\s*workbox\.clientsClaim\(\)/)
expect(match && match.length === 1, 'missing self.skipWaiting and clientsClaim workbox calls').toBeTruthy()
}
else {
match = swContent.match(/self\['workbox:core:[0-9.]+']/)
match = swContent.match(/self\['workbox:core:[0-9.]+'\]/)
expect(match && match.length === 1, 'missing workbox:core module').toBeTruthy()
match = swContent.match(/self\.skipWaiting\(\);?\s*clientsClaim\(\)/)
expect(match && match.length === 1, 'missing self.skipWaiting and clientsClaim workbox calls').toBeTruthy()
Expand Down
4 changes: 2 additions & 2 deletions examples/svelte-routify/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import process from 'node:process'
import { defineConfig } from 'vite'
import replace from '@rollup/plugin-replace'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
import replace from '@rollup/plugin-replace'

/** @type { Partial<import('vite-plugin-pwa').VitePWAOptions> } */
const pwaOptions = {
Expand Down
4 changes: 2 additions & 2 deletions examples/sveltekit-pwa/pwa.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { copyFileSync } from 'node:fs'
import { resolveConfig } from 'vite'
import replace from '@rollup/plugin-replace'
import { VitePWA } from 'vite-plugin-pwa'
import minimist from 'minimist'
import { resolveConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'

const args = minimist(process.argv.slice(2))

Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit-pwa/src/claims-sw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { clientsClaim } from 'workbox-core'
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { NavigationRoute, registerRoute } from 'workbox-routing'

declare let self: ServiceWorkerGlobalScope
Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit-pwa/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import replace from '@rollup/plugin-replace'
import adapter from '@sveltejs/adapter-static'
import preprocess from 'svelte-preprocess'
import { VitePWA } from 'vite-plugin-pwa'
import replace from '@rollup/plugin-replace'
import { pwaConfiguration, replaceOptions } from './pwa-configuration.js'

/** @type {import('@sveltejs/kit').Config} */
Expand Down
2 changes: 1 addition & 1 deletion examples/vanilla-js-custom-sw/service-worker/sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference lib="webworker" />
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { clientsClaim } from 'workbox-core'
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { NavigationRoute, registerRoute } from 'workbox-routing'

// self.__WB_MANIFEST is default injection point
Expand Down
1 change: 1 addition & 0 deletions examples/vanilla-js-custom-sw/src/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { pwaInfo } from 'virtual:pwa-info'
import { registerSW } from 'virtual:pwa-register'

// eslint-disable-next-line no-undef
const date = __DATE__

console.log(pwaInfo)
Expand Down
2 changes: 1 addition & 1 deletion examples/vanilla-ts-no-ip/client-test/sw.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import process from 'node:process'
import type { Page } from '@playwright/test'
import process from 'node:process'
import { expect, test } from '@playwright/test'

const customSW = process.env.SW === 'true'
Expand Down
Loading
Loading