chore: apply prettier on the entire project

This commit is contained in:
jubnl
2026-05-25 21:59:42 +02:00
parent c130ed41be
commit 6bcdfbc34b
488 changed files with 82986 additions and 45830 deletions
@@ -1,8 +1,9 @@
import { describe, it, expect } from 'vitest';
import { SYSTEM_NOTICES } from '../../../src/systemNotices/registry.js';
import fs from 'node:fs';
import path from 'node:path';
import semver from 'semver';
import { SYSTEM_NOTICES } from '../../../src/systemNotices/registry.js';
import { describe, it, expect } from 'vitest';
/** Collect all actionIds registered via registerNoticeAction() in client source files. */
function collectRegisteredActionIds(): Set<string> {
@@ -13,7 +14,10 @@ function collectRegisteredActionIds(): Set<string> {
const dir = queue.pop()!;
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) { queue.push(full); continue; }
if (entry.isDirectory()) {
queue.push(full);
continue;
}
if (!entry.name.endsWith('noticeActions.ts') && !entry.name.endsWith('noticeActions.js')) continue;
const src = fs.readFileSync(full, 'utf8');
for (const m of src.matchAll(/registerNoticeAction\(\s*['"]([^'"]+)['"]/g)) {
@@ -26,15 +30,15 @@ function collectRegisteredActionIds(): Set<string> {
describe('registry integrity', () => {
it('has no duplicate ids', () => {
const ids = SYSTEM_NOTICES.map(n => n.id);
const ids = SYSTEM_NOTICES.map((n) => n.id);
expect(new Set(ids).size).toBe(ids.length);
});
it('all action CTAs reference a registered actionId', () => {
const registeredActionIds = collectRegisteredActionIds();
const actionCtaIds = SYSTEM_NOTICES
.filter(n => n.cta?.kind === 'action')
.map(n => (n.cta as { actionId: string }).actionId);
const actionCtaIds = SYSTEM_NOTICES.filter((n) => n.cta?.kind === 'action').map(
(n) => (n.cta as { actionId: string }).actionId,
);
for (const id of actionCtaIds) {
expect(registeredActionIds, `actionId "${id}" not found in any client noticeActions.ts`).toContain(id);
@@ -58,7 +62,7 @@ describe('registry integrity', () => {
if (n.minVersion && n.maxVersion) {
expect(
semver.lte(n.minVersion, n.maxVersion),
`notice "${n.id}": minVersion ${n.minVersion} > maxVersion ${n.maxVersion}`
`notice "${n.id}": minVersion ${n.minVersion} > maxVersion ${n.maxVersion}`,
).toBe(true);
}
}