fix(linter/typescript/no-namespace): bound token lookup (#25321)

## Summary
Bound the `no-namespace` keyword lookup to the declaration span.

## Details
- Use `find_next_token_within` when locating the reported namespace keyword.
- Preserve the existing diagnostic span calculation.
This commit is contained in:
camc314 committed 2026-08-05 21:39:30 +00:00
1 parent ccb8fe89db
commit 4745b4e2f9
1 file changed
+2 -1
@@ -142,7 +142,8 @@ impl Rule for NoNamespace {
let keyword = declaration.kind.as_str();
let mut span_start = declaration.span.start;
span_start += ctx.find_next_token_from(span_start, keyword).unwrap();
span_start +=
ctx.find_next_token_within(span_start, declaration.span.end, keyword).unwrap();
#[expect(clippy::cast_possible_truncation)]
let span = Span::sized(span_start, keyword.len() as u32);
ctx.diagnostic(no_namespace_diagnostic(span));