GeezerVison is showing github.com — feat: enable oxlint suspicious category, fix 24 violations (#22727) · JamieHoll/opencode@702f741
File treeExpand file treeCollapse file tree Open diff view settings console/app/src/routes/workspace/[id]/billing desktop-electron/src/main
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .oxlintrc.json +21-1Lines changed: 21 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | { | 2 | 2 | "$schema": "https://raw.githubusercontent.com/nicolo-ribaudo/oxc-project.github.io/refs/heads/json-schema/src/public/.oxlintrc.schema.json", | | 3 | + "categories": { | | 4 | + "suspicious": "warn" | | 5 | + }, | 3 | 6 | "rules": { | 4 | 7 | // Effect uses `function*` with Effect.gen/Effect.fnUntraced that don't always yield | 5 | 8 | "require-yield": "off", | | 10 | 13 | // Intentional control char matching (ANSI escapes, null byte sanitization) | 11 | 14 | "no-control-regex": "off", | 12 | 15 | // SST and plugin tools require triple-slash references | 13 | | - "triple-slash-reference": "off" | | 16 | + "triple-slash-reference": "off", | | 17 | + | | 18 | + // Suspicious category: suppress noisy rules | | 19 | + // Effect's nested function* closures inherently shadow outer scope | | 20 | + "no-shadow": "off", | | 21 | + // Namespace-heavy codebase makes this too noisy | | 22 | + "unicorn/consistent-function-scoping": "off", | | 23 | + // Opinionated — .sort()/.reverse() mutation is fine in this codebase | | 24 | + "unicorn/no-array-sort": "off", | | 25 | + "unicorn/no-array-reverse": "off", | | 26 | + // Not relevant — this isn't a DOM event handler codebase | | 27 | + "unicorn/prefer-add-event-listener": "off", | | 28 | + // Bundler handles module resolution | | 29 | + "unicorn/require-module-specifiers": "off", | | 30 | + // postMessage target origin not relevant for this codebase | | 31 | + "unicorn/require-post-message-target-origin": "off", | | 32 | + // Side-effectful constructors are intentional in some places | | 33 | + "no-new": "off" | 14 | 34 | }, | 15 | 35 | "ignorePatterns": ["**/node_modules", "**/dist", "**/.build", "**/.sst", "**/*.d.ts"] | 16 | 36 | } |
Collapse file Copy file name to clipboardExpand all lines: github/index.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -542,7 +542,7 @@ async function subscribeSessionEvents() { | 542 | 542 | ? JSON.stringify(part.state.input) | 543 | 543 | : "Unknown" | 544 | 544 | console.log() | 545 | | - console.log(color + `|`, "\x1b[0m\x1b[2m" + ` ${tool.padEnd(7, " ")}`, "", "\x1b[0m" + title) | | 545 | + console.log(`${color}|`, `\x1b[0m\x1b[2m ${tool.padEnd(7, " ")}`, "", `\x1b[0m${title}`) | 546 | 546 | } | 547 | 547 |
| 548 | 548 | if (part.type === "text") { | @@ -776,7 +776,7 @@ async function assertPermissions() { | 776 | 776 | console.log(` permission: ${permission}`) | 777 | 777 | } catch (error) { | 778 | 778 | console.error(`Failed to check permissions: ${error}`) | 779 | | - throw new Error(`Failed to check permissions for user ${actor}: ${error}`) | | 779 | + throw new Error(`Failed to check permissions for user ${actor}: ${error}`, { cause: error }) | 780 | 780 | } | 781 | 781 |
| 782 | 782 | if (!["admin", "write"].includes(permission)) throw new Error(`User ${actor} does not have write permissions`) | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/context/global-sdk.tsx +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -128,6 +128,7 @@ export const { use: useGlobalSDK, provider: GlobalSDKProvider } = createSimpleCo | 128 | 128 | if (started) return run | 129 | 129 | started = true | 130 | 130 | run = (async () => { | | 131 | + // oxlint-disable-next-line no-unmodified-loop-condition -- `started` is set to false by stop() which also aborts; both flags are checked to allow graceful exit | 131 | 132 | while (!abort.signal.aborted && started) { | 132 | 133 | attempt = new AbortController() | 133 | 134 | lastEventAt = Date.now() | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/utils/runtime-adapters.test.ts +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,7 +46,9 @@ describe("runtime adapters", () => { | 46 | 46 | }) | 47 | 47 |
| 48 | 48 | test("resolves speech recognition constructor with webkit precedence", () => { | | 49 | + // oxlint-disable-next-line no-extraneous-class | 49 | 50 | class SpeechCtor {} | | 51 | + // oxlint-disable-next-line no-extraneous-class | 50 | 52 | class WebkitCtor {} | 51 | 53 | const ctor = getSpeechRecognitionCtor({ | 52 | 54 | SpeechRecognition: SpeechCtor, | |
Collapse file Copy file name to clipboardExpand all lines: packages/console/app/src/routes/workspace/[id]/billing/reload-section.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,7 +90,7 @@ export function ReloadSection() { | 90 | 90 | } | 91 | 91 | const info = billingInfo()! | 92 | 92 | setStore("show", true) | 93 | | - setStore("reload", info.reload ? true : true) | | 93 | + setStore("reload", true) | 94 | 94 | setStore("reloadAmount", info.reloadAmount.toString()) | 95 | 95 | setStore("reloadTrigger", info.reloadTrigger.toString()) | 96 | 96 | } | |
Collapse file Copy file name to clipboardExpand all lines: packages/desktop-electron/src/main/apps.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,7 +28,7 @@ export function wslPath(path: string, mode: "windows" | "linux" | null): string | 28 | 28 | const output = execFileSync("wsl", ["-e", "wslpath", flag, path]) | 29 | 29 | return output.toString().trim() | 30 | 30 | } catch (error) { | 31 | | - throw new Error(`Failed to run wslpath: ${String(error)}`) | | 31 | + throw new Error(`Failed to run wslpath: ${String(error)}`, { cause: error }) | 32 | 32 | } | 33 | 33 | } | 34 | 34 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/function/src/api.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,6 +13,7 @@ type Env = { | 13 | 13 | } | 14 | 14 |
| 15 | 15 | export class SyncServer extends DurableObject<Env> { | | 16 | + // oxlint-disable-next-line no-useless-constructor | 16 | 17 | constructor(ctx: DurableObjectState, env: Env) { | 17 | 18 | super(ctx, env) | 18 | 19 | } | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/script/postinstall.mjs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -64,7 +64,7 @@ function findBinary() { | 64 | 64 |
| 65 | 65 | return { binaryPath, binaryName } | 66 | 66 | } catch (error) { | 67 | | - throw new Error(`Could not find package ${packageName}: ${error.message}`) | | 67 | + throw new Error(`Could not find package ${packageName}: ${error.message}`, { cause: error }) | 68 | 68 | } | 69 | 69 | } | 70 | 70 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/bus/bus-event.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,7 +25,7 @@ export namespace BusEvent { | 25 | 25 | properties: def.properties, | 26 | 26 | }) | 27 | 27 | .meta({ | 28 | | - ref: "Event" + "." + def.type, | | 28 | + ref: `Event.${def.type}`, | 29 | 29 | }) | 30 | 30 | }) | 31 | 31 | .toArray() | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/debug/agent.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -111,6 +111,7 @@ function parseToolParams(input?: string) { | 111 | 111 | } catch (evalError) { | 112 | 112 | throw new Error( | 113 | 113 | `Failed to parse --params. Use JSON or a JS object literal. JSON error: ${jsonError}. Eval error: ${evalError}.`, | | 114 | + { cause: evalError }, | 114 | 115 | ) | 115 | 116 | } | 116 | 117 | } | |
|