repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

lint: tighten biome rules

db01d3a4d2b7f7ca9065230acc2023c9a2e6cf10

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (5)

biome.json

Modified
35 35 "useLiteralKeys": "off"
37 37 "correctness": {
38 - "noUnusedFunctionParameters": "warn",
38 + "noUnusedFunctionParameters": "error",
39 39 "noUnusedImports": "error",
40 40 "noUnusedVariables": "error",
41 41 "noVoidTypeReturn": "error",
42 42 "useParseIntRadix": "error"
44 44 "performance": {
45 - "noAccumulatingSpread": "off"
45 + "noAccumulatingSpread": "error"
47 47 "style": {
48 48 "noDescendingSpecificity": "off",
49 - "noNonNullAssertion": "warn",
49 + "noNonNullAssertion": "error",
50 50 "useNodejsImportProtocol": "error",
51 51 "useTemplate": "off"
55 55 "noControlCharactersInRegex": "off",
56 56 "noExplicitAny": "off",
57 57 "noGlobalIsNan": "error",
58 - "noImplicitAnyLet": "off",
58 + "noImplicitAnyLet": "error",
59 59 "noTemplateCurlyInString": "off",
60 60 "useIterableCallbackReturn": "off"

extensions/angel/index.ts

Modified
190 190 function loadSettings(pi: ExtensionAPI): Settings {
191 - const fromFiles = [
192 - path.join(getAgentDir(), "settings.json"),
193 - path.join(process.cwd(), ".pi", "settings.json"),
194 - path.join(process.cwd(), "settings.json"),
195 - ]
196 - .map(readSettings)
197 - .reduce((acc, s) => ({ ...acc, ...s }), {});
191 + const fromFiles = Object.assign(
192 + {},
193 + ...[
194 + path.join(getAgentDir(), "settings.json"),
195 + path.join(process.cwd(), ".pi", "settings.json"),
196 + path.join(process.cwd(), "settings.json"),
197 + ].map(readSettings),
198 + );
199 200 const allSettings = (pi as SettingsAPI).settingsManager?.getSettings();
200 201 const runtime = isPlainObject(allSettings?.angel)

extensions/cwd/index.ts

Modified
29 29 function assertDirectory(path: string): string | undefined {
30 30 if (!existsSync(path)) return `cwd not found: ${path}`;
31 - let stats;
32 31 try {
33 - stats = statSync(path);
32 + const stats = statSync(path);
33 + if (!stats.isDirectory()) return `cwd is not a directory: ${path}`;
34 + return undefined;
34 35 } catch (error) {
35 36 return `cannot stat cwd: ${error instanceof Error ? error.message : String(error)}`;
37 - if (!stats.isDirectory()) return `cwd is not a directory: ${path}`;
38 - return undefined;
41 40 function sessionFileExists(ctx: ExtensionCommandContext): string | undefined {

extensions/leaks/index.ts

Modified
576 576 const agentDir =
577 577 process.env.PI_CODING_AGENT_DIR ||
578 578 path.join(process.env.HOME || "", ".pi", "agent");
579 - return [
580 - path.join(agentDir, "settings.json"),
581 - path.join(cwd, ".pi", "settings.json"),
582 - ]
583 - .map(readJsonObject)
584 - .reduce((acc, item) => ({ ...acc, ...item }), {});
579 + return Object.assign(
580 + {},
581 + ...[
582 + path.join(agentDir, "settings.json"),
583 + path.join(cwd, ".pi", "settings.json"),
584 + ].map(readJsonObject),
585 + );
587 588 function readJsonObject(file: string): Record<string, unknown> {

extensions/superpowers/__tests__/harness.test.ts

Modified
63 63 return { ctx, entries, messages, widgets, notices };
66 -async function waitFor(fn: () => boolean) {
67 - for (let i = 0; i < 80; i++) {
66 +async function waitFor(
67 + fn: () => boolean,
68 + { timeoutMs = 8_000, message = "condition" } = {},
69 +) {
70 + const deadline = Date.now() + timeoutMs;
71 + while (Date.now() < deadline) {
68 72 if (fn()) return;
69 73 await sleep(25);
71 - expect(fn()).toBe(true);
75 + throw new Error(`timed out waiting for ${message}`);
74 78 describe("superpowers harness", () => {