Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better report source line and col for multiline annotations #2242

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
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
Loading