-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
If we can't safely use `parseInt(foo)` everywhere, we should probably use it nowhere. Let's just use `parseInt(foo, 10)` consistently. See: https://eslint.org/docs/rules/radix
Hey @wincent, where can't we use |
It's less important now that we're using Babel on "everything", but passing a base is the safe default as explained on MDN:
I'm thinking that because we don't necessarily know when or where code will be backported (for example to a branch where Babel isn't running on everything) that it's safest to just always require it. On the other hand, if you feel sure that we'll never ever run in such an environment, we can actually flip the rule to enforce the opposite. Either way though, it would be nice to have a rule that does this for us so that we don't have to think about it on a case-by-case basis. |
Makes sense, let's write this down somewhere. I agree that enforcing radix seems safer for us at the moment. |
For me the most natural thing to do if I want to know why a particular rule is in force would be to |
In follow-up to: #66 (comment)
In follow-up to: #66 (comment)
Grab the latest version of eslint-config-liferay, which brings: liferay/eslint-config-liferay#66 And also various liferay-js-toolkit packages, motivated because we want to get this change into liferay-portal: liferay/liferay-js-toolkit#380
If we can't safely use
parseInt(foo)
everywhere, we should probably use it nowhere. Let's just useparseInt(foo, 10)
consistently.See: https://eslint.org/docs/rules/radix