question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Prefer Number methods to their Global counterparts

See original GitHub issue

Please describe what the rule should do: This rule will enforce the use of the modularized versions of parseInt, parseFloat and isNaN.

What category of rule is this? (place an “X” next to just one item)

[ ] Enforces code style [x] Warns about a potential error [ ] Suggests an alternate way of doing something [ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

isNaN(foo); // warn
parseInt(foo); // warn
parseFloat(foo); // warn
Number.isNaN(foo); // fine
Number.parseInt(foo); // fine
Number.parseFloat(foo); // fine

Why should this rule be included in ESLint (instead of a plugin)? From MDN: The purpose of Number.parseInt and Number.parseFloat is “modularization of globals”. At the same time Number.NaN is “more robust”. This rule should be part of the Ecmascript 6 rules subset.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kirly-afcommented, Jul 8, 2017

Also this rule might be auto “fixable”.

0reactions
platinumazurecommented, Nov 3, 2017

@kirly-af By the way, no-restricted-globals now supports custom messages, so you could use it and specify whatever message you want. Hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic components of a proposal | Foundation Relations
Basic components of a proposal · Show your budget in table form and use a budget narrative to explain each item. · Only...
Read more >
Change the Way You Persuade - Harvard Business Review
In our experience, people can vastly improve their chances of having their proposals succeed by determining who the chief decision maker is among...
Read more >
43 RFP Statistics on Win Rates & Proposal Management
Wondering how to become a top-performing responder? Here are 43 benchmarks to help you win more bids and improve your process.
Read more >
Unit 7 Proposals – Professional and Technical Writing
Employ your writing and reasoning skills to make a difference in the world. View samples and write a proposal to conduct research, develop...
Read more >
Advice on Writing Proposals - particularly to NSF
It includes some guidelines on how to write an NSF proposal and how to get ... you are calling about a proposal or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found