refactor(linter): use BigIntLiteral::raw field (#7660)

No need to slice source text to get raw value of `BigIntLiteral`. It already has a `raw` field.
This commit is contained in:
overlookmotel 2024-12-05 04:23:14 +00:00
parent 3711a8e342
commit a0973dcb5a

View file

@ -101,13 +101,11 @@ impl Rule for NumericSeparatorsStyle {
}
}
AstKind::BigIntLiteral(number) => {
let raw = number.span.source_text(ctx.source_text());
if self.only_if_contains_separator && !raw.contains('_') {
if self.only_if_contains_separator && !number.raw.contains('_') {
return;
}
let formatted = self.format_bigint(number, raw);
let formatted = self.format_bigint(number, &number.raw);
if formatted.len() != number.span.size() as usize {
ctx.diagnostic_with_fix(