Skip to content

Commit

Permalink
Better source line- and column-numbers for multi-line annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
maurice authored and Boshen committed Feb 1, 2024
1 parent 9bbdec1 commit 2eca26c
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 87 deletions.
2 changes: 1 addition & 1 deletion crates/oxc_diagnostics/src/graphic_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ impl GraphicalReportHandler {
.find_map(|hl| {
lines
.iter()
.find(|line| line.span_applies(hl) && line.span_line_only(hl))
.find(|line| line.span_applies(hl))
.map(|line| (line.line_number, self.visual_offset(line, hl.offset()) + 1))
})
.unwrap_or_else(|| (contents.line() + 1, contents.column() + 1));
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/snapshots/array_callback_return.snap
Original file line number Diff line number Diff line change
Expand Up @@ -743,14 +743,14 @@ expression: array_callback_return
help: Array method "Array.from" needs to have valid return on all code paths

eslint(array-callback-return): Missing return on some path for array method "Array.prototype.filter"
╭─[array_callback_return.tsx:1:1]
╭─[array_callback_return.tsx:1:27]
1 │ ╭─▶ foo.filter(function bar() { return
2 │ ╰─▶ })
╰────
help: Array method "Array.prototype.filter" needs to have valid return on all code paths

eslint(array-callback-return): Unexpected return for array method Array.prototype.forEach
╭─[array_callback_return.tsx:1:1]
╭─[array_callback_return.tsx:1:25]
1 │ ╭─▶ foo.forEach(function () {
2 │ │ if (baz) return bar
3 │ │ else return
Expand Down
8 changes: 4 additions & 4 deletions crates/oxc_linter/src/snapshots/ban_ts_comment.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ expression: ban_ts_comment
╰────

Do not use @ts-expect-error because it alters compilation errors.
╭─[ban_ts_comment.tsx:1:1]
╭─[ban_ts_comment.tsx:2:3]
1
2 │ ╭─▶ /*
3 │ ╰─▶ @ts-expect-error
Expand Down Expand Up @@ -93,7 +93,7 @@ expression: ban_ts_comment
╰────

Do not use @ts-ignore because it alters compilation errors.
╭─[ban_ts_comment.tsx:1:1]
╭─[ban_ts_comment.tsx:2:3]
1
2 │ ╭─▶ /*
3 │ ╰─▶ @ts-ignore
Expand Down Expand Up @@ -170,7 +170,7 @@ expression: ban_ts_comment
╰────

Do not use @ts-nocheck because it alters compilation errors.
╭─[ban_ts_comment.tsx:1:1]
╭─[ban_ts_comment.tsx:2:3]
1
2 │ ╭─▶ /*
3 │ ╰─▶ @ts-nocheck
Expand Down Expand Up @@ -235,7 +235,7 @@ expression: ban_ts_comment
╰────

Do not use @ts-check because it alters compilation errors.
╭─[ban_ts_comment.tsx:1:1]
╭─[ban_ts_comment.tsx:2:3]
1
2 │ ╭─▶ /*
3 │ ╰─▶ @ts-check
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/snapshots/ban_types.snap
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ expression: ban_types
╰────

typescript-eslint(ban-types): Prefer explicitly define the object shape
╭─[ban_types.tsx:1:1]
╭─[ban_types.tsx:1:17]
1 │ ╭─▶ const emptyObj: {
2 │ │
3 │ ╰─▶ } = {foo: "bar"};
Expand Down
Loading

0 comments on commit 2eca26c

Please sign in to comment.