-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Add prefer-math-trunc
rule
#851
Conversation
I have a question: What to do with variables (or member expressions)? The fix can break one's code because |
The rule name could be improved though:
|
I like |
I renamed the rule and adressed all reviews :) |
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.
Please add some cases that have comments inside or around. Also some parenthesized cases.
Nice work, @noftaly 👍🏻 |
Added
prefer-math-trunc
rule, which forbids the use of| 0
overMath.trunc()
to truncate numbers.One thing i'm not really sure about is the error message. It says not to use
| 0
to truncate numbers, but maybe it should say no to usebitwise OR with 0
? Idk, let me know what you think of.Fixes #827