Skip to content

Commit

Permalink
refactor(linter): use BigIntLiteral::raw field (#7660)
Browse files Browse the repository at this point in the history
No need to slice source text to get raw value of `BigIntLiteral`. It already has a `raw` field.
  • Loading branch information
overlookmotel committed Dec 5, 2024
1 parent 3711a8e commit a0973dc
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a0973dc

Please sign in to comment.