Pull.
J'ai juste update le cutie.js, CONNARD Ah oui, j'ai aussi add le info.js, qui est merdique d'ailleurs
This commit is contained in:
29
node_modules/eslint/lib/rules/no-loss-of-precision.js
generated
vendored
29
node_modules/eslint/lib/rules/no-loss-of-precision.js
generated
vendored
@@ -189,9 +189,32 @@ module.exports = {
|
||||
* @returns {boolean} true if they do not match
|
||||
*/
|
||||
function baseTenLosesPrecision(node) {
|
||||
const normalizedRawNumber = convertNumberToScientificNotation(
|
||||
getRaw(node),
|
||||
);
|
||||
const rawNumber = getRaw(node).toLowerCase();
|
||||
|
||||
/*
|
||||
* If trailing zeros equal the exponent, this is a valid representation
|
||||
* like "9.00e2" where 00 = 2 (meaning 9.00 * 10^2 = 900)
|
||||
* https://github.com/eslint/eslint/issues/19957
|
||||
*/
|
||||
if (rawNumber.includes(".") && rawNumber.includes("e")) {
|
||||
const parts = rawNumber.split("e");
|
||||
const coefficient = parts[0];
|
||||
const exponent = parseInt(parts[1], 10);
|
||||
|
||||
// Count trailing zeros after decimal
|
||||
const decimalParts = coefficient.split(".");
|
||||
if (decimalParts.length === 2) {
|
||||
const decimalPart = decimalParts[1];
|
||||
const trailingZeros = decimalPart.match(/0*$/u)[0].length;
|
||||
|
||||
if (trailingZeros === exponent) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const normalizedRawNumber =
|
||||
convertNumberToScientificNotation(rawNumber);
|
||||
const requestedPrecision = normalizedRawNumber
|
||||
.split("e")[0]
|
||||
.replace(".", "").length;
|
||||
|
||||
Reference in New Issue
Block a user