Skip to content

Commit 06caa2f

Browse files
btraversclaude
andcommitted
chore: adopt @unthrown/oxlint recommended rules
Register the unthrown oxlint plugin in .oxlintrc.json and enable the recommended rule set as errors: no-ambiguous-error-type, no-catch-all-pattern, no-unhandled-result, prefer-async-result (the two opt-ins, no-throw and prefer-ensure, stay off). The package rides the catalog and is excluded from the supply-chain maturity gate as a first-party btravstack library. Violations fixed: - prefer-async-result (3): the internal never-rejecting async work thunks in TypedAmqpClient.create, TypedAmqpWorker.create, and AmqpClient.close were annotated Promise<Result<T, never>>. Dropped the redundant return annotations — inference yields the same type, and the thunks are immediately adopted by fromSafePromise, so no raw Promise<Result> crosses an API boundary. Removed the now-unused Result type import in amqp-client.ts. - no-ambiguous-error-type, no-catch-all-pattern, no-unhandled-result: zero findings. No disables were needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent b68f0bd commit 06caa2f

7 files changed

Lines changed: 38 additions & 12 deletions

File tree

.oxlintrc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
22
"$schema": "./node_modules/oxlint/configuration_schema.json",
3-
"extends": ["./node_modules/@btravstack/oxlint/base.json"]
3+
"extends": ["./node_modules/@btravstack/oxlint/base.json"],
4+
"jsPlugins": [{ "name": "unthrown", "specifier": "@unthrown/oxlint" }],
5+
"rules": {
6+
"unthrown/no-ambiguous-error-type": "error",
7+
"unthrown/no-catch-all-pattern": "error",
8+
"unthrown/no-unhandled-result": "error",
9+
"unthrown/prefer-async-result": "error"
10+
}
411
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@btravstack/oxlint": "catalog:",
2727
"@changesets/cli": "catalog:",
2828
"@commitlint/cli": "catalog:",
29+
"@unthrown/oxlint": "catalog:",
2930
"knip": "catalog:",
3031
"lefthook": "catalog:",
3132
"oxfmt": "catalog:",

packages/client/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export class TypedAmqpClient<TContract extends ContractDefinition> {
241241
.waitForConnectionReady()
242242
.flatMap(() => client.setupReplyConsumerIfNeeded());
243243

244-
const inner = (async (): Promise<Result<TypedAmqpClient<TContract>, never>> => {
244+
const inner = (async () => {
245245
const setupResult = await setup;
246246
if (!setupResult.isOk()) {
247247
const closeResult = await client.close();

packages/core/src/amqp-client.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@ import type {
77
CreateChannelOpts,
88
} from "amqp-connection-manager";
99
import type { Channel, ConsumeMessage, Options } from "amqplib";
10-
import {
11-
fromPromise,
12-
fromSafePromise,
13-
fromSafeThrowable,
14-
Ok,
15-
type AsyncResult,
16-
type Result,
17-
} from "unthrown";
10+
import { fromPromise, fromSafePromise, fromSafeThrowable, Ok, type AsyncResult } from "unthrown";
1811

1912
import { ConnectionManagerSingleton, type ConnectionLease } from "./connection-manager.js";
2013
import { TechnicalError } from "./errors.js";
@@ -469,7 +462,7 @@ export class AmqpClient {
469462
close(): AsyncResult<void, never> {
470463
if (this.closing) return this.closing;
471464

472-
const inner = (async (): Promise<Result<void, never>> => {
465+
const inner = (async () => {
473466
const channelResult = await fromPromise(
474467
this.channelWrapper.close(),
475468
(error: unknown, defect) => defect(new TechnicalError("Failed to close channel", error)),

packages/worker/src/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ export class TypedAmqpWorker<TContract extends ContractDefinition> {
524524
// If setup fails, release the AmqpClient's connection ref-count and cancel
525525
// any consumers that registered before the failure, so a failed create()
526526
// does not leak.
527-
const inner = (async (): Promise<Result<TypedAmqpWorker<TContract>, never>> => {
527+
const inner = (async () => {
528528
const setupResult = await setup;
529529
if (!setupResult.isOk()) {
530530
const closeResult = await worker.close();

pnpm-lock.yaml

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ catalog:
2828
"@orpc/zod": 1.14.8
2929
"@standard-schema/spec": 1.1.0
3030
"@types/node": 26.1.1
31+
"@unthrown/oxlint": 5.0.0
3132
"@unthrown/vitest": 5.0.0
3233
"@vitest/coverage-v8": 4.1.10
3334
amqp-connection-manager: 5.0.0
@@ -124,6 +125,7 @@ minimumReleaseAgeExclude:
124125
- "@btravstack/tsconfig"
125126
- "@btravstack/typedoc"
126127
- unthrown
128+
- "@unthrown/oxlint"
127129
- "@unthrown/vitest"
128130
# Temporary: fast-uri 3.1.4 (the GHSA-v2hh-gcrm-f6hx override above) is younger
129131
# than the 7-day cutoff. Remove once 3.1.4 is 7 days old (published 2026-07-19).

0 commit comments

Comments
 (0)