-
-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement useParseIntRadix
- eslint/radix
(#3932)
#4524
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Left you some comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to run cargo insta accept
to accept the snapshots. These .snap.new
files should be just .snap
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... there isn't an example in here for it.
#[derive(Debug, Default, Clone, Serialize, Deserialize, Deserializable, PartialEq, Eq)] | ||
#[cfg_attr(feature = "schemars", derive(JsonSchema))] | ||
#[serde(rename_all = "camelCase", deny_unknown_fields, default)] | ||
pub struct UseParseIntRadixOptions { | ||
#[serde(default)] | ||
pub behavior: Behavior, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually avoid adding options on the first iteration of new rules to avoid inheriting complexity. We usually wait to add options until users have a use case for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, makes sense. I just figured I'd make it as close to the ESLint implementation as possible. Should I remove it completely or should I comment it out?
# Diagnostics | ||
``` | ||
invalid.js:1:11 lint/nursery/useParseIntRadix FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
! Missing radix parameter | ||
|
||
> 1 │ var num = parseInt("071"); | ||
│ ^^^^^^^^^^^^^^^ | ||
2 │ | ||
3 │ var num = parseInt(someValue); | ||
|
||
i Add a non-fractional number between 2 and 36 | ||
|
||
i Unsafe fix: Remove add a radix of 10 | ||
|
||
1 │ var·num·=·parseInt("071",·10); | ||
│ ++++ | ||
|
||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to follow the rule pillars for writing good diagnostics: https://github.com/biomejs/biome/blob/main/crates/biome_analyze/CONTRIBUTING.md#explain-a-rule-to-the-user
), | ||
); | ||
|
||
(args, markup! { "Remove add a radix of 10" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a typo in this message.
CodSpeed Performance ReportMerging #4524 will not alter performanceComparing Summary
Benchmarks breakdown
|
useParseIntRadix
- eslint/radix
(#3932)useParseIntRadix
- eslint/radix
(#3932)
useParseIntRadix
- eslint/radix
(#3932)useParseIntRadix
- eslint/radix
(#3932)
useParseIntRadix
- eslint/radix
(#3932)useParseIntRadix
- eslint/radix
(#3932)
Summary
Implemented eslint/radix.
closes #3932