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

@ -1,17 +1,15 @@
'use strict';
var hasPropertyDescriptors = require('has-property-descriptors');
var GetIntrinsic = require('get-intrinsic');
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
var $defineProperty = hasPropertyDescriptors() && GetIntrinsic('%Object.defineProperty%', true);
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = null;
}
}
var hasArrayLengthDefineBug = hasPropertyDescriptors.hasArrayLengthDefineBug();
// eslint-disable-next-line global-require
var isArray = hasArrayLengthDefineBug && require('../helpers/IsArray');
var callBound = require('call-bind/callBound');
@ -40,6 +38,18 @@ module.exports = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPro
O[P] = V; // will use [[Define]]
return SameValue(O[P], V);
}
if (
hasArrayLengthDefineBug
&& P === 'length'
&& '[[Value]]' in desc
&& isArray(O)
&& O.length !== desc['[[Value]]']
) {
// eslint-disable-next-line no-param-reassign
O.length = desc['[[Value]]'];
return O.length === desc['[[Value]]'];
}
$defineProperty(O, P, FromPropertyDescriptor(desc));
return true;
};

12
node_modules/es-abstract/helpers/IsArray.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $Array = GetIntrinsic('%Array%');
// eslint-disable-next-line global-require
var toStr = !$Array.isArray && require('call-bind/callBound')('Object.prototype.toString');
module.exports = $Array.isArray || function IsArray(argument) {
return toStr(argument) === '[object Array]';
};

View file

