Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion apps/oxlint/src-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ export type * as ESTree from './generated/types.d.ts';
export type { Context, LanguageOptions } from './plugins/context.ts';
export type { Fix, Fixer, FixFn } from './plugins/fix.ts';
export type { CreateOnceRule, CreateRule, Plugin, Rule } from './plugins/load.ts';
export type { Diagnostic, DiagnosticBase, DiagnosticWithLoc, DiagnosticWithNode } from './plugins/report.ts';
export type {
Diagnostic,
DiagnosticBase,
DiagnosticWithLoc,
DiagnosticWithNode,
Suggestion,
SuggestionBase,
SuggestionWithDescription,
SuggestionWithMessageId,
} from './plugins/report.ts';
export type {
Definition,
DefinitionType,
Expand Down
20 changes: 20 additions & 0 deletions apps/oxlint/src-js/plugins/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface DiagnosticBase {
messageId?: string | null | undefined;
data?: Record<string, string | number> | null | undefined;
fix?: FixFn;
suggest?: Suggestion[];
}

export interface DiagnosticWithNode extends DiagnosticBase {
Expand All @@ -35,6 +36,25 @@ export interface DiagnosticWithLoc extends DiagnosticBase {
loc: Location;
}

/**
* Suggested fix.
* NOT IMPLEMENTED YET.
*/
export type Suggestion = SuggestionWithDescription | SuggestionWithMessageId;

export interface SuggestionBase {
fix: FixFn;
data?: Record<string, string | number> | null | undefined;
}

export interface SuggestionWithDescription extends SuggestionBase {
desc: string;
}

export interface SuggestionWithMessageId extends SuggestionBase {
messageId: string;
}

// Diagnostic in form sent to Rust
interface DiagnosticReport {
message: string;
Expand Down
Loading