Skip to content
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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Jantje19
Copy link

@Jantje19 Jantje19 commented Nov 13, 2024

Summary

Implemented eslint/radix.

closes #3932

@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Diagnostic Area: diagnostocis labels Nov 13, 2024
Copy link
Contributor

@dyc3 dyc3 left a 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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Comment on lines +191 to +197
#[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,
}
Copy link
Contributor

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.

Copy link
Author

@Jantje19 Jantje19 Nov 17, 2024

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?

Comment on lines 28 to 46
# 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);
│ ++++

```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

),
);

(args, markup! { "Remove add a radix of 10" })
Copy link
Contributor

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.

Copy link

codspeed-hq bot commented Nov 13, 2024

CodSpeed Performance Report

Merging #4524 will not alter performance

Comparing Jantje19:main (4d3d105) with main (9611497)

Summary

✅ 95 untouched benchmarks
🆕 2 new benchmarks

Benchmarks breakdown

Benchmark main Jantje19:main Change
🆕 typescript_5583633924076080079.js[cached] N/A 937.4 ms N/A
🆕 typescript_5583633924076080079.js[uncached] N/A 1 s N/A

@Jantje19 Jantje19 changed the title Implement useParseIntRadix - eslint/radix (#3932) (feat) Implement useParseIntRadix - eslint/radix (#3932) Nov 15, 2024
@Jantje19 Jantje19 changed the title (feat) Implement useParseIntRadix - eslint/radix (#3932) feat: Implement useParseIntRadix - eslint/radix (#3932) Nov 15, 2024
@Jantje19 Jantje19 changed the title feat: Implement useParseIntRadix - eslint/radix (#3932) feat: implement useParseIntRadix - eslint/radix (#3932) Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Diagnostic Area: diagnostocis A-Linter Area: linter A-Project Area: project L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

📎 Implement useParseIntRadix - eslint/radix
2 participants