@ -7,12 +7,11 @@ var $SyntaxError = GetIntrinsic('%SyntaxError%');
var has = require('has');
var isMatchRecord = require('./isMatchRecord');
var predicates = {
// https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type
'Property Descriptor': function isPropertyDescriptor(Type, Desc) {
if (Type(Desc) !== 'Object') {
return false;
}
'Property Descriptor': function isPropertyDescriptor(Desc) {
var allowed = {
'[[Configurable]]': true,
'[[Enumerable]]': true,
@ -34,6 +33,27 @@ var predicates = {
throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
}
return true;
},
// https://262.ecma-international.org/13.0/#sec-match-records
'Match Record': isMatchRecord,
'Iterator Record': function isIteratorRecord(value) {
return has(value, '[[Iterator]]') && has(value, '[[NextMethod]]') && has(value, '[[Done]]');
},
'PromiseCapability Record': function isPromiseCapabilityRecord(value) {
return value
&& has(value, '[[Resolve]]')
&& typeof value['[[Resolve]]'] === 'function'
&& has(value, '[[Reject]]')
&& typeof value['[[Reject]]'] === 'function'
&& has(value, '[[Promise]]')
&& value['[[Promise]]']
&& typeof value['[[Promise]]'].then === 'function';
},
'AsyncGeneratorRequest Record': function isAsyncGeneratorRequestRecord(value) {
return value
&& has(value, '[[Completion]]') // TODO: confirm is a completion record
&& has(value, '[[Capability]]')
&& predicates['PromiseCapability Record'](value['[[Capability]]']);
}
};
@ -42,7 +62,7 @@ module.exports = function assertRecord(Type, recordType, argumentName, value) {
if (typeof predicate !== 'function') {
throw new $SyntaxError('unknown record type: ' + recordType);
}
if (!predicate(Type, value)) {
if (Type(value) !== 'Object' || !predicate(value)) {
throw new $TypeError(argumentName + ' must be a ' + recordType);
}
};

View file

@ -4,7 +4,7 @@ var GetIntrinsic = require('get-intrinsic');
var has = require('has');
var $assign = GetIntrinsic('%Object%').assign;
var $assign = GetIntrinsic('%Object.assign%', true);
module.exports = function assign(target, source) {
if ($assign) {

View file

@ -0,0 +1,27 @@
'use strict';
module.exports = function fromPropertyDescriptor(Desc) {
if (typeof Desc === 'undefined') {
return Desc;
}
var obj = {};
if ('[[Value]]' in Desc) {
obj.value = Desc['[[Value]]'];
}
if ('[[Writable]]' in Desc) {
obj.writable = !!Desc['[[Writable]]'];
}
if ('[[Get]]' in Desc) {
obj.get = Desc['[[Get]]'];
}
if ('[[Set]]' in Desc) {
obj.set = Desc['[[Set]]'];
}
if ('[[Enumerable]]' in Desc) {
obj.enumerable = !!Desc['[[Enumerable]]'];
}
if ('[[Configurable]]' in Desc) {
obj.configurable = !!Desc['[[Configurable]]'];
}
return obj;
};

View file

@ -1,10 +1,4 @@
'use strict';
var getInferredName;
try {
// eslint-disable-next-line no-new-func
getInferredName = Function('s', 'return { [s]() {} }[s].name;');
} catch (e) {}
var inferred = function () {};
module.exports = getInferredName && inferred.name === 'inferred' ? getInferredName : null;
// TODO: remove, semver-major
module.exports = require('get-symbol-description/getInferredName');

View file

@ -3,9 +3,11 @@
var hasSymbols = require('has-symbols')();
var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bind/callBound');
var isString = require('is-string');
var $iterator = GetIntrinsic('%Symbol.iterator%', true);
var $stringSlice = callBound('String.prototype.slice');
var $String = GetIntrinsic('%String%', true);
module.exports = function getIteratorMethod(ES, iterable) {
var usingIterator;
@ -25,12 +27,12 @@ module.exports = function getIteratorMethod(ES, iterable) {
}
};
};
} else if (ES.Type(iterable) === 'String') {
} else if (isString(iterable)) {
usingIterator = function () {
var i = 0;
return {
next: function () {
var nextIndex = ES.AdvanceStringIndex(iterable, i, true);
var nextIndex = ES.AdvanceStringIndex($String(iterable), i, true);
var value = $stringSlice(iterable, i, nextIndex);
i = nextIndex;
return {

View file

@ -1,15 +1,5 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
// TODO: remove, semver-major
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%');
if ($gOPD) {
try {
$gOPD([], 'length');
} catch (e) {
// IE 8 has a broken gOPD
$gOPD = null;
}
}
module.exports = $gOPD;
module.exports = require('gopd');

View file

@ -3,11 +3,11 @@
var GetIntrinsic = require('get-intrinsic');
var originalGetProto = GetIntrinsic('%Object.getPrototypeOf%', true);
var $ArrayProto = GetIntrinsic('%Array.prototype%');
var hasProto = require('has-proto')();
module.exports = originalGetProto || (
// eslint-disable-next-line no-proto
[].__proto__ === $ArrayProto
hasProto
? function (O) {
return O.__proto__; // eslint-disable-line no-proto
}

View file

@ -1,41 +1,4 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bind/callBound');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var getGlobalSymbolDescription = GetIntrinsic('%Symbol.keyFor%', true);
var thisSymbolValue = callBound('%Symbol.prototype.valueOf%', true);
var symToStr = callBound('Symbol.prototype.toString', true);
var getInferredName = require('./getInferredName');
/* eslint-disable consistent-return */
module.exports = callBound('%Symbol.prototype.description%', true) || function getSymbolDescription(symbol) {
if (!thisSymbolValue) {
throw new $SyntaxError('Symbols are not supported in this environment');
}
// will throw if not a symbol primitive or wrapper object
var sym = thisSymbolValue(symbol);
if (getInferredName) {
var name = getInferredName(sym);
if (name === '') { return; }
return name.slice(1, -1); // name.slice('['.length, -']'.length);
}
var desc;
if (getGlobalSymbolDescription) {
desc = getGlobalSymbolDescription(sym);
if (typeof desc === 'string') {
return desc;
}
}
desc = symToStr(sym).slice(7, -1); // str.slice('Symbol('.length, -')'.length);
if (desc) {
return desc;
}
};
// TODO: remove, semver-major
module.exports = require('get-symbol-description');

View file

@ -0,0 +1,9 @@
'use strict';
var functionName = require('function.prototype.name');
var anon = functionName(function () {});
module.exports = function isAbstractClosure(x) {
return typeof x === 'function' && (!x.prototype || functionName(x) === anon);
};

View file

@ -1,5 +1,5 @@
'use strict';
var $isNaN = Number.isNaN || function (a) { return a !== a; };
var $isNaN = require('./isNaN');
module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; };
module.exports = function (x) { return (typeof x === 'number' || typeof x === 'bigint') && !$isNaN(x) && x !== Infinity && x !== -Infinity; };

View file

@ -0,0 +1,7 @@
'use strict';
module.exports = function isFullyPopulatedPropertyDescriptor(ES, Desc) {
return '[[Enumerable]]' in Desc
&& '[[Configurable]]' in Desc
&& (ES.IsAccessorDescriptor(Desc) || ES.IsDataDescriptor(Desc));
};

16
node_modules/es-abstract/helpers/isMatchRecord.js generated vendored Normal file
View file

@ -0,0 +1,16 @@
'use strict';
var has = require('has');
// https://262.ecma-international.org/13.0/#sec-match-records
module.exports = function isMatchRecord(record) {
return (
has(record, '[[StartIndex]]')
&& has(record, '[[EndIndex]]')
&& record['[[StartIndex]]'] >= 0
&& record['[[EndIndex]]'] >= record['[[StartIndex]]']
&& String(parseInt(record['[[StartIndex]]'], 10)) === String(record['[[StartIndex]]'])
&& String(parseInt(record['[[EndIndex]]'], 10)) === String(record['[[EndIndex]]'])
);
};

6
node_modules/es-abstract/helpers/modBigInt.js generated vendored Normal file
View file

@ -0,0 +1,6 @@
'use strict';
module.exports = function bigIntMod(BigIntRemainder, bigint, modulo) {
var remain = BigIntRemainder(bigint, modulo);
return remain >= 0 ? remain : remain + modulo;
};

9
node_modules/es-abstract/helpers/reduce.js generated vendored Normal file
View file

@ -0,0 +1,9 @@
'use strict';
module.exports = function reduce(arr, fn, init) {
var acc = init;
for (var i = 0; i < arr.length; i += 1) {
acc = fn(acc, arr[i], i);
}
return acc;
};

View file

@ -1,11 +1,5 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
// TODO: remove, semver-major
var $test = GetIntrinsic('RegExp.prototype.test');
var callBind = require('call-bind');
module.exports = function regexTester(regex) {
return callBind($test, regex);
};
module.exports = require('safe-regex-test');

View file

@ -3,14 +3,15 @@
var GetIntrinsic = require('get-intrinsic');
var originalSetProto = GetIntrinsic('%Object.setPrototypeOf%', true);
var $ArrayProto = GetIntrinsic('%Array.prototype%');
var hasProto = require('has-proto')();
module.exports = originalSetProto || (
// eslint-disable-next-line no-proto, no-negated-condition
[].__proto__ !== $ArrayProto
? null
: function (O, proto) {
hasProto
? function (O, proto) {
O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign
return O;
}
: null
);