effect-oxlint lets you write fully effectful lint rules where each visitor handler is anDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/mpsuesser/effect-oxlint/llms.txt
Use this file to discover all available pages before exploring further.
Effect<void> that can read Ref state, access context, and report diagnostics — all without a single mutable variable or callback-style setup.
Rule.define — the primary entry point
Rule.define is the core function for creating a custom oxlint rule. It accepts a RuleConfig object and returns a standard CreateRule that oxlint can load. The create field is an Effect generator function (function*) that runs once per file and returns a TypedEffectVisitor map.
yield* any Effect-compatible values: Ref.make(0) for state, RuleContext for context access, Visitor.accumulate(...) for collected analysis. State created in create persists across all handler invocations for that file via closure.
Both the
create generator and every visitor handler have a fixed error channel of never. Rules cannot propagate typed failures — any fallible sub-effect must be caught inside the handler and surfaced as a diagnostic or silently suppressed.Rule.meta — metadata helper
Rule.meta constructs the RuleMeta object with sensible defaults. The type and description fields are required; all others are optional.
messages map is used with Diagnostic.fromId to reference diagnostics by messageId rather than an inline string — useful when you want to keep message text centralised in metadata.
Options with Schema decoding
The optionaloptions field on RuleConfig accepts a Schema.Decoder. When provided, the first element of the raw JSON options array passed by the linter configuration is decoded at rule-create time and forwarded as the options argument to your create generator.
Schema.decodeUnknownSync throws, which crashes rule creation for that file. Validate liberally and provide good defaults in your Schema when end-user config may be malformed.
Convenience factories
For the most common patterns, effect-oxlint ships ready-made factories. Each factory callsRule.define internally and auto-derives a rule name from the pattern arguments.
Rule.banMember(obj, prop, opts)
Rule.banMember(obj, prop, opts)
Bans
obj.prop member expression access. prop can be a single string or an array of strings to match multiple properties.Rule.banImport(source, opts)
Rule.banImport(source, opts)
Bans
import ... from "source" declarations matching a string or predicate. Pass a function to match by prefix or pattern.Rule.banCallOf(name, opts)
Rule.banCallOf(name, opts)
Bans bare identifier call expressions like
fetch(), useState(), or readFileSync(). name can be a single string or an array.Rule.banCallOfMember(obj, prop, opts)
Rule.banCallOfMember(obj, prop, opts)
Bans
obj.prop(...) method-call patterns. Unlike banMember, this only fires when the member expression is actually called — not when it is merely accessed.Rule.banNewExpr(name, opts)
Rule.banNewExpr(name, opts)
Bans
new expressions with a given constructor name. name can be a string or array.Rule.banStatement(nodeType, opts)
Rule.banStatement(nodeType, opts)
Bans a specific ESTree statement node type by name.
Rule.banMultiple(spec, opts)
Rule.banMultiple(spec, opts)
Combines multiple ban patterns — calls, new expressions, member accesses, member calls, imports, and statements — into a single rule with merged visitors. This is the most flexible factory.The
Pass a
BanMultipleSpec fields are all optional:| Field | Type | Description |
|---|---|---|
calls | string | string[] | Bare identifier calls to ban |
newExprs | string | string[] | new expressions to ban |
members | [obj, prop][] | Member expressions to ban |
memberCalls | [obj, prop][] | Member call expressions to ban |
imports | (string | predicate)[] | Import sources to ban |
statements | string[] | Statement node types to ban |
name field in opts to override the auto-derived rule name:Assembling rules into a plugin
Once your rules are defined, pass them toPlugin.define to create a plugin oxlint can load: