fix: correct imports and add ESLint CI
Some checks failed
Lint / eslint (push) Failing after 1m32s

- Fix proxy.js: use utils/config/service-helpers (correct path for
  Homepage v1.7.0; utils/service-helpers does not exist)
- Fix component.jsx: blank line between external and utils/ imports
  as required by Homepage ESLint import/order rule
- Add .eslintrc.json mirroring Homepage's ESLint config
- Add package.json with ESLint dev dependencies
- Add Forgejo Actions workflow to lint on push/PR

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alkim Ake Gozen 2026-05-21 13:34:33 +09:00
parent cc34c22aa5
commit a7fa4dbaf1
5 changed files with 77 additions and 7 deletions

View file

@ -1,12 +1,8 @@
import { httpProxy } from "utils/proxy/http";
import getServiceWidget from "utils/service-helpers";
import getServiceWidget from "utils/config/service-helpers";
import { formatApiCall } from "utils/proxy/api-helpers";
import createLogger from "utils/logger";
const logger = createLogger("blocky");
import { httpProxy } from "utils/proxy/http";
function parseMetric(text, name) {
// Matches bare metric or metric with labels: my_metric{label="x"} 1.0
const re = new RegExp(`^${name}(?:{[^}]*})?\\s+([0-9.e+\\-]+)`, "m");
const m = text.match(re);
return m ? parseFloat(m[1]) : 0;
@ -20,7 +16,6 @@ export default async function blockyProxyHandler(req, res) {
const [status, , data] = await httpProxy(url);
if (status !== 200) {
logger.error("HTTP %d fetching Blocky metrics from %s", status, url);
return res.status(status).json({ error: `HTTP ${status}` });
}