Update checked-in dependencies
This commit is contained in:
parent
6b0d45a5c6
commit
cc1adb825a
4247 changed files with 144820 additions and 149530 deletions
37
node_modules/eslint/lib/rules/utils/ast-utils.js
generated
vendored
37
node_modules/eslint/lib/rules/utils/ast-utils.js
generated
vendored
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
const esutils = require("esutils");
|
||||
const espree = require("espree");
|
||||
const lodash = require("lodash");
|
||||
const escapeRegExp = require("escape-string-regexp");
|
||||
const {
|
||||
breakableTypePattern,
|
||||
createGlobalLinebreakMatcher,
|
||||
|
|
@ -38,7 +38,9 @@ const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]);
|
|||
const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]);
|
||||
|
||||
const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;
|
||||
const OCTAL_ESCAPE_PATTERN = /^(?:[^\\]|\\[^0-7]|\\0(?![0-9]))*\\(?:[1-7]|0[0-9])/u;
|
||||
|
||||
// Tests the presence of at least one LegacyOctalEscapeSequence or NonOctalDecimalEscapeSequence in a raw string
|
||||
const OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN = /^(?:[^\\]|\\.)*\\(?:[1-9]|0[0-9])/su;
|
||||
|
||||
const LOGICAL_ASSIGNMENT_OPERATORS = new Set(["&&=", "||=", "??="]);
|
||||
|
||||
|
|
@ -80,7 +82,7 @@ function startsWithUpperCase(s) {
|
|||
/**
|
||||
* Checks whether or not a node is a constructor.
|
||||
* @param {ASTNode} node A function node to check.
|
||||
* @returns {boolean} Wehether or not a node is a constructor.
|
||||
* @returns {boolean} Whether or not a node is a constructor.
|
||||
*/
|
||||
function isES5Constructor(node) {
|
||||
return (node.id && startsWithUpperCase(node.id.name));
|
||||
|
|
@ -1572,7 +1574,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
/*
|
||||
* Determine if a node has a possiblity to be an Error object
|
||||
* Determine if a node has a possibility to be an Error object
|
||||
* @param {ASTNode} node ASTNode to check
|
||||
* @returns {boolean} True if there is a chance it contains an Error obj
|
||||
*/
|
||||
|
|
@ -1611,6 +1613,17 @@ module.exports = {
|
|||
}
|
||||
|
||||
case "LogicalExpression":
|
||||
|
||||
/*
|
||||
* If the && operator short-circuits, the left side was falsy and therefore not an error, and if it
|
||||
* doesn't short-circuit, it takes the value from the right side, so the right side must always be
|
||||
* a plausible error. A future improvement could verify that the left side could be truthy by
|
||||
* excluding falsy literals.
|
||||
*/
|
||||
if (node.operator === "&&") {
|
||||
return module.exports.couldBeError(node.right);
|
||||
}
|
||||
|
||||
return module.exports.couldBeError(node.left) || module.exports.couldBeError(node.right);
|
||||
|
||||
case "ConditionalExpression":
|
||||
|
|
@ -1743,7 +1756,7 @@ module.exports = {
|
|||
* @returns {SourceLocation} The `loc` object.
|
||||
*/
|
||||
getNameLocationInGlobalDirectiveComment(sourceCode, comment, name) {
|
||||
const namePattern = new RegExp(`[\\s,]${lodash.escapeRegExp(name)}(?:$|[\\s,:])`, "gu");
|
||||
const namePattern = new RegExp(`[\\s,]${escapeRegExp(name)}(?:$|[\\s,:])`, "gu");
|
||||
|
||||
// To ignore the first text "global".
|
||||
namePattern.lastIndex = comment.value.indexOf("global") + 6;
|
||||
|
|
@ -1766,17 +1779,19 @@ module.exports = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Determines whether the given raw string contains an octal escape sequence.
|
||||
* Determines whether the given raw string contains an octal escape sequence
|
||||
* or a non-octal decimal escape sequence ("\8", "\9").
|
||||
*
|
||||
* "\1", "\2" ... "\7"
|
||||
* "\00", "\01" ... "\09"
|
||||
* "\1", "\2" ... "\7", "\8", "\9"
|
||||
* "\00", "\01" ... "\07", "\08", "\09"
|
||||
*
|
||||
* "\0", when not followed by a digit, is not an octal escape sequence.
|
||||
* @param {string} rawString A string in its raw representation.
|
||||
* @returns {boolean} `true` if the string contains at least one octal escape sequence.
|
||||
* @returns {boolean} `true` if the string contains at least one octal escape sequence
|
||||
* or at least one non-octal decimal escape sequence.
|
||||
*/
|
||||
hasOctalEscapeSequence(rawString) {
|
||||
return OCTAL_ESCAPE_PATTERN.test(rawString);
|
||||
hasOctalOrNonOctalDecimalEscapeSequence(rawString) {
|
||||
return OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN.test(rawString);
|
||||
},
|
||||
|
||||
isLogicalExpression,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue