sindresorhus / eslint-plugin-unicorn

More than 100 powerful ESLint rules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't prefer number properties for Infinity by default

Richienb opened this issue · comments

We were discussing this on the tc39 forums... I don't think the consistency is worth it.

Infinity and -Infinity require less cognitive load and are easier to write than Number.POSITIVE_INFINTY and Number.NEGATIVE_INFINITY.

Yeah, after using the rule for a while, I agree that it does not provide any benefits. I think we can change the default for the checkInfinity option in the next version. However, it would be nice then to have a rule to prefer Infinity over Number.POSITIVE_INFINITY.

Perhaps we replace checkInfinity with a new option preferInfinityProperties where we explicitly enforce it?

It doesn't really fit the rule. The rule description is:

Prefer Number static properties over global ones.

Maybe we could rename the rule from prefer-number-properties to just number-properties?

Maybe in the future we could also stop preferring Number.NaN over NaN? Wondering what your thoughts are.