chore(frontend): introduce prettier + eslint and prune unused code
Backend CI / Backend (push) Has been cancelled
Frontend CI / Frontend (push) Failing after 1m39s

- Add Prettier 3 with prettier-plugin-organize-imports (sorts/removes unused imports)
- Add ESLint 10 flat config with typescript-eslint + eslint-plugin-vue + eslint-config-prettier
- Add root scripts: format, format:check, lint, lint:fix
- Reformat 257 files across admin-web, ops-web, desktop-client, packages
- Remove unused locals/exports flagged by --noUnusedLocals/--noUnusedParameters
- Fix duplicate localTabLabel key, surrogate-pair regex u-flag, NBSP literal in regex
- Skip server/ (Go) and apps/browser-extension/ (deprecated per ADR)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-01 20:39:09 +08:00
parent 21c7892ee4
commit 162abdc97c
258 changed files with 42261 additions and 37556 deletions
@@ -1,8 +1,8 @@
import { Buffer } from "node:buffer";
import { Buffer } from 'node:buffer'
import { describe, expect, it, vi } from "vitest";
import { describe, expect, it, vi } from 'vitest'
vi.mock("electron", () => ({
vi.mock('electron', () => ({
nativeImage: {
createFromBuffer: () => ({
isEmpty: () => false,
@@ -15,33 +15,30 @@ vi.mock("electron", () => ({
toPNG: () => Buffer.from([]),
}),
},
}));
}))
vi.mock("../transport/api-client", () => ({
vi.mock('../transport/api-client', () => ({
fetchDesktopApiURL: vi.fn(),
resolveDesktopApiURL: (path: string) => `http://127.0.0.1:8080${path}`,
}));
}))
import {
buildAssetURLCandidates,
getCenteredCropRect,
} from "./media-image";
import { buildAssetURLCandidates, getCenteredCropRect } from './media-image'
describe("media image helpers", () => {
it("resolves public asset URLs through public and authenticated desktop candidates", () => {
expect(buildAssetURLCandidates("/api/public/assets/12")).toEqual([
"http://127.0.0.1:8080/api/public/assets/12?format=png",
"http://127.0.0.1:8080/api/desktop/content/assets/12?format=png",
"http://127.0.0.1:8080/api/public/assets/12",
]);
});
describe('media image helpers', () => {
it('resolves public asset URLs through public and authenticated desktop candidates', () => {
expect(buildAssetURLCandidates('/api/public/assets/12')).toEqual([
'http://127.0.0.1:8080/api/public/assets/12?format=png',
'http://127.0.0.1:8080/api/desktop/content/assets/12?format=png',
'http://127.0.0.1:8080/api/public/assets/12',
])
})
it("centers crop rectangles at the requested ratio", () => {
const rect = getCenteredCropRect(1600, 1000, 4 / 3);
it('centers crop rectangles at the requested ratio', () => {
const rect = getCenteredCropRect(1600, 1000, 4 / 3)
expect(rect.x).toBeCloseTo(133.333, 3);
expect(rect.y).toBeCloseTo(0);
expect(rect.width).toBeCloseTo(1333.333, 3);
expect(rect.height).toBeCloseTo(1000);
});
});
expect(rect.x).toBeCloseTo(133.333, 3)
expect(rect.y).toBeCloseTo(0)
expect(rect.width).toBeCloseTo(1333.333, 3)
expect(rect.height).toBeCloseTo(1000)
})
})