Bump eslint-plugin-import to avoid vulnerability in dependency

This commit is contained in:
Henry Mercer 2023-01-18 20:26:59 +00:00
parent 10695e6a20
commit ed9506bbaf
1660 changed files with 67726 additions and 27926 deletions

View file

@ -6,16 +6,19 @@ var $Number = GetIntrinsic('%Number%');
var $TypeError = GetIntrinsic('%TypeError%');
var $isNaN = require('../helpers/isNaN');
var $isFinite = require('../helpers/isFinite');
var isPrefixOf = require('../helpers/isPrefixOf');
var ToNumber = require('./ToNumber');
var IsStringPrefix = require('./IsStringPrefix');
var StringToBigInt = require('./StringToBigInt');
var ToNumeric = require('./ToNumeric');
var ToPrimitive = require('./ToPrimitive');
var Type = require('./Type');
// https://262.ecma-international.org/5.1/#sec-11.8.5
var BigIntLessThan = require('./BigInt/lessThan');
var NumberLessThan = require('./Number/lessThan');
// eslint-disable-next-line max-statements
// https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison
// eslint-disable-next-line max-statements, max-lines-per-function
module.exports = function AbstractRelationalComparison(x, y, LeftFirst) {
if (Type(LeftFirst) !== 'Boolean') {
throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean');
@ -29,35 +32,51 @@ module.exports = function AbstractRelationalComparison(x, y, LeftFirst) {
py = ToPrimitive(y, $Number);
px = ToPrimitive(x, $Number);
}
var bothStrings = Type(px) === 'String' && Type(py) === 'String';
if (!bothStrings) {
var nx = ToNumber(px);
var ny = ToNumber(py);
if ($isNaN(nx) || $isNaN(ny)) {
return undefined;
}
if ($isFinite(nx) && $isFinite(ny) && nx === ny) {
if (Type(px) === 'String' && Type(py) === 'String') {
if (IsStringPrefix(py, px)) {
return false;
}
if (nx === Infinity) {
return false;
}
if (ny === Infinity) {
if (IsStringPrefix(px, py)) {
return true;
}
if (ny === -Infinity) {
return false;
}
if (nx === -Infinity) {
return true;
}
return nx < ny; // by now, these are both nonzero, finite, and not equal
return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f
}
if (isPrefixOf(py, px)) {
return false;
var pxType = Type(px);
var pyType = Type(py);
var nx;
var ny;
if (pxType === 'BigInt' && pyType === 'String') {
ny = StringToBigInt(py);
if ($isNaN(ny)) {
return void undefined;
}
return BigIntLessThan(px, ny);
}
if (isPrefixOf(px, py)) {
if (pxType === 'String' && pyType === 'BigInt') {
nx = StringToBigInt(px);
if ($isNaN(nx)) {
return void undefined;
}
return BigIntLessThan(nx, py);
}
nx = ToNumeric(px);
ny = ToNumeric(py);
var nxType = Type(nx);
if (nxType === Type(ny)) {
return nxType === 'Number' ? NumberLessThan(nx, ny) : BigIntLessThan(nx, ny);
}
if ($isNaN(nx) || $isNaN(ny)) {
return void undefined;
}
if (nx === -Infinity || ny === Infinity) {
return true;
}
return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f
if (nx === Infinity || ny === -Infinity) {
return false;
}
return nx < ny; // by now, these are both nonzero, finite, and not equal
};