Update checked-in dependencies
This commit is contained in:
parent
4fad06f438
commit
40a500c743
4168 changed files with 298222 additions and 374905 deletions
32
node_modules/eslint/lib/rules/quotes.js
generated
vendored
32
node_modules/eslint/lib/rules/quotes.js
generated
vendored
|
|
@ -82,7 +82,7 @@ module.exports = {
|
|||
docs: {
|
||||
description: "Enforce the consistent use of either backticks, double, or single quotes",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/quotes"
|
||||
url: "https://eslint.org/docs/latest/rules/quotes"
|
||||
},
|
||||
|
||||
fixable: "code",
|
||||
|
|
@ -123,7 +123,7 @@ module.exports = {
|
|||
settings = QUOTE_SETTINGS[quoteOption || "double"],
|
||||
options = context.options[1],
|
||||
allowTemplateLiterals = options && options.allowTemplateLiterals === true,
|
||||
sourceCode = context.getSourceCode();
|
||||
sourceCode = context.sourceCode;
|
||||
let avoidEscape = options && options.avoidEscape === true;
|
||||
|
||||
// deprecated
|
||||
|
|
@ -157,7 +157,8 @@ module.exports = {
|
|||
|
||||
/**
|
||||
* Checks whether or not a given node is a directive.
|
||||
* The directive is a `ExpressionStatement` which has only a string literal.
|
||||
* The directive is a `ExpressionStatement` which has only a string literal not surrounded by
|
||||
* parentheses.
|
||||
* @param {ASTNode} node A node to check.
|
||||
* @returns {boolean} Whether or not the node is a directive.
|
||||
* @private
|
||||
|
|
@ -166,23 +167,23 @@ module.exports = {
|
|||
return (
|
||||
node.type === "ExpressionStatement" &&
|
||||
node.expression.type === "Literal" &&
|
||||
typeof node.expression.value === "string"
|
||||
typeof node.expression.value === "string" &&
|
||||
!astUtils.isParenthesised(sourceCode, node.expression)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether or not a given node is a part of directive prologues.
|
||||
* See also: http://www.ecma-international.org/ecma-262/6.0/#sec-directive-prologues-and-the-use-strict-directive
|
||||
* Checks whether a specified node is either part of, or immediately follows a (possibly empty) directive prologue.
|
||||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-directive-prologues-and-the-use-strict-directive}
|
||||
* @param {ASTNode} node A node to check.
|
||||
* @returns {boolean} Whether or not the node is a part of directive prologues.
|
||||
* @returns {boolean} Whether a specified node is either part of, or immediately follows a (possibly empty) directive prologue.
|
||||
* @private
|
||||
*/
|
||||
function isPartOfDirectivePrologue(node) {
|
||||
const block = node.parent.parent;
|
||||
|
||||
if (block.type !== "Program" && (block.type !== "BlockStatement" || !astUtils.isFunction(block.parent))) {
|
||||
function isExpressionInOrJustAfterDirectivePrologue(node) {
|
||||
if (!astUtils.isTopLevelExpressionStatement(node.parent)) {
|
||||
return false;
|
||||
}
|
||||
const block = node.parent.parent;
|
||||
|
||||
// Check the node is at a prologue.
|
||||
for (let i = 0; i < block.body.length; ++i) {
|
||||
|
|
@ -212,7 +213,7 @@ module.exports = {
|
|||
|
||||
// Directive Prologues.
|
||||
case "ExpressionStatement":
|
||||
return isPartOfDirectivePrologue(node);
|
||||
return !astUtils.isParenthesised(sourceCode, node) && isExpressionInOrJustAfterDirectivePrologue(node);
|
||||
|
||||
// LiteralPropertyName.
|
||||
case "Property":
|
||||
|
|
@ -328,12 +329,11 @@ module.exports = {
|
|||
description: settings.description
|
||||
},
|
||||
fix(fixer) {
|
||||
if (isPartOfDirectivePrologue(node)) {
|
||||
if (astUtils.isTopLevelExpressionStatement(node.parent) && !astUtils.isParenthesised(sourceCode, node)) {
|
||||
|
||||
/*
|
||||
* TemplateLiterals in a directive prologue aren't actually directives, but if they're
|
||||
* in the directive prologue, then fixing them might turn them into directives and change
|
||||
* the behavior of the code.
|
||||
* TemplateLiterals aren't actually directives, but fixing them might turn
|
||||
* them into directives and change the behavior of the code.
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue