Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2023-07-17 20:17:37 +00:00
parent 99c9f6a498
commit e266801e21
242 changed files with 2638 additions and 9296 deletions

View file

@ -576,7 +576,6 @@ class FlatESLint {
cacheFilePath,
lintResultCache,
defaultConfigs,
defaultIgnores: () => false,
configs: null
});

View file

@ -100,6 +100,22 @@ function normalizeReportLoc(descriptor) {
return descriptor.node.loc;
}
/**
* Clones the given fix object.
* @param {Fix|null} fix The fix to clone.
* @returns {Fix|null} Deep cloned fix object or `null` if `null` or `undefined` was passed in.
*/
function cloneFix(fix) {
if (!fix) {
return null;
}
return {
range: [fix.range[0], fix.range[1]],
text: fix.text
};
}
/**
* Check that a fix has a valid range.
* @param {Fix|null} fix The fix to validate.
@ -137,7 +153,7 @@ function mergeFixes(fixes, sourceCode) {
return null;
}
if (fixes.length === 1) {
return fixes[0];
return cloneFix(fixes[0]);
}
fixes.sort(compareFixesByRange);
@ -183,7 +199,7 @@ function normalizeFixes(descriptor, sourceCode) {
}
assertValidFix(fix);
return fix;
return cloneFix(fix);
}
/**

View file

@ -1250,7 +1250,7 @@ module.exports = {
IfStatement(node) {
addBlocklessNodeIndent(node.consequent);
if (node.alternate && node.alternate.type !== "IfStatement") {
if (node.alternate) {
addBlocklessNodeIndent(node.alternate);
}
},

View file

@ -94,6 +94,7 @@ module.exports = {
messages: {
unnecessaryEscape: "Unnecessary escape character: \\{{character}}.",
removeEscape: "Remove the `\\`. This maintains the current functionality.",
removeEscapeDoNotKeepSemantics: "Remove the `\\` if it was inserted by mistake.",
escapeBackslash: "Replace the `\\` with `\\\\` to include the actual backslash character."
},
@ -125,7 +126,10 @@ module.exports = {
data: { character },
suggest: [
{
messageId: "removeEscape",
// Removing unnecessary `\` characters in a directive is not guaranteed to maintain functionality.
messageId: astUtils.isDirective(node.parent)
? "removeEscapeDoNotKeepSemantics" : "removeEscape",
fix(fixer) {
return fixer.removeRange(range);
}

View file

@ -130,42 +130,6 @@ function isBlockLikeStatement(sourceCode, node) {
);
}
/**
* Check whether the given node is a directive or not.
* @param {ASTNode} node The node to check.
* @param {SourceCode} sourceCode The source code object to get tokens.
* @returns {boolean} `true` if the node is a directive.
*/
function isDirective(node, sourceCode) {
return (
astUtils.isTopLevelExpressionStatement(node) &&
node.expression.type === "Literal" &&
typeof node.expression.value === "string" &&
!astUtils.isParenthesised(sourceCode, node.expression)
);
}
/**
* Check whether the given node is a part of directive prologue or not.
* @param {ASTNode} node The node to check.
* @param {SourceCode} sourceCode The source code object to get tokens.
* @returns {boolean} `true` if the node is a part of directive prologue.
*/
function isDirectivePrologue(node, sourceCode) {
if (isDirective(node, sourceCode)) {
for (const sibling of node.parent.body) {
if (sibling === node) {
break;
}
if (!isDirective(sibling, sourceCode)) {
return false;
}
}
return true;
}
return false;
}
/**
* Gets the actual last token.
*
@ -359,12 +323,10 @@ const StatementTypes = {
CJS_IMPORT.test(sourceCode.getText(node.declarations[0].init))
},
directive: {
test: isDirectivePrologue
test: astUtils.isDirective
},
expression: {
test: (node, sourceCode) =>
node.type === "ExpressionStatement" &&
!isDirectivePrologue(node, sourceCode)
test: node => node.type === "ExpressionStatement" && !astUtils.isDirective(node)
},
iife: {
test: isIIFEStatement
@ -375,10 +337,10 @@ const StatementTypes = {
isBlockLikeStatement(sourceCode, node)
},
"multiline-expression": {
test: (node, sourceCode) =>
test: node =>
node.loc.start.line !== node.loc.end.line &&
node.type === "ExpressionStatement" &&
!isDirectivePrologue(node, sourceCode)
!astUtils.isDirective(node)
},
"multiline-const": newMultilineKeywordTester("const"),

View file

@ -1006,6 +1006,15 @@ function isTopLevelExpressionStatement(node) {
}
/**
* Check whether the given node is a part of a directive prologue or not.
* @param {ASTNode} node The node to check.
* @returns {boolean} `true` if the node is a part of directive prologue.
*/
function isDirective(node) {
return node.type === "ExpressionStatement" && typeof node.directive === "string";
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
@ -2158,5 +2167,6 @@ module.exports = {
getSwitchCaseColonToken,
getModuleExportName,
isConstant,
isTopLevelExpressionStatement
isTopLevelExpressionStatement,
isDirective
};

View file

@ -14,6 +14,7 @@
const { FileEnumerator } = require("./cli-engine/file-enumerator");
const { FlatESLint, shouldUseFlatConfig } = require("./eslint/flat-eslint");
const FlatRuleTester = require("./rule-tester/flat-rule-tester");
const { ESLint } = require("./eslint/eslint");
//-----------------------------------------------------------------------------
// Exports
@ -24,5 +25,6 @@ module.exports = {
FlatESLint,
shouldUseFlatConfig,
FlatRuleTester,
FileEnumerator
FileEnumerator,
LegacyESLint: ESLint
};