From 97f47847904f1bed5d93eae84368c8c2c2cf7b55 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 10 Oct 2026 20:50:50 +0200 Subject: [PATCH] refactor(server): keep three suppressed lines whole so Prettier cannot move them past their directive Prettier wraps the emoji regex onto the line after its declaration and spreads two any-cast lines in the plugin tests over several lines, which would leave the casts outside the eslint-disable-next-line above them. The regex directive now sits on the line right before the literal, the dev-link controller takes never instead of any for the collaborators it ignores, and the supervisor test reaches the private kill/onExit through one cast. --- server/scripts/eslint-baseline.json | 2 +- server/src/nest/plugins/text-sanitize.ts | 5 +++-- server/tests/unit/plugins/plugins-controller-devlink.test.ts | 2 +- server/tests/unit/plugins/supervisor-lifecycle.test.ts | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/scripts/eslint-baseline.json b/server/scripts/eslint-baseline.json index bf60443dd..bf61a846c 100644 --- a/server/scripts/eslint-baseline.json +++ b/server/scripts/eslint-baseline.json @@ -10,7 +10,7 @@ "no-empty": 6 }, "suppressed": { - "@typescript-eslint/no-explicit-any": 128, + "@typescript-eslint/no-explicit-any": 124, "@typescript-eslint/no-require-imports": 20, "no-control-regex": 7, "no-misleading-character-class": 1 diff --git a/server/src/nest/plugins/text-sanitize.ts b/server/src/nest/plugins/text-sanitize.ts index fffe59f5a..f6928e471 100644 --- a/server/src/nest/plugins/text-sanitize.ts +++ b/server/src/nest/plugins/text-sanitize.ts @@ -18,8 +18,9 @@ // escape is an intentional, independent code point to delete — the // no-misleading-character-class rule assumes a class means to combine them, which // is the opposite of what we want here. -// eslint-disable-next-line no-misleading-character-class -const EMOJI_RE = /\p{Emoji_Presentation}|\p{Emoji_Modifier}|\p{Regional_Indicator}|[\u200D\uFE00-\uFE0F\u20E3\u{E0020}-\u{E007F}]/gu; +const EMOJI_RE = + // eslint-disable-next-line no-misleading-character-class + /\p{Emoji_Presentation}|\p{Emoji_Modifier}|\p{Regional_Indicator}|[\u200D\uFE00-\uFE0F\u20E3\u{E0020}-\u{E007F}]/gu; /** Remove emojis from a display string and tidy the whitespace they leave behind. */ export function stripEmoji(s: string): string { diff --git a/server/tests/unit/plugins/plugins-controller-devlink.test.ts b/server/tests/unit/plugins/plugins-controller-devlink.test.ts index 9d9314948..f2cdf760b 100644 --- a/server/tests/unit/plugins/plugins-controller-devlink.test.ts +++ b/server/tests/unit/plugins/plugins-controller-devlink.test.ts @@ -11,7 +11,7 @@ import { PluginConsentRequired } from '../../../src/nest/plugins/plugin-runtime. import type { RuntimeEnvService } from '../../../src/nest/app-config/runtime-env.service'; // eslint-disable-next-line @typescript-eslint/no-explicit-any -const ctrl = (runtime: any) => new PluginsController({} as any, runtime, {} as any, { isManaged: () => false } as unknown as RuntimeEnvService); +const ctrl = (runtime: any) => new PluginsController({} as never, runtime, {} as never, { isManaged: () => false } as unknown as RuntimeEnvService); // eslint-disable-next-line @typescript-eslint/no-explicit-any const status = async (p: Promise): Promise => p.then(() => -1, (e) => (e instanceof HttpException ? e.getStatus() : 0)); diff --git a/server/tests/unit/plugins/supervisor-lifecycle.test.ts b/server/tests/unit/plugins/supervisor-lifecycle.test.ts index 234a4e530..39a2e69ad 100644 --- a/server/tests/unit/plugins/supervisor-lifecycle.test.ts +++ b/server/tests/unit/plugins/supervisor-lifecycle.test.ts @@ -72,7 +72,8 @@ describe('supervisor shutdownAll is a clean stop, not a crash', () => { (s as any).running.set('p', sup); // kill() simulates the child actually exiting during shutdown → fires onExit // eslint-disable-next-line @typescript-eslint/no-explicit-any - (s as any).kill = vi.fn(async (x: any) => { (s as any).onExit(x, 0, 'SIGTERM'); }); + const internals = s as any; + internals.kill = vi.fn(async (x: unknown) => { internals.onExit(x, 0, 'SIGTERM'); }); await s.shutdownAll(); expect(sup.status).toBe('stopped'); // stopped before kill // onExit took the early-return path — no crash bookkeeping written to the DB hooks