mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(linter): jest/valid-title fixer to use Span::shrink method (#6703)
Used shrink apis from span
This commit is contained in:
parent
902a3d0495
commit
29c14474ff
1 changed files with 2 additions and 3 deletions
|
|
@ -302,8 +302,7 @@ fn validate_title(
|
|||
if !valid_title.ignore_space && trimmed_title != title {
|
||||
let (error, help) = Message::AccidentalSpace.detail();
|
||||
ctx.diagnostic_with_fix(valid_title_diagnostic(error, help, span), |fixer| {
|
||||
let target_span = Span::new(span.start + 1, span.end - 1);
|
||||
fixer.replace(target_span, trimmed_title.to_string())
|
||||
fixer.replace(span.shrink(1), trimmed_title.to_string())
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -316,7 +315,7 @@ fn validate_title(
|
|||
let (error, help) = Message::DuplicatePrefix.detail();
|
||||
ctx.diagnostic_with_fix(valid_title_diagnostic(error, help, span), |fixer| {
|
||||
let replaced_title = title[first_word.len()..].trim().to_string();
|
||||
fixer.replace(span.shrink_left(1).shrink_right(1), replaced_title)
|
||||
fixer.replace(span.shrink(1), replaced_title)
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue