mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
fix(lint): column number for pretty reporting was off by 1 (#17107)
Closes #17086
This commit is contained in:
parent
738e80a0da
commit
f2c9cc500c
5 changed files with 13 additions and 11 deletions
4
cli/tests/testdata/lint/expected_quiet.out
vendored
4
cli/tests/testdata/lint/expected_quiet.out
vendored
|
@ -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]
|
||||
|
||||
|
|
4
cli/tests/testdata/lint/with_config.out
vendored
4
cli/tests/testdata/lint/with_config.out
vendored
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
)),
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue