Oxlint JS plugin for opinionated rules that steer AI and humans toward explicit, guard-clause-first, error-safe code.
npm install oxlint-plugin-inhumanOpinionated Oxlint rules that encode pet peeves and steer AI toward explicit, safer code.
This plugin also re-exposes the no-branching rules under the inhuman/* namespace fromoxlint-plugin-no-branching.
``sh`
npm i -D oxlint-plugin-inhuman
Oxlint requires enabling JS plugin rules explicitly under rules.
`json`
{
"jsPlugins": ["oxlint-plugin-inhuman"],
"rules": {
"inhuman/require-guard-clauses": "error",
"inhuman/no-swallowed-catch": "error",
"inhuman/export-code-last": "error",
"inhuman/no-empty-wrappers": "error",
"inhuman/no-switch": "error",
"inhuman/no-else": "error"
}
}
Forbids a single wrapper if (...) { ... } that is the entire function body.
Forbids empty or comment-only catch blocks, including catch { / ignore / }.
Requires value exports at the bottom of the file. Type-only exports are exempt and may appear anywhere.
Local export lists like export { b } are not allowed; export the declaration directly instead.export const x = y
Local alias exports like are also not allowed.export default foo
Default exports must be on declarations; is only allowed when foo is a variable used internally.export const
Primitive values (for example strings, numbers, booleans, null, bigint, or static templates) are exempt and may appear at the top.
Options default:
- allowReExport: false
Optional config:
`json`
{
"rules": {
"inhuman/export-code-last": ["error", { "allowReExport": true }]
}
}
Forbids exported empty wrapper functions that only pass through to a single call.
Re-exported from oxlint-plugin-no-branching.
Re-exported from oxlint-plugin-no-branching.
`sh`
bunx oxlint examples
Expected errors include:
- examples/fail-wrapper-if.jsexamples/fail-swallowed-catch.js
- examples/fail-exports-before-non-export.js
- examples/fail-export-list.js
- examples/fail-export-alias.js
- examples/fail-export-alias-member.js
- examples/fail-export-alias-chain.js
- examples/fail-default-export-identifier.js
- examples/fail-default-export-unused-identifier.js
- examples/fail-empty-wrapper-impl.ts
- examples/fail-empty-wrapper-generic.ts
- examples/fail-non-primitive-const-top.ts
- examples/fail-switch.js
- examples/fail-else.js
- examples/fail-else-if.js`
-