Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
12
node_modules/eslint/lib/rules/prefer-arrow-callback.js
generated
vendored
12
node_modules/eslint/lib/rules/prefer-arrow-callback.js
generated
vendored
|
|
@ -53,13 +53,14 @@ function getVariableOfArguments(scope) {
|
|||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
/* c8 ignore next */
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether or not a given node is a callback.
|
||||
* @param {ASTNode} node A node to check.
|
||||
* @throws {Error} (Unreachable.)
|
||||
* @returns {Object}
|
||||
* {boolean} retv.isCallback - `true` if the node is a callback.
|
||||
* {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`.
|
||||
|
|
@ -125,7 +126,7 @@ function getCallbackInfo(node) {
|
|||
parent = parent.parent;
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
/* c8 ignore next */
|
||||
throw new Error("unreachable");
|
||||
}
|
||||
|
||||
|
|
@ -144,13 +145,13 @@ function hasDuplicateParams(paramsList) {
|
|||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "require using arrow functions for callbacks",
|
||||
category: "ECMAScript 6",
|
||||
description: "Require using arrow functions for callbacks",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/prefer-arrow-callback"
|
||||
},
|
||||
|
|
@ -334,6 +335,7 @@ module.exports = {
|
|||
// Convert the function expression to an arrow function.
|
||||
const functionToken = sourceCode.getFirstToken(node, node.async ? 1 : 0);
|
||||
const leftParenToken = sourceCode.getTokenAfter(functionToken, astUtils.isOpeningParenToken);
|
||||
const tokenBeforeBody = sourceCode.getTokenBefore(node.body);
|
||||
|
||||
if (sourceCode.commentsExistBetween(functionToken, leftParenToken)) {
|
||||
|
||||
|
|
@ -347,7 +349,7 @@ module.exports = {
|
|||
// Remove extra tokens and spaces.
|
||||
yield fixer.removeRange([functionToken.range[0], leftParenToken.range[0]]);
|
||||
}
|
||||
yield fixer.insertTextBefore(node.body, "=> ");
|
||||
yield fixer.insertTextAfter(tokenBeforeBody, " =>");
|
||||
|
||||
// Get the node that will become the new arrow function.
|
||||
let replacedNode = callbackInfo.isLexicalThis ? node.parent.parent : node;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue