Documentation 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.
RuleContext is the Effect service that bridges oxlint’s raw rule context into your effectful rule handlers. Yielding it inside a create generator or a visitor handler gives you typed access to the current file path, rule options, source code object, and the report method for emitting diagnostics — all without mutable variables or null checks.
Accessing the service
ResolveRuleContext anywhere inside a Rule.define generator or visitor handler with yield*:
readonly.
Service fields
Rule identifier in
plugin/rule form (e.g. "my-plugin/no-json-parse").Absolute path of the file currently being linted.
Current working directory of the linting process.
Raw rule options parsed from the oxlint configuration.
Options is the JSON value array passed after the severity level in rule config.The oxlint
SourceCode object for the current file. Provides low-level access to tokens, comments, the AST, and scope data. Prefer the effectful wrappers in the SourceCode module over accessing this directly.Parser and language options in effect for this file — includes
ecmaVersion, sourceType, globals, and parser settings.Shared settings object from the top-level oxlint configuration. Use this to pass cross-rule configuration like framework names or known globals.
Reporting diagnostics
The primary method for emitting a lint finding isctx.report. It accepts an OxlintDiagnostic object and returns Effect<void>:
Diagnostic.make and pass it directly:
Inline report in handlers
For visitor handlers that only need to report, you can returnctx.report(...) directly without an intermediate variable:
Service key
The service is registered under the key'effect-oxlint/RuleContext'. You will rarely need this directly, but it is useful when building test layers or providing the service manually in tests.
fromOxlintContext (internal)
RuleContext service value from oxlint’s raw Context object. This is called by the Rule module at the FFI boundary when oxlint invokes your rule’s create function. You do not call this directly.
Complete example
The following rule usesRuleContext to read the filename and report a diagnostic when JSON.parse or JSON.stringify is accessed: