Skip to content

[Feature]: lint in-memory files via the Node API (no disk write) #1106

Description

@jantimon

What problem does this feature solve?

I run an LLM coding agent (Node/TS) that generates code and lints file changes before before storing them in the databse. The point is to catch the dumb render-breaking stuff inside the generation loop especially conditional hooks or const reassignment

Afaik today rslint only supports linting real files on disk

Current linters with in-memory:

  • eslint: lintText(code, { filePath }), works
  • biome: in-process Node API, lintContent(projectKey, content, { filePath }), works
  • oxlint: disk only
  • rslint: disk only

We are using Biome for this because it's the only fast linter with a real in-process Node API right now but I would rather be on rslint to not mix both stacks

What does the proposed API of configuration look like?

Maybe mirror Biome's shape somehow like this (or even better to support ts-go or other cross file lintings)

import { Rslint } from "@rslint/core";

const rslint = new Rslint();
const { projectKey } = rslint.openProject("/");
rslint.applyConfiguration(projectKey, config);

const { diagnostics } = rslint.lintContent(projectKey, source, {
  filePath: "virtual/Component.tsx", // virtual, never written to disk
});

here's my current Biome setup:

import { Biome, type Configuration } from "@biomejs/js-api/nodejs";

const biome = new Biome();
const { projectKey } = biome.openProject("/");
biome.applyConfiguration(projectKey, config);

const { diagnostics } = biome.lintContent(projectKey, content, { filePath });
// map diagnostics -> { path, line, column, rule, severity, message }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions