Rslint
The Rslint class is the ESLint-style programmatic API for linting files and in-memory source from a JavaScript host.
It is designed for Node.js-compatible runtimes that can load npm packages and provide filesystem, process, and child-process APIs.
Getting started
Both lintFiles and lintText return ESLint-shaped LintResult[] values.
Constructor
With automatic discovery, Go selects each file's nearest config and owns ignore and target-admission semantics. The JavaScript host evaluates and normalizes the JS or TS config modules selected for that run.
Object-form community plugins are not supported in overrideConfig, because a plugin worker cannot re-import an in-memory plugin object. Put community plugin declarations in a JS or TS config file. Array-form built-in plugins work in overrideConfig.
See Configuration File for config discovery and flat-config behavior.
lintFiles
Lints files matched by one or more glob patterns resolved against cwd.
Supported files excluded by global config ignores or .gitignore are omitted. With automatic discovery, files in different monorepo packages can use different nearest configs. Results are ordered by file path rather than glob-walk order.
If no file matches, lintFiles returns an empty array. This differs from ESLint v10's default errorOnUnmatchedPattern behavior, which throws for an unmatched glob.
lintText
Lints an in-memory string as if it lived at filePath.
The method returns the result for the supplied buffer. When filePath is omitted, Rslint uses a synthetic TypeScript path for matching and reports the result path as the "<text>" sentinel. A supplied path is resolved against cwd and returned as an absolute path.
Line, column, and fix offsets match ESLint's byte-order-mark behavior: a leading byte order mark is not included in indexed source text, while fixed whole-file output preserves it unless a fix removes it.
In-memory projects
lintText normally discovers config and TypeScript project files from disk. To provide the config, tsconfig, and project files from memory, combine overrideConfigFile: true, overrideConfig, and virtualFiles:
virtualFiles is an overlay, not a filesystem sandbox. Rslint can still read from disk for .gitignore, module resolution, and files absent from the map.
Use relative virtualFiles keys and relative paths inside the tsconfig and parserOptions.project; they are resolved against cwd consistently across operating systems. Prefer an explicit tsconfig files list because a broad include glob is expanded against the real filesystem.
TypeScript project data is only necessary for rules that require type information. A configuration containing only syntax-based rules does not need a tsconfig or parserOptions.project.
outputFixes
Writes the output of fixed results back to disk.
Only results with a string output and an absolute filePath are written. The non-absolute "<text>" result from lintText without a path is skipped automatically.
To apply fixes in memory, read result.output and do not call outputFixes:
Individual auto-fix edits are available through result.messages[].fix. Suggestions are exposed separately in result.messages[].suggestions and are never applied by fix: true.
close
Stops the long-lived Rslint engine process owned by this instance. One-off scripts can exit without calling close() because the idle child process does not keep the event loop alive. Long-running editors, build tools, and watch processes should close instances they no longer need.
Calling close() more than once waits on the same shutdown operation.
Symbol.asyncDispose
Rslint implements the asynchronous disposable protocol, so a compatible toolchain can close it automatically:
Native await using requires runtime support for explicit resource management. TypeScript 5.2 or newer can transform the syntax for older runtimes; otherwise use try / finally and call close() directly.