Skip to content

v0.6.4

Choose a tag to compare

@fansenze fansenze released this 30 Jun 07:15

Highlights

Rslint Node API for In-Memory Linting

Rslint now ships a programmatic Node.js API (@rslint/core) aligned with ESLint v10's interface. Use Rslint#lintFiles / lintText to lint from scripts, dev servers, or editor integrations — results are ESLint-shaped (LintResult[] with messages, errorCount, warningCount, output, etc.). Auto-fix is supported via fix: true plus Rslint.outputFixes. Config resolution (overrideConfig, file discovery, normalization) all stays in JS; the Go --api server receives only the final resolved config and never reads disk.

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

// Lint files by glob (auto-discovers the nearest config from cwd).
const rslint = new Rslint({ cwd: process.cwd() });
const results = await rslint.lintFiles(['src/**/*.ts']);

Fully in-memory linting is also supported through the new virtualFiles overlay — source, config, and tsconfig.json can all live in memory with zero disk access, which makes the API a natural fit for playgrounds, web workers, and editor integrations:

const rslint = new Rslint({
  cwd: '/', // virtual root: doesn't touch process.cwd() or disk
  overrideConfigFile: true, // use only overrideConfig — skip config discovery
  overrideConfig: [
    {
      files: ['**/*.ts'],
      // The tsconfig + parserOptions.project below are needed ONLY for type-aware rules (like no-for-in-array). Syntax-only rules need neither.
      languageOptions: { parserOptions: { project: ['./tsconfig.json'] } },
      plugins: ['@typescript-eslint'],
      rules: { '@typescript-eslint/no-for-in-array': 'error' },
    },
  ],
  virtualFiles: {
    'tsconfig.json': JSON.stringify({
      compilerOptions: { strict: true },
      files: ['./a.ts'],
    }),
  },
});
const [result] = await rslint.lintText(
  'const a = [1];\nfor (const k in a) {}\n',
  { filePath: 'a.ts' },
);

See the new Node.js API guide for details.

What's Changed

New Features 🎉

  • feat: add promise/no-return-in-finally rule by @swwind in #1058
  • feat: add promise/no-callback-in-promise rule by @swwind in #1057
  • feat: port rule promise/prefer-catch by @swwind in #1060
  • feat: expose parameter property symbols in tsgo semantic output by @CPunisher in #1152
  • feat: add gitlab output format by @swwind in #1151
  • feat: add Rslint Node API for in-memory linting by @fansenze in #1122
  • feat(eslint-plugin-jest): add prefer-jest-mocked rule by @eryue0220 in #1147
  • feat(eslint-plugin-jest): add prefer-spy-on rule by @eryue0220 in #1148

Other Changes

  • chore: drop stale references to removed bin/rslint binary path by @fansenze in #1144
  • ci: list explicit go.sum paths to fix hashFiles timeout on self-hosted Windows by @fansenze in #1146
  • test: isolate forced-terminate worker-pool e2e tests in subprocesses by @fansenze in #1150
  • chore(deps): update dependency eslint-plugin-es-x to ^9.7.0 by @renovate[bot] in #1156

Full Changelog: v0.6.3...v0.6.4