chore: use globals in eslint config

This commit is contained in:
Ayo Ayco 2024-12-25 21:30:16 +01:00
parent 823bb74a26
commit 18edfdc4d3
4 changed files with 1292 additions and 3669 deletions

View file

@ -1,16 +1,28 @@
import globals from 'globals'
import eslintPluginAstro from 'eslint-plugin-astro' import eslintPluginAstro from 'eslint-plugin-astro'
import jsPlugin from '@eslint/js'
import astroSwGlobals from '@ayco/astro-sw/globals'
export default [ export default [
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...astroSwGlobals,
},
},
},
// add more generic rule sets here, such as: // add more generic rule sets here, such as:
// js.configs.recommended, jsPlugin.configs.recommended,
...eslintPluginAstro.configs['recommended'], ...eslintPluginAstro.configs['recommended'],
...eslintPluginAstro.configs['jsx-a11y-recommended'], ...eslintPluginAstro.configs['jsx-a11y-recommended'],
{ {
ignores: [ ignores: [
'dist/*', 'dist/*',
'.output/*', '.output/*',
'.nitro/*', '.astro/*',
'node-modules*', 'node_modules*',
'site/*', 'site/*',
'templates/*', 'templates/*',
], ],

View file

@ -20,7 +20,8 @@
"@astro-reactive/form": "^0.10.0", "@astro-reactive/form": "^0.10.0",
"@astro-reactive/validator": "^0.5.0", "@astro-reactive/validator": "^0.5.0",
"@astrojs/sitemap": "^3.2.1", "@astrojs/sitemap": "^3.2.1",
"@ayco/astro-sw": "^0.8.8", "@ayco/astro-sw": "^0.8.12",
"@eslint/js": "^9.17.0",
"@typescript-eslint/parser": "^8.18.2", "@typescript-eslint/parser": "^8.18.2",
"astro": "^5.0.5", "astro": "^5.0.5",
"astro-github-stats": "^0.7.1", "astro-github-stats": "^0.7.1",
@ -28,6 +29,7 @@
"eslint": "^9.17.0", "eslint": "^9.17.0",
"eslint-plugin-astro": "^1.3.1", "eslint-plugin-astro": "^1.3.1",
"eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-jsx-a11y": "^6.10.2",
"globals": "^15.14.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"prettier": "^3.4.2", "prettier": "^3.4.2",
"prettier-plugin-astro": "^0.14.1" "prettier-plugin-astro": "^0.14.1"

File diff suppressed because it is too large Load diff

View file

@ -44,6 +44,7 @@ const networkFirst = async ({ request, fallbackUrl }) => {
putInCache(request, responseFromNetwork.clone()) putInCache(request, responseFromNetwork.clone())
console.info('using network response', responseFromNetwork.url) console.info('using network response', responseFromNetwork.url)
return responseFromNetwork return responseFromNetwork
// eslint-disable-next-line no-unused-vars
} catch (error) { } catch (error) {
// Try get the resource from the cache // Try get the resource from the cache
const responseFromCache = await cache.match(request) const responseFromCache = await cache.match(request)
@ -69,6 +70,7 @@ const networkFirst = async ({ request, fallbackUrl }) => {
} }
} }
// eslint-disable-next-line no-unused-vars
self.addEventListener('activate', (event) => { self.addEventListener('activate', (event) => {
console.info('activating service worker...') console.info('activating service worker...')
}) })