Update checked-in dependencies
This commit is contained in:
parent
4fad06f438
commit
40a500c743
4168 changed files with 298222 additions and 374905 deletions
44
node_modules/eslint/lib/rules/utils/ast-utils.js
generated
vendored
44
node_modules/eslint/lib/rules/utils/ast-utils.js
generated
vendored
|
|
@ -9,6 +9,7 @@
|
|||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const { KEYS: eslintVisitorKeys } = require("eslint-visitor-keys");
|
||||
const esutils = require("esutils");
|
||||
const espree = require("espree");
|
||||
const escapeRegExp = require("escape-string-regexp");
|
||||
|
|
@ -986,6 +987,25 @@ function isConstant(scope, node, inBooleanPosition) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a node is an ExpressionStatement at the top level of a file or function body.
|
||||
* A top-level ExpressionStatement node is a directive if it contains a single unparenthesized
|
||||
* string literal and if it occurs either as the first sibling or immediately after another
|
||||
* directive.
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {boolean} Whether or not the node is an ExpressionStatement at the top level of a
|
||||
* file or function body.
|
||||
*/
|
||||
function isTopLevelExpressionStatement(node) {
|
||||
if (node.type !== "ExpressionStatement") {
|
||||
return false;
|
||||
}
|
||||
const parent = node.parent;
|
||||
|
||||
return parent.type === "Program" || (parent.type === "BlockStatement" && isFunction(parent.parent));
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -1442,7 +1462,16 @@ module.exports = {
|
|||
return 19;
|
||||
|
||||
default:
|
||||
return 20;
|
||||
if (node.type in eslintVisitorKeys) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
/*
|
||||
* if the node is not a standard node that we know about, then assume it has the lowest precedence
|
||||
* this will mean that rules will wrap unknown nodes in parentheses where applicable instead of
|
||||
* unwrapping them and potentially changing the meaning of the code or introducing a syntax error.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -1501,7 +1530,6 @@ module.exports = {
|
|||
return directives;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added
|
||||
* after the node will be parsed as a decimal point, rather than a property-access dot.
|
||||
|
|
@ -2105,6 +2133,15 @@ module.exports = {
|
|||
return OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN.test(rawString);
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines whether the given node is a template literal without expressions.
|
||||
* @param {ASTNode} node Node to check.
|
||||
* @returns {boolean} True if the node is a template literal without expressions.
|
||||
*/
|
||||
isStaticTemplateLiteral(node) {
|
||||
return node.type === "TemplateLiteral" && node.expressions.length === 0;
|
||||
},
|
||||
|
||||
isReferenceToGlobalVariable,
|
||||
isLogicalExpression,
|
||||
isCoalesceExpression,
|
||||
|
|
@ -2120,5 +2157,6 @@ module.exports = {
|
|||
isLogicalAssignmentOperator,
|
||||
getSwitchCaseColonToken,
|
||||
getModuleExportName,
|
||||
isConstant
|
||||
isConstant,
|
||||
isTopLevelExpressionStatement
|
||||
};
|
||||
|
|
|
|||
42
node_modules/eslint/lib/rules/utils/regular-expressions.js
generated
vendored
Normal file
42
node_modules/eslint/lib/rules/utils/regular-expressions.js
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* @fileoverview Common utils for regular expressions.
|
||||
* @author Josh Goldberg
|
||||
* @author Toru Nagashima
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { RegExpValidator } = require("@eslint-community/regexpp");
|
||||
|
||||
const REGEXPP_LATEST_ECMA_VERSION = 2022;
|
||||
|
||||
/**
|
||||
* Checks if the given regular expression pattern would be valid with the `u` flag.
|
||||
* @param {number} ecmaVersion ECMAScript version to parse in.
|
||||
* @param {string} pattern The regular expression pattern to verify.
|
||||
* @returns {boolean} `true` if the pattern would be valid with the `u` flag.
|
||||
* `false` if the pattern would be invalid with the `u` flag or the configured
|
||||
* ecmaVersion doesn't support the `u` flag.
|
||||
*/
|
||||
function isValidWithUnicodeFlag(ecmaVersion, pattern) {
|
||||
if (ecmaVersion <= 5) { // ecmaVersion <= 5 doesn't support the 'u' flag
|
||||
return false;
|
||||
}
|
||||
|
||||
const validator = new RegExpValidator({
|
||||
ecmaVersion: Math.min(ecmaVersion, REGEXPP_LATEST_ECMA_VERSION)
|
||||
});
|
||||
|
||||
try {
|
||||
validator.validatePattern(pattern, void 0, void 0, /* uFlag = */ true);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isValidWithUnicodeFlag,
|
||||
REGEXPP_LATEST_ECMA_VERSION
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue