diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-12-17 16:00:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-17 16:00:33 -0500 |
commit | f2c9cc500c84a3c6051823cd3ae33d6b4c1f6266 (patch) | |
tree | 89d66389f526b65803b3345c8406ebf6bf967704 | |
parent | 738e80a0da5f23eed33d8c4937cf34b0535cd17a (diff) |
fix(lint): column number for pretty reporting was off by 1 (#17107)
Closes #17086
-rw-r--r-- | cli/tests/testdata/lint/expected_quiet.out | 4 | ||||
-rw-r--r-- | cli/tests/testdata/lint/with_config.out | 4 | ||||
-rw-r--r-- | cli/tests/testdata/lint/with_config_and_flags.out | 4 | ||||
-rw-r--r-- | cli/tests/testdata/lint/with_config_without_tags.out | 4 | ||||
-rw-r--r-- | cli/tools/lint.rs | 8 |
5 files changed, 13 insertions, 11 deletions
diff --git a/cli/tests/testdata/lint/expected_quiet.out b/cli/tests/testdata/lint/expected_quiet.out index d7c9d7bb9..7a2ef48e6 100644 --- a/cli/tests/testdata/lint/expected_quiet.out +++ b/cli/tests/testdata/lint/expected_quiet.out @@ -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] diff --git a/cli/tests/testdata/lint/with_config.out b/cli/tests/testdata/lint/with_config.out index ea4581af8..2ea821c05 100644 --- a/cli/tests/testdata/lint/with_config.out +++ b/cli/tests/testdata/lint/with_config.out @@ -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 diff --git a/cli/tests/testdata/lint/with_config_and_flags.out b/cli/tests/testdata/lint/with_config_and_flags.out index 0a409343e..41432df9d 100644 --- a/cli/tests/testdata/lint/with_config_and_flags.out +++ b/cli/tests/testdata/lint/with_config_and_flags.out @@ -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 diff --git a/cli/tests/testdata/lint/with_config_without_tags.out b/cli/tests/testdata/lint/with_config_without_tags.out index ea4581af8..2ea821c05 100644 --- a/cli/tests/testdata/lint/with_config_without_tags.out +++ b/cli/tests/testdata/lint/with_config_without_tags.out @@ -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 diff --git a/cli/tools/lint.rs b/cli/tools/lint.rs index 1b2487e4c..9925c3273 100644 --- a/cli/tools/lint.rs +++ b/cli/tools/lint.rs @@ -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), )), ); |