New Rule: `no-new-bigint`
See original GitHub issueRule details
Restricts calling BigInt
with new
like no-new-symbol
Related ECMAScript feature
What type of rule is this?
Warns about a potential problem
Example code
// valid
const a = BigInt(9007199254740991);
// invalid
const b = new BigInt(9007199254740991);
Why should this rule be in the core instead of a plugin?
BigInt
is a core feature of ECMAScript, also ESLint have no-new-symbol
already.
Participation
- I am willing to submit a pull request to implement this rule.
Additional comments
No response
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Rule Request: Disallow native bigint operations on polyfilled ...
The only feasible solution here is to have a lint rule to not use the native bigint operations. Essentially changing the meaning of...
Read more >BigInt - JavaScript - MDN Web Docs
BigInt values represent numeric values which are too large to be represented by the number primitive.
Read more >The Essential Guide To JavaScript's Newest Data Type: BigInt
BigInt is a new data type intended for use when integer values are larger than the range supported by the Number data type....
Read more >jsonc/no-bigint-literals | eslint-plugin-jsonc
This rule reports the use of BigInt literals. JSON, JSONC and JSON5 do not allow BigInt literals. 1. 2.
Read more >18 Bigints – arbitrary-precision integers [ES2020] (advanced)
Bigint is a new primitive data type for integers. ... The reason for this rule is that there is no general way of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree. If we want to warn on
new BigInt
, then it might be better to add a rule that would warn on all ES globals that start with an uppercase letter but are not constructors (except those that are not functions, because they are included inno-obj-calls
). It would includenew Symbol
, so theno-new-symbol
rule would be deprecated.I prefer
no-new-nonconstructor
.