export declare function applyFixes(options: ApplyFixesRequest): Promise; export declare interface ApplyFixesRequest { fileContent: string; diagnostics: Diagnostic[]; } export declare interface ApplyFixesResponse { fixedContent: string[]; wasFixed: boolean; appliedCount: number; unappliedCount: number; } /** * Type-safe config helper. Returns the config array as-is (identity function). */ export declare function defineConfig(config: RslintConfig): RslintConfig; export declare interface Diagnostic { ruleName: string; message: string; messageId: string; filePath: string; range: Range; severity?: string; suggestions: any[]; } /** * A real ESLint plugin object, as exported by community packages * (`eslint-plugin-unicorn`, etc.). Only the fields rslint consumes are * typed; the open index keeps arbitrary plugin shapes assignable. */ export declare interface ESLintPlugin { meta?: { name?: string; version?: string; }; name?: string; rules?: Record; configs?: Record; [key: string]: unknown; } /** * Edge in the flow graph (from antecedent to current) */ declare interface FlowEdge { from: number; to: number; } /** * Flow graph for visualization */ declare interface FlowGraph { nodes: FlowGraphNode[]; edges: FlowEdge[]; } /** * Node in the flow graph */ declare interface FlowGraphNode { id: number; flags: number; flagNames?: string[]; nodePos?: number; nodeEnd?: number; nodeKindName?: string; } /** * Control flow analysis information */ export declare interface FlowInfo { flags: number; flagNames?: string[]; nodeKind?: number; nodeKindName?: string; nodePos?: number; nodeEnd?: number; antecedent?: FlowInfo; antecedents?: FlowInfo[]; graph?: FlowGraph; } export declare function getAstInfo(options: GetAstInfoRequest): Promise; /** * Request for AST info at a specific position */ export declare interface GetAstInfoRequest { fileContent: string; position: number; end?: number; kind?: number; depth?: number; fileName?: string; compilerOptions?: Record; } /** * Response containing detailed AST information */ export declare interface GetAstInfoResponse { node?: NodeInfo; type?: TypeInfo; symbol?: SymbolInfo; signature?: SignatureInfo; flow?: FlowInfo; } /** * Define a global-ignores config entry. * * Mirrors ESLint's `globalIgnores` helper: returns a config entry that contains * only `ignores`. Because the entry has no `files` (and no rules/plugins/etc.), * the patterns are treated as *global* ignores — applied across every other * config entry — instead of being scoped to a single entry's `files`. * * @example * export default defineConfig([ * globalIgnores(['dist/**', 'coverage/**']), * { files: ['src/**'], rules: { 'no-console': 'error' } }, * ]); */ export declare function globalIgnores(ignorePatterns: string[]): RslintConfigEntry; export declare const importPlugin: { configs: { recommended: RslintConfigEntry; }; }; /** * Index signature information */ export declare interface IndexInfo { keyType: TypeInfo; valueType: TypeInfo; isReadonly: boolean; } export declare const jestPlugin: { configs: { recommended: RslintConfigEntry; style: RslintConfigEntry; }; }; export declare const js: { configs: { recommended: RslintConfigEntry; }; }; export declare const jsxA11yPlugin: { configs: { recommended: RslintConfigEntry; }; }; /** * Plugin declaration names recognized by rslint's loader. */ declare type KnownPlugin = (typeof NATIVE_PLUGINS)[number]; export declare interface LanguageOptions { parserOptions?: ParserOptions; } /** * Language-specific configuration. */ declare interface LanguageOptions_2 { parserOptions?: ParserOptions_2; } export declare function lint(options: LintOptions): Promise; export declare interface LintOptions { files?: string[]; config?: string; workingDirectory?: string; ruleOptions?: Record; fileContents?: Record; languageOptions?: LanguageOptions; includeEncodedSourceFiles?: boolean; } export declare interface LintResponse { diagnostics: Diagnostic[]; errorCount: number; fileCount: number; ruleCount: number; duration: string; encodedSourceFiles?: Record; } /** * Source of truth for the rule prefixes owned by rslint's built-in * (natively-ported) plugins; the `KnownPlugin` type union derives from it. * `NATIVE_PLUGIN_RESERVED_NAMES` unions these prefixes with the alternate * `eslint-plugin-*` declaration names (`NATIVE_PLUGIN_DECL_ALIASES`), so a * ported plugin that also has such an alias must be added to BOTH lists here — * kept in sync with config.go's PluginInfo.DeclNames (a Go test guards the drift). */ declare const NATIVE_PLUGINS: readonly ["@typescript-eslint", "import", "jest", "jsx-a11y", "promise", "react", "react-hooks", "unicorn"]; /** * Detailed information about an AST node */ export declare interface NodeInfo { id?: number; kind: number; kindName: string; pos: number; end: number; flags: number; flagNames?: string[]; text?: string; fileName?: string; parent?: NodeInfo; name?: NodeInfo; expression?: NodeInfo; left?: NodeInfo; right?: NodeInfo; operatorToken?: NodeInfo; operand?: NodeInfo; condition?: NodeInfo; whenTrue?: NodeInfo; whenFalse?: NodeInfo; thenStatement?: NodeInfo; elseStatement?: NodeInfo; body?: NodeInfo; initializer?: NodeInfo; type?: NodeInfo; members?: NodeInfo[]; heritageClauses?: NodeInfo[]; typeParameters?: NodeInfo[]; parameters?: NodeInfo[]; modifiers?: NodeInfo[]; arguments?: NodeInfo[]; statements?: NodeInfo[]; properties?: NodeInfo[]; elements?: NodeInfo[]; declarationList?: NodeInfo; declarations?: NodeInfo[]; importClause?: NodeInfo; moduleSpecifier?: NodeInfo; namedBindings?: NodeInfo; exportClause?: NodeInfo; incrementor?: NodeInfo; statement?: NodeInfo; caseBlock?: NodeInfo; clauses?: NodeInfo[]; tryBlock?: NodeInfo; catchClause?: NodeInfo; finallyBlock?: NodeInfo; variableDeclaration?: NodeInfo; block?: NodeInfo; argumentExpression?: NodeInfo; equalsToken?: NodeInfo; objectAssignmentInitializer?: NodeInfo; head?: NodeInfo; templateSpans?: NodeInfo[]; literal?: NodeInfo; tag?: NodeInfo; template?: NodeInfo; questionToken?: NodeInfo; dotDotDotToken?: NodeInfo; exclamationToken?: NodeInfo; asteriskToken?: NodeInfo; equalsGreaterThanToken?: NodeInfo; questionDotToken?: NodeInfo; typeArguments?: NodeInfo[]; constraint?: NodeInfo; defaultType?: NodeInfo; locals?: SymbolInfo[]; endOfFileToken?: NodeInfo; imports?: NodeInfo[]; isDeclarationFile?: boolean; scriptKind?: number; identifierCount?: number; symbolCount?: number; nodeCount?: number; listMetas?: Record; } /** * NodeList metadata (Pos, End, HasTrailingComma) */ declare interface NodeListMeta { pos: number; end: number; hasTrailingComma: boolean; } /** * Node.js implementation of RslintService using child processes */ export declare class NodeRslintService implements RslintServiceInterface { private nextMessageId; private readonly pendingMessages; private readonly rslintPath; private readonly process; private chunks; private chunkSize; private expectedSize; constructor(options?: RSlintOptions); /** * Send a message to the rslint process */ sendMessage(kind: string, data: any): Promise; /** * Handle incoming binary data chunks */ private handleChunk; /** * Handle a complete message from rslint */ private handleMessage; /** * Terminate the rslint process */ terminate(): void; } /** * Function parameter information (deprecated - use SymbolInfo instead) */ export declare interface ParameterInfo { name: string; type?: TypeInfo; optional: boolean; rest: boolean; } export declare interface ParserOptions { projectService?: boolean; project?: string[] | string; } /** * TypeScript parser options. `project` may be a single tsconfig path or a list. */ declare interface ParserOptions_2 { /** * Enable project service for typed linting (runs the TypeScript language * service behind the scenes). */ projectService?: boolean; /** * tsconfig.json path(s) used for typed linting. Glob patterns are supported. * * @example * project: './tsconfig.json' * @example * project: ['./tsconfig.app.json', './tsconfig.node.json'] * @example * project: ['./tsconfig.*.json'] */ project?: string | string[]; } /** * Shared types for rslint IPC protocol across all environments */ declare interface Position { line: number; column: number; } export declare const promisePlugin: { configs: { recommended: RslintConfigEntry; }; }; declare interface Range { start: Position; end: Position; } export declare const reactHooksPlugin: { configs: { recommended: RslintConfigEntry; }; }; export declare const reactPlugin: { configs: { recommended: RslintConfigEntry; }; }; /** Top-level rslint config: an array of entries. */ declare type RslintConfig = RslintConfigEntry[]; /** * A single entry in an rslint config array. Multiple entries may target * different file globs and are merged at lint time. */ export declare interface RslintConfigEntry { /** * Glob patterns for files this entry applies to. * * @example * files: ['src/**', 'tests/**'] */ files?: string[]; /** * Glob patterns excluded from this entry. * * @example * ignores: ['node_modules/**', 'dist/**'] */ ignores?: string[]; /** Language-level configuration (parser, etc.). */ languageOptions?: LanguageOptions_2; /** * Plugins enabled for this entry. Two forms: * * - **Array of names** — built-in (natively-ported) plugins, e.g. * `plugins: ['@typescript-eslint', 'unicorn']`. Built-in names are listed * for autocomplete; arbitrary strings are still accepted. Each built-in * maps to the ESLint plugin it ports rules from: * `'@typescript-eslint'` → `@typescript-eslint/eslint-plugin`, * `'import'` → `eslint-plugin-import`, `'jest'` → `eslint-plugin-jest`, * `'jsx-a11y'` → `eslint-plugin-jsx-a11y`, `'promise'` → `eslint-plugin-promise`, * `'react'` → `eslint-plugin-react`, `'react-hooks'` → `eslint-plugin-react-hooks`, * `'unicorn'` → `eslint-plugin-unicorn`. * * - **Object of plugin instances** — community ESLint plugins mounted by * prefix, e.g. `{ unicorn }` after `import unicorn from 'eslint-plugin-unicorn'`. * Their JS rule functions run in a Node worker; only `{prefix, ruleNames}` * metadata reaches the Go core. The live objects never cross the wire — the * worker re-imports this config file to obtain them, so local-path and * monorepo-versioned plugins resolve correctly. A prefix may not collide * with a built-in plugin name. * * A single entry uses one form. To combine built-in and community plugins, * declare them in separate config entries (merged at lint time). * * @example * plugins: ['@typescript-eslint', 'unicorn'] * @example * import unicorn from 'eslint-plugin-unicorn'; * export default [{ plugins: { unicorn }, rules: { 'unicorn/no-null': 'error' } }]; */ plugins?: (KnownPlugin | (string & {}))[] | Record; /** Shared settings accessible to rules. */ settings?: Record; /** Rule configuration map. */ rules?: RulesRecord; } export declare interface RSlintOptions { rslintPath?: string; workingDirectory?: string; } /** * Main RslintService class that automatically uses the appropriate implementation */ export declare class RSLintService { private readonly service; constructor(service: RslintServiceInterface); /** * Run the linter on specified files */ lint(options?: LintOptions): Promise; /** * Apply fixes to a file based on diagnostics */ applyFixes(options: ApplyFixesRequest): Promise; /** * Get detailed AST information at a specific position * Returns Node, Type, Symbol, Signature, and Flow information */ getAstInfo(options: GetAstInfoRequest): Promise; /** * Close the service */ close(): Promise; } export declare interface RslintServiceInterface { sendMessage(kind: string, data: any): Promise; terminate(): void; } /** * Configuration value accepted for a single rule. * * - `RuleSeverity` — just toggle the rule. * - `[RuleSeverity, ...args]` — ESLint-style array form. Most rules take a * single options object (`[severity, { ... }]`); some accept positional * string/object args (`[severity, "always", { ... }]`). * - `{ level, options }` — object form supported by the loader. */ declare type RuleEntry = RuleSeverity | readonly [RuleSeverity, ...any[]] | { level: RuleSeverity; options?: RuleOptions; }; /** * Rule-specific options object. Each rule defines its own shape; until per-rule * types are generated, options are accepted as an open record. */ declare type RuleOptions = Record; /** * Severity level for a rule. */ declare type RuleSeverity = 'off' | 'warn' | 'error'; /** * Map of rule name → rule configuration. Rule names are `string` (no * enumeration of known rules yet); the value shape is what gives editors * hints when typing the array or object form. */ declare type RulesRecord = Record; /** * Detailed information about a function/method signature */ export declare interface SignatureInfo { flags: number; flagNames?: string[]; minArgumentCount: number; pos?: number; fileName?: string; parameters?: SymbolInfo[]; thisParameter?: SymbolInfo; typeParameters?: TypeInfo[]; returnType?: TypeInfo; typePredicate?: TypePredicateInfo; declaration?: NodeInfo; } /** * Detailed information about a TypeScript symbol */ export declare interface SymbolInfo { id?: number; name: string; escapedName?: string; flags: number; flagNames?: string[]; checkFlags?: number; checkFlagNames?: string[]; pos?: number; fileName?: string; declarations?: NodeInfo[]; valueDeclaration?: NodeInfo; members?: SymbolInfo[]; exports?: SymbolInfo[]; } export declare const ts: { configs: { base: RslintConfigEntry; recommended: RslintConfigEntry; }; }; /** * Detailed information about a TypeScript type */ export declare interface TypeInfo { id?: number; flags: number; flagNames?: string[]; objectFlags?: number; objectFlagNames?: string[]; intrinsicName?: string; typeString: string; pos?: number; fileName?: string; value?: unknown; freshType?: TypeInfo; regularType?: TypeInfo; symbol?: SymbolInfo; aliasSymbol?: SymbolInfo; typeArguments?: TypeInfo[]; baseTypes?: TypeInfo[]; properties?: SymbolInfo[]; callSignatures?: SignatureInfo[]; constructSignatures?: SignatureInfo[]; indexInfos?: IndexInfo[]; types?: TypeInfo[]; constraint?: TypeInfo; default?: TypeInfo; target?: TypeInfo; } /** * Generic type parameter information */ export declare interface TypeParamInfo { name: string; constraint?: TypeInfo; default?: TypeInfo; } /** * Type predicate information for type guards */ export declare interface TypePredicateInfo { kind: number; kindName: string; parameterName?: string; parameterIndex?: number; type?: TypeInfo; } export declare const unicornPlugin: { configs: { recommended: RslintConfigEntry; }; }; export { }