fix(lint): column number for pretty reporting was off by 1 (#17107)

Closes #17086
This commit is contained in:
David Sherret 2022-12-17 16:00:33 -05:00 committed by GitHub
parent 738e80a0da
commit f2c9cc500c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 11 deletions

View file

@ -1,14 +1,14 @@
(ban-untagged-ignore) Ignore directive requires lint rule name(s)
// deno-lint-ignore
^^^^^^^^^^^^^^^^^^^
at [WILDCARD]file1.js:1:0
at [WILDCARD]file1.js:1:1
hint: [WILDCARD]
(no-empty) Empty block statement
while (false) {}
^^
at [WILDCARD]file1.js:2:14
at [WILDCARD]file1.js:2:15
hint: [WILDCARD]

View file

@ -1,7 +1,7 @@
(ban-untagged-todo) TODO should be tagged with (@username) or (#issue)
// TODO: foo
^^^^^^^^^^^^
at [WILDCARD]a.ts:1:0
at [WILDCARD]a.ts:1:1
hint: Add a user tag or issue reference to the TODO comment, e.g. TODO(@djones), TODO(djones), TODO(#123)
help: for further information visit https://lint.deno.land/#ban-untagged-todo
@ -9,7 +9,7 @@
(no-unused-vars) `add` is never used
function add(a: number, b: number): number {
^^^
at [WILDCARD]a.ts:2:9
at [WILDCARD]a.ts:2:10
hint: If this is intentional, prefix it with an underscore like `_add`
help: for further information visit https://lint.deno.land/#no-unused-vars

View file

@ -1,7 +1,7 @@
(ban-untagged-todo) TODO should be tagged with (@username) or (#issue)
// TODO: this file should be ignored
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at [WILDCARD]b.ts:1:0
at [WILDCARD]b.ts:1:1
hint: Add a user tag or issue reference to the TODO comment, e.g. TODO(@djones), TODO(djones), TODO(#123)
help: for further information visit https://lint.deno.land/#ban-untagged-todo
@ -9,7 +9,7 @@
(no-unused-vars) `subtract` is never used
function subtract(a: number, b: number): number {
^^^^^^^^
at [WILDCARD]b.ts:2:9
at [WILDCARD]b.ts:2:10
hint: If this is intentional, prefix it with an underscore like `_subtract`
help: for further information visit https://lint.deno.land/#no-unused-vars

View file

@ -1,7 +1,7 @@
(ban-untagged-todo) TODO should be tagged with (@username) or (#issue)
// TODO: foo
^^^^^^^^^^^^
at [WILDCARD]a.ts:1:0
at [WILDCARD]a.ts:1:1
hint: Add a user tag or issue reference to the TODO comment, e.g. TODO(@djones), TODO(djones), TODO(#123)
help: for further information visit https://lint.deno.land/#ban-untagged-todo
@ -9,7 +9,7 @@
(no-unused-vars) `add` is never used
function add(a: number, b: number): number {
^^^
at [WILDCARD]a.ts:2:9
at [WILDCARD]a.ts:2:10
hint: If this is intentional, prefix it with an underscore like `_add`
help: for further information visit https://lint.deno.land/#no-unused-vars

View file

@ -413,9 +413,11 @@ impl LintReporter for PrettyLintReporter {
d.hint.as_ref(),
&format_location(&JsStackFrame::from_location(
Some(d.filename.clone()),
Some(d.range.start.line_index as i64 + 1), // 1-indexed
// todo(#11111): make 1-indexed as well
Some(d.range.start.column_index as i64),
// todo(dsherret): these should use "display positions"
// which take into account the added column index of tab
// indentation
Some(d.range.start.line_index as i64 + 1),
Some(d.range.start.column_index as i64 + 1),
)),
);