TheDocumentation 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.
Diagnostic module provides builder functions for constructing lint diagnostics and composing the fix functions that oxlint applies during autofix runs. Every constructor and combinator returns a plain data object — there is no mutation. Fixes are ordinary functions that receive an oxlint Fixer and return fix operations, so they compose naturally with Diagnostic.composeFixes.
Diagnostic.make — basic diagnostic
Diagnostic.make(opts) creates a diagnostic pinned to a node location with an inline message string. The node field accepts any Ranged value (any AST node or token with source range information).
data field accepts a DiagnosticData record for template interpolation when oxlint renders the message.
Diagnostic.fromId — messageId-based diagnostics
Diagnostic.fromId(opts) creates a diagnostic that references a message by its key in meta.messages rather than embedding a string directly. Use this when you define all message text in Rule.meta and want to keep the rule body free of raw strings.
Diagnostic.withFix — attaching a single autofix
Diagnostic.withFix(diagnostic, fix) attaches a FixFn to a diagnostic. It returns a new diagnostic object — the original is not mutated. withFix supports the dual API.
Diagnostic.withSuggestions — attaching suggestions
Diagnostic.withSuggestions(diagnostic, suggestions) attaches an array of suggestion fixes. Suggestions appear in the IDE as quick-fix options but are not applied automatically by --fix. withSuggestions also supports the dual API.
Fix operations
Each fix helper returns aFixFn — a function that accepts an oxlint Fixer and returns a fix operation. Pass a FixFn directly to Diagnostic.withFix or compose multiple with Diagnostic.composeFixes.
Diagnostic.replaceText(node, newText)
Diagnostic.replaceText(node, newText)
Replace the source text of the entire node or token.
Diagnostic.insertBefore(node, text)
Diagnostic.insertBefore(node, text)
Insert text immediately before the node or token.
Diagnostic.insertAfter(node, text)
Diagnostic.insertAfter(node, text)
Insert text immediately after the node or token.
Diagnostic.removeFix(node)
Diagnostic.removeFix(node)
Remove the node or token entirely from the source.
Diagnostic.composeFixes — combining multiple fixes
Diagnostic.composeFixes(...fixes) merges any number of FixFn values into a single FixFn. All individual fixes are collected into one array and applied together by oxlint.
withFix as usual:
Full example
This example shows the complete diagnostic construction chain — basic make, single fix, and composed multi-fix:Submitting diagnostics via RuleContext
Diagnostics are submitted throughctx.report(diagnostic) inside your create generator:
ctx.report returns Effect<void>, so you can yield* it directly or return it from a handler — both work because handlers return Effect<void>.