Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
48
node_modules/eslint/lib/rules/no-extra-parens.js
generated
vendored
48
node_modules/eslint/lib/rules/no-extra-parens.js
generated
vendored
|
|
@ -11,13 +11,13 @@
|
|||
const { isParenthesized: isParenthesizedRaw } = require("eslint-utils");
|
||||
const astUtils = require("./utils/ast-utils.js");
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "layout",
|
||||
|
||||
docs: {
|
||||
description: "disallow unnecessary parentheses",
|
||||
category: "Possible Errors",
|
||||
description: "Disallow unnecessary parentheses",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/no-extra-parens"
|
||||
},
|
||||
|
|
@ -52,7 +52,8 @@ module.exports = {
|
|||
enforceForArrowConditionals: { type: "boolean" },
|
||||
enforceForSequenceExpressions: { type: "boolean" },
|
||||
enforceForNewInMemberExpressions: { type: "boolean" },
|
||||
enforceForFunctionPrototypeMethods: { type: "boolean" }
|
||||
enforceForFunctionPrototypeMethods: { type: "boolean" },
|
||||
allowParensAfterCommentPattern: { type: "string" }
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
|
|
@ -86,6 +87,7 @@ module.exports = {
|
|||
context.options[1].enforceForNewInMemberExpressions === false;
|
||||
const IGNORE_FUNCTION_PROTOTYPE_METHODS = ALL_NODES && context.options[1] &&
|
||||
context.options[1].enforceForFunctionPrototypeMethods === false;
|
||||
const ALLOW_PARENS_AFTER_COMMENT_PATTERN = ALL_NODES && context.options[1] && context.options[1].allowParensAfterCommentPattern;
|
||||
|
||||
const PRECEDENCE_OF_ASSIGNMENT_EXPR = precedence({ type: "AssignmentExpression" });
|
||||
const PRECEDENCE_OF_UPDATE_EXPR = precedence({ type: "UpdateExpression" });
|
||||
|
|
@ -402,6 +404,19 @@ module.exports = {
|
|||
if (isIIFE(node) && !isParenthesised(node.callee)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ALLOW_PARENS_AFTER_COMMENT_PATTERN) {
|
||||
const commentsBeforeLeftParenToken = sourceCode.getCommentsBefore(leftParenToken);
|
||||
const totalCommentsBeforeLeftParenTokenCount = commentsBeforeLeftParenToken.length;
|
||||
const ignorePattern = new RegExp(ALLOW_PARENS_AFTER_COMMENT_PATTERN, "u");
|
||||
|
||||
if (
|
||||
totalCommentsBeforeLeftParenTokenCount > 0 &&
|
||||
ignorePattern.test(commentsBeforeLeftParenToken[totalCommentsBeforeLeftParenTokenCount - 1].value)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -634,10 +649,10 @@ module.exports = {
|
|||
|
||||
currentNode = currentNode.parent;
|
||||
|
||||
/* istanbul ignore if */
|
||||
/* c8 ignore start */
|
||||
if (currentNode === null) {
|
||||
throw new Error("Nodes are not in the ancestor-descendant relationship.");
|
||||
}
|
||||
}/* c8 ignore stop */
|
||||
|
||||
path.push(currentNode);
|
||||
}
|
||||
|
|
@ -808,13 +823,6 @@ module.exports = {
|
|||
|
||||
CallExpression: checkCallNew,
|
||||
|
||||
ClassBody(node) {
|
||||
node.body
|
||||
.filter(member => member.type === "MethodDefinition" && member.computed && member.key)
|
||||
.filter(member => hasExcessParensWithPrecedence(member.key, PRECEDENCE_OF_ASSIGNMENT_EXPR))
|
||||
.forEach(member => report(member.key));
|
||||
},
|
||||
|
||||
ConditionalExpression(node) {
|
||||
if (isReturnAssignException(node)) {
|
||||
return;
|
||||
|
|
@ -1063,6 +1071,12 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
"MethodDefinition[computed=true]"(node) {
|
||||
if (hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) {
|
||||
report(node.key);
|
||||
}
|
||||
},
|
||||
|
||||
NewExpression: checkCallNew,
|
||||
|
||||
ObjectExpression(node) {
|
||||
|
|
@ -1090,6 +1104,16 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
PropertyDefinition(node) {
|
||||
if (node.computed && hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) {
|
||||
report(node.key);
|
||||
}
|
||||
|
||||
if (node.value && hasExcessParensWithPrecedence(node.value, PRECEDENCE_OF_ASSIGNMENT_EXPR)) {
|
||||
report(node.value);
|
||||
}
|
||||
},
|
||||
|
||||
RestElement(node) {
|
||||
const argument = node.argument;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue