Skip to content
Merged
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
9 changes: 9 additions & 0 deletions apps/oxlint/src-js/plugins/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ interface InternalContext {
ruleIndex: number;
// Absolute path of file being linted
filePath: string;
// Options
options: unknown[];
}

/**
Expand All @@ -65,6 +67,7 @@ export class Context {
id: fullRuleName,
filePath: '',
ruleIndex: 0,
options: [],
};
}

Expand All @@ -84,6 +87,11 @@ export class Context {
return this.#internal.filePath;
}

// Getter for options for file being linted.
get options() {
return this.#internal.options;
}

/**
* Report error.
* @param diagnostic - Diagnostic object
Expand All @@ -98,6 +106,7 @@ export class Context {

static {
setupContextForFile = (context, ruleIndex, filePath) => {
// TODO: Support `options`
const internal = context.#internal;
internal.ruleIndex = ruleIndex;
internal.filePath = filePath;
Expand Down
Loading