diff --git a/eslint.config.mjs b/eslint.config.mjs index 8f842ce..7920b6d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,7 +1,9 @@ import globals from 'globals' import eslintPluginAstro from 'eslint-plugin-astro' import jsPlugin from '@eslint/js' +import tseslint from 'typescript-eslint' import astroSwGlobals from '@ayco/astro-sw/globals' +import astroParser from 'astro-eslint-parser' export default [ { @@ -15,6 +17,7 @@ export default [ }, // add more generic rule sets here, such as: jsPlugin.configs.recommended, + ...tseslint.configs.recommended, ...eslintPluginAstro.configs['recommended'], ...eslintPluginAstro.configs['jsx-a11y-recommended'], { @@ -22,9 +25,19 @@ export default [ 'dist/*', '.output/*', '.astro/*', - 'node_modules*', 'site/*', 'templates/*', + '**/node_modules/*', + '**/env.d.ts', ], }, + { + files: ['**/*.astro'], + languageOptions: { + parser: astroParser, + parserOptions: { + parser: tseslint.parser, + }, + }, + }, ] diff --git a/package.json b/package.json index e2384e7..9c61780 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "globals": "^15.14.0", "husky": "^9.1.7", "prettier": "^3.4.2", - "prettier-plugin-astro": "^0.14.1" + "prettier-plugin-astro": "^0.14.1", + "typescript-eslint": "^8.18.2" }, "packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 19cf062..b74fc30 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,6 +56,9 @@ importers: prettier-plugin-astro: specifier: ^0.14.1 version: 0.14.1 + typescript-eslint: + specifier: ^8.18.2 + version: 8.18.2(eslint@9.17.0)(typescript@5.6.2) packages: @@ -1132,6 +1135,14 @@ packages: '@types/yauzl@2.10.3': resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} + '@typescript-eslint/eslint-plugin@8.18.2': + resolution: {integrity: sha512-adig4SzPLjeQ0Tm+jvsozSGiCliI2ajeURDGHjZ2llnA+A67HihCQ+a3amtPhUakd1GlwHxSRvzOZktbEvhPPg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.8.0' + '@typescript-eslint/parser@8.18.2': resolution: {integrity: sha512-y7tcq4StgxQD4mDr9+Jb26dZ+HTZ/SkfqpXSiqeUXZHxOUyjWDKsmwKhJ0/tApR08DgOhrFAoAhyB80/p3ViuA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1143,6 +1154,13 @@ packages: resolution: {integrity: sha512-YJFSfbd0CJjy14r/EvWapYgV4R5CHzptssoag2M7y3Ra7XNta6GPAJPPP5KGB9j14viYXyrzRO5GkX7CRfo8/g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/type-utils@8.18.2': + resolution: {integrity: sha512-AB/Wr1Lz31bzHfGm/jgbFR0VB0SML/hd2P1yxzKDM48YmP7vbyJNHRExUE/wZsQj2wUCvbWH8poNHFuxLqCTnA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.8.0' + '@typescript-eslint/types@8.18.2': resolution: {integrity: sha512-Z/zblEPp8cIvmEn6+tPDIHUbRu/0z5lqZ+NvolL5SvXWT5rQy7+Nch83M0++XzO0XrWRFWECgOAyE8bsJTl1GQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1153,6 +1171,13 @@ packages: peerDependencies: typescript: '>=4.8.4 <5.8.0' + '@typescript-eslint/utils@8.18.2': + resolution: {integrity: sha512-Cr4A0H7DtVIPkauj4sTSXVl+VBWewE9/o40KcF3TV9aqDEOWoXF3/+oRXNby3DYzZeCATvbdksYsGZzplwnK/Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.8.0' + '@typescript-eslint/visitor-keys@8.18.2': resolution: {integrity: sha512-zORcwn4C3trOWiCqFQP1x6G3xTRyZ1LYydnj51cRnJ6hxBlr/cKPckk+PKPUw/fXmvfKTcw7bwY3w9izgx5jZw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1934,6 +1959,9 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + gray-matter@4.0.3: resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==} engines: {node: '>=6.0'} @@ -3072,6 +3100,13 @@ packages: resolution: {integrity: sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==} engines: {node: '>= 0.4'} + typescript-eslint@8.18.2: + resolution: {integrity: sha512-KuXezG6jHkvC3MvizeXgupZzaG5wjhU3yE8E7e6viOvAvD9xAWYp8/vy0WULTGe9DYDWcQu7aW03YIV3mSitrQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.8.0' + typescript@5.6.2: resolution: {integrity: sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==} engines: {node: '>=14.17'} @@ -4310,6 +4345,23 @@ snapshots: '@types/node': 22.5.4 optional: true + '@typescript-eslint/eslint-plugin@8.18.2(@typescript-eslint/parser@8.18.2(eslint@9.17.0)(typescript@5.6.2))(eslint@9.17.0)(typescript@5.6.2)': + dependencies: + '@eslint-community/regexpp': 4.12.1 + '@typescript-eslint/parser': 8.18.2(eslint@9.17.0)(typescript@5.6.2) + '@typescript-eslint/scope-manager': 8.18.2 + '@typescript-eslint/type-utils': 8.18.2(eslint@9.17.0)(typescript@5.6.2) + '@typescript-eslint/utils': 8.18.2(eslint@9.17.0)(typescript@5.6.2) + '@typescript-eslint/visitor-keys': 8.18.2 + eslint: 9.17.0 + graphemer: 1.4.0 + ignore: 5.3.2 + natural-compare: 1.4.0 + ts-api-utils: 1.4.3(typescript@5.6.2) + typescript: 5.6.2 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/parser@8.18.2(eslint@9.17.0)(typescript@5.6.2)': dependencies: '@typescript-eslint/scope-manager': 8.18.2 @@ -4327,6 +4379,17 @@ snapshots: '@typescript-eslint/types': 8.18.2 '@typescript-eslint/visitor-keys': 8.18.2 + '@typescript-eslint/type-utils@8.18.2(eslint@9.17.0)(typescript@5.6.2)': + dependencies: + '@typescript-eslint/typescript-estree': 8.18.2(typescript@5.6.2) + '@typescript-eslint/utils': 8.18.2(eslint@9.17.0)(typescript@5.6.2) + debug: 4.4.0 + eslint: 9.17.0 + ts-api-utils: 1.4.3(typescript@5.6.2) + typescript: 5.6.2 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/types@8.18.2': {} '@typescript-eslint/typescript-estree@8.18.2(typescript@5.6.2)': @@ -4343,6 +4406,17 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/utils@8.18.2(eslint@9.17.0)(typescript@5.6.2)': + dependencies: + '@eslint-community/eslint-utils': 4.4.1(eslint@9.17.0) + '@typescript-eslint/scope-manager': 8.18.2 + '@typescript-eslint/types': 8.18.2 + '@typescript-eslint/typescript-estree': 8.18.2(typescript@5.6.2) + eslint: 9.17.0 + typescript: 5.6.2 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/visitor-keys@8.18.2': dependencies: '@typescript-eslint/types': 8.18.2 @@ -5446,6 +5520,8 @@ snapshots: graceful-fs@4.2.11: {} + graphemer@1.4.0: {} + gray-matter@4.0.3: dependencies: js-yaml: 3.14.1 @@ -6982,6 +7058,16 @@ snapshots: possible-typed-array-names: 1.0.0 reflect.getprototypeof: 1.0.9 + typescript-eslint@8.18.2(eslint@9.17.0)(typescript@5.6.2): + dependencies: + '@typescript-eslint/eslint-plugin': 8.18.2(@typescript-eslint/parser@8.18.2(eslint@9.17.0)(typescript@5.6.2))(eslint@9.17.0)(typescript@5.6.2) + '@typescript-eslint/parser': 8.18.2(eslint@9.17.0)(typescript@5.6.2) + '@typescript-eslint/utils': 8.18.2(eslint@9.17.0)(typescript@5.6.2) + eslint: 9.17.0 + typescript: 5.6.2 + transitivePeerDependencies: + - supports-color + typescript@5.6.2: {} ufo@1.5.4: {} diff --git a/src/components/Head.astro b/src/components/Head.astro index 98a00cb..55a949b 100644 --- a/src/components/Head.astro +++ b/src/components/Head.astro @@ -47,7 +47,7 @@ const baseURL = 'https://ayo.ayco.io' * unregister existing service workers */ navigator.serviceWorker.getRegistrations().then((registrations) => { - for (let registration of registrations) { + for (const registration of registrations) { registration.unregister() } }) diff --git a/src/sw.mjs b/src/sw.mjs index 5b932e6..3165662 100644 --- a/src/sw.mjs +++ b/src/sw.mjs @@ -44,7 +44,7 @@ const networkFirst = async ({ request, fallbackUrl }) => { putInCache(request, responseFromNetwork.clone()) console.info('using network response', responseFromNetwork.url) return responseFromNetwork - // eslint-disable-next-line no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (error) { // Try get the resource from the cache const responseFromCache = await cache.match(request) @@ -70,7 +70,7 @@ const networkFirst = async ({ request, fallbackUrl }) => { } } -// eslint-disable-next-line no-unused-vars +// eslint-disable-next-line @typescript-eslint/no-unused-vars self.addEventListener('activate', (event) => { console.info('activating service worker...') })