@clipboard-health/oxlint-plugin
Clipboard's custom Oxlint rules. Consumers should normally use the presets exported by
@clipboard-health/oxlint-config.
The package is independent of ESLint and @typescript-eslint. Its standard create(context)
rules are also re-exported by @clipboard-health/eslint-plugin for repositories that still use
ESLint.
Rules
enforce-contract-in-controllersenforce-ts-rest-in-controllers: deprecated alias ofenforce-contract-in-controllers, removed in the next major versionno-ambiguous-positional-parametersno-empty-boolean-callno-cross-contract-importsno-parallel-mongo-session-opsno-tests-in-contract-packagesrequire-contract-fixture-constructionrequire-contract-response-parserequire-http-module-factoryrequire-run-validators-with-upsertrequire-to-declared-errorrequire-zod-import-in-contracts
Configuration
Use the customRules preset from @clipboard-health/oxlint-config to register the plugin and
apply the shared controller, module, contract, and cross-contract-import scopes. The
contractFixtures preset enables fixture-construction checks in tests.
no-empty-boolean-call, require-contract-response-parse, and
require-run-validators-with-upsert are opt-in because their safe adoption scope is
repository-specific.
customRules enables no-tests-in-contract-packages from @clipboard-health/oxlint-config 3.0.0.
It reports only test files inside packages/contract-* directories, excluding
packages/contract-core.
no-parallel-mongo-session-ops is also opt-in. Out of the box it covers Promise.all,
Promise.allSettled, Promise.race, and Promise.any. Repositories with their own
bounded-concurrency helpers must name them, or those call sites go unchecked:
"@clipboard-health/no-parallel-mongo-session-ops": [
"warn",
{ additionalPrimitives: ["batchPromiseAllWithLimit", "batchPromiseAllSettledWithLimit"] },
],
Exclude tests: app-level session objects such as session.sessionUserId share the name but are
unrelated to MongoDB sessions.
require-to-declared-error is opt-in while services adopt oRPC. In a handler passed to oRPC's
implement(...).handler(), every throw in a branch that handles a failed ServiceResult must
throw toDeclaredError({ errors, error }) from @clipboard-health/api-nestjs, or one of the
handler's errors constructors, so the response keeps the status the contract declares. The branch
may still return. The rule is syntactic: its file comment lists the conditions it recognizes and
the forms it skips. Enable it on controllers:
{
files: ["**/*.controller.ts"],
rules: { "@clipboard-health/require-to-declared-error": "error" },
},