Skip to content

Commit

Permalink
fix(lint/useSimpleNumberKeys): ignore comments (#957)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalleep authored Nov 29, 2023
1 parent dcc681e commit 2baec67
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 117 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom

#### Bug fixes

- Fix [#918](https://github.com/biomejs/biome/issues/918), [useSimpleNumberKeys](https://biomejs.dev/linter/rules/use-simple-number-keys) no longer repports false positive on comments. Contributed by @kalleep

### Parser

## 1.4.0 (2023-11-27)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::JsRuleAction;

use biome_analyze::{
context::RuleContext, declare_rule, ActionCategory, Ast, FixKind, Rule, RuleDiagnostic,
};
Expand Down Expand Up @@ -101,7 +102,7 @@ impl TryFrom<AnyJsObjectMember> for NumberLiteral {
let token = literal_member_name.value().unwrap();
match token.kind() {
JsSyntaxKind::JS_NUMBER_LITERAL | JsSyntaxKind::JS_BIGINT_LITERAL => {
let chars: Vec<char> = token.to_string().chars().collect();
let chars: Vec<char> = token.text_trimmed().chars().collect();
let mut value = String::new();

let mut is_first_char_zero: bool = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
({ 1n: 1 });
({ 0x1: 1 });
({
0x1: 1
});
({ 0o12: 1 });
({ 0b1: 1 });
({ 0o1: 1 });
Expand Down
Loading

0 comments on commit 2baec67

Please sign in to comment.