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
8 changes: 6 additions & 2 deletions apps/oxlint/src-js/plugins/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ interface Diagnostic {
// Diagnostic in form sent to Rust
interface DiagnosticReport {
message: string;
loc: { start: number; end: number };
start: number;
end: number;
ruleIndex: number;
}

Expand Down Expand Up @@ -115,9 +116,12 @@ export class Context {
*/
report(diagnostic: Diagnostic): void {
const { ruleIndex } = getInternal(this, 'report errors');
// TODO: Validate `diagnostic`
const { node } = diagnostic;
diagnostics.push({
message: diagnostic.message,
loc: { start: diagnostic.node.start, end: diagnostic.node.end },
start: node.start,
end: node.end,
ruleIndex,
});
}
Expand Down
5 changes: 0 additions & 5 deletions crates/oxc_linter/src/external_linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ pub enum PluginLoadResult {
pub struct LintFileResult {
pub rule_index: u32,
pub message: String,
pub loc: Loc,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Loc {
pub start: u32,
pub end: u32,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ impl Linter {
Ok(diagnostics) => {
for diagnostic in diagnostics {
// Convert UTF-16 offsets back to UTF-8
let mut span = Span::new(diagnostic.loc.start, diagnostic.loc.end);
let mut span = Span::new(diagnostic.start, diagnostic.end);
span_converter.convert_span_back(&mut span);

let (external_rule_id, severity) =
Expand Down
Loading