chore: add ESLint + Prettier, fix all lint errors

- Install eslint, typescript-eslint, eslint-plugin-astro, prettier,
  prettier-plugin-astro, globals
- Add flat eslint.config.mjs with recommended rules for JS, TS, Astro
- Add .prettierrc with astro plugin
- Add lint, lint:fix, format, format:check scripts
- Fix prefer-const, no-unused-vars, no-useless-assignment across codebase
- Fix AdBanner.astro JSX fragment for Prettier compatibility
- Add eslint-disable around Yandex/Top.Mail.Ru inline scripts
- Auto-format entire codebase with Prettier
This commit is contained in:
emil
2026-05-10 21:17:34 +03:00
parent bb62d7310e
commit 8421441664
55 changed files with 4625 additions and 2954 deletions
+12 -8
View File
@@ -1,16 +1,16 @@
const CACHE_NAME = 'randify-v1';
const CACHE_NAME = "randify-v1";
self.addEventListener('install', (event) => {
self.addEventListener("install", (event) => {
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
self.addEventListener("activate", (event) => {
event.waitUntil(self.clients.claim());
});
self.addEventListener('fetch', (event) => {
self.addEventListener("fetch", (event) => {
const { request } = event;
const isNavigate = request.mode === 'navigate';
const isNavigate = request.mode === "navigate";
const isSameOrigin = new URL(request.url).origin === self.location.origin;
if (!isSameOrigin) {
@@ -29,7 +29,7 @@ self.addEventListener('fetch', (event) => {
}
return response;
})
.catch(() => caches.match(request))
.catch(() => caches.match(request)),
);
} else {
// Cache-first for static assets (JS, CSS, SVG, fonts, etc.)
@@ -39,14 +39,18 @@ self.addEventListener('fetch', (event) => {
return cached;
}
return fetch(request).then((response) => {
if (!response || response.status !== 200 || response.type !== 'basic') {
if (
!response ||
response.status !== 200 ||
response.type !== "basic"
) {
return response;
}
const clone = response.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(request, clone));
return response;
});
})
}),
);
}
});
+6 -4
View File
@@ -1,6 +1,8 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>Verification: dd9dad039a139021</body>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
Verification: dd9dad039a139021
</body>
</html>