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

Don't prefer number properties for Infinity by default #2311

Open
Richienb opened this issue Apr 6, 2024 · 5 comments
Open

Don't prefer number properties for Infinity by default #2311

Richienb opened this issue Apr 6, 2024 · 5 comments

Comments

@Richienb
Copy link
Contributor

Richienb commented Apr 6, 2024

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.

@sindresorhus
Copy link
Owner

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.

@Richienb
Copy link
Contributor Author

Richienb commented Apr 6, 2024

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

@sindresorhus
Copy link
Owner

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

Prefer Number static properties over global ones.

@Richienb
Copy link
Contributor Author

Richienb commented Apr 8, 2024

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

@Richienb
Copy link
Contributor Author

Richienb commented Apr 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants