Closed aljones15 closed 4 years ago
This seems ok? Are there any use cases where you would do precision loss on purpose? Do we have any code that would trigger this?
not sure if we have anywhere we don't want precision on the other hand we
do have code that triggers this such as in bedrock-payments
On Mon, Aug 24, 2020 at 1:25 PM David I. Lehn notifications@github.com wrote:
This seems ok? Are there any use cases where you would do precision loss on purpose? Do we have any code that would trigger this?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/digitalbazaar/eslint-config-digitalbazaar/issues/42#issuecomment-679261517, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACD6CHLBWG66ZYA2YNK5ZTSCKPA3ANCNFSM4QJQNMZQ .
-- Andrew Jones
Sounds like payment code is exactly where you would want to know of problems.
PR was merged closing this.
https://eslint.org/docs/rules/no-loss-of-precision
We do regularly deal with large numbers and this rule errors when a number exceeds the maximum number of digits javascript can safely store it in. The solution is to store the number as Hex or possibly as a BigInt using the newer es2020 syntax. We do need to ensure that BigInts do not set off this rule first.
Proposal: