-
Notifications
You must be signed in to change notification settings - Fork 529
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
New Rule: Unnecessary Mantissa #438
Comments
Per our rule naming conventions, if this is a strict disallow it should be named: no-disallowed-thing In addition, we prefer as simple language as possible, so instead of the technical mantissa I'd prefer decimal (or similar) so the rule name should be something like no-unnecessary-decimals Otherwise, yah, I'm ok with adding this rule.
|
I honestly thought no trailing zero should (and did cover this) In my head it should but yeah it actually makes sense to have this as a separate rule. no-unnecessary-decimals would be the name i would go for too. |
Looking at this a bit more, it might actually make sense to modify What would you think about updating that rule, or should this be considered separate (or perhaps an option)? Edit: Hooray! I'm really bad at catching comments, because I definitely didn't see @DanPurdy's comment above before I wrote this (as I only saw the email). But if it makes sense to have this as a separate rule, I'll definitely do that, then. As for catching it in |
Yeah definitely, our whole ethos with With this as a separate rule it would allow people to enforce usage of requiring at least one zero after a decimal but not unneccessary trailing zeros after that. And yes @Dru89 you're right, after I posted that comment last night I checked our existing rule and it does only work if you have at least one non zero number. I'll create another issue now. Happy for you to submit a PR for your new rule though. Thanks again! |
I see a potential lint loop here if you require the ending zero and also have no trailing zeros enabled. Thoughts Dan?
|
Yeah, I think that's a possibility, maybe we should keep it in Sooooo update the rule rather than a new one? |
just came here to say that i love the expression "mantissa" |
Yah, update the rule I think.
|
Yarp |
I agree with fixing the existing rule. |
Name:
unnecessary-mantissa
Add a rule that enforces that removal of all unnecessary trailing decimal points (e.g.
4.0
should be written as4
).I was a little ambitious and have already written the code to complete this as
a7db54b
but will wait to submit the pull request as per the contributing guidelines.The text was updated successfully, but these errors were encountered: