A collection of custom Oxlint rules and presets for TypeScript projects.
npm install --save-dev oxlint@^1.78.0 oxlint-rulesCreate oxlint.config.ts:
import { defineConfig } from "oxlint";
import antislop from "oxlint-rules/config";
import blankLines from "oxlint-rules/config/blank-lines";
export default defineConfig({
extends: [antislop, blankLines],
});For Effect projects, import oxlint-rules/config/effect instead of oxlint-rules/config.
Run Oxlint:
npx oxlint .
npx oxlint --fix .| Preset | Import | Behavior |
|---|---|---|
| General | oxlint-rules/config |
16 general type-safety rules as errors. |
| Effect | oxlint-rules/config/effect |
General rules plus Effect service-constructor check as errors. |
| Blank lines | oxlint-rules/config/blank-lines |
11 vertical spacing rules as warnings (autofixable). |
Override severity or pass options in rules:
export default defineConfig({
extends: [antislop, blankLines],
rules: {
"antislop/no-module-mocking": "off",
"antislop/no-runtime-typeof": ["error", { allowInTypeGuards: true }],
"blank-lines/switch-case-spacing": ["warn", { longCase: "always", shortCase: "any" }],
},
});| Rule | Description | Autofix |
|---|---|---|
antislop/no-chained-type-assertions |
Reject nested assertions that discard type evidence. | No |
antislop/no-conditional-empty-object-spread |
Reject conditional spreads that use {} to omit fields. |
No |
antislop/no-known-value-widening |
Reject broad annotations that discard a known value's type information. | No |
antislop/no-module-mocking |
Reject Vitest and Jest module mocks. | No |
antislop/no-never-assertions |
Reject assertions to never. |
No |
antislop/no-object-parameters |
Reject the broad object type on function inputs. |
No |
antislop/no-reflect-apply |
Reject Reflect.apply in favor of typed calls. |
No |
antislop/no-reflect-get |
Reject Reflect.get in favor of typed access or boundary parsing. |
No |
antislop/no-runtime-typeof |
Restrict runtime typeof checks, with configurable exceptions. |
No |
antislop/no-shape-in-symbol-names |
Reject shape in symbol names. |
No |
antislop/no-unknown-parameters |
Restrict unknown inputs to cause parameters and recognized parser boundaries. |
No |
antislop/no-unknown-returns |
Reject return contracts containing unknown or Promise<unknown>. |
No |
antislop/no-unknown-type-aliases |
Reject type aliases that conceal unknown. |
No |
antislop/no-unsafe-dictionary-type |
Reject dictionaries with unsafe, broadly typed values. | No |
antislop/no-widen-then-assert |
Reject widening a value to a broad type and later asserting it back. | No |
antislop/require-safety-comment-for-type-assertion |
Require a SAFETY: explanation for non-const assertions. |
No |
antislop-effect/no-service-constructor-imports |
Reject relative make<Capability> constructor imports outside test files. |
No |
| Rule | Description | Autofix |
|---|---|---|
blank-lines/blank-line-after-block |
Separate block-like statements from following work, with grouping exceptions. | Yes |
blank-lines/blank-line-before-exit |
Separate exits in larger bodies while keeping small operation-and-exit bodies compact. | Yes |
blank-lines/block-boundary-spacing |
Control blank padding inside braces. | Yes |
blank-lines/comment-group-spacing |
Control spacing around standalone comments. | Yes |
blank-lines/control-flow-cuddling |
Keep related setup and control flow together; separate unrelated statements. | Yes |
blank-lines/declaration-group-spacing |
Group declarations and their immediate uses. | Yes |
blank-lines/expression-group-spacing |
Group calls, assignments, awaits, and other expression statements. | Yes |
blank-lines/lines-between-class-members |
Control spacing between fields, methods, accessors, and static blocks. | Yes |
blank-lines/lines-between-type-members |
Control spacing between interface, type-literal, and enum members. | Yes |
blank-lines/max-consecutive-blank-lines |
Limit repeated blank lines, including at file boundaries. | Yes |
blank-lines/padding-line-between-statements |
Configure spacing with ordered statement-pair rules; enable manually. | Yes |
blank-lines/switch-case-spacing |
Keep switch cases compact by default, with options to separate them. | Yes |