summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/lib/rules/prefer-const.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/lib/rules/prefer-const.js')
-rw-r--r--tools/node_modules/eslint/lib/rules/prefer-const.js34
1 files changed, 13 insertions, 21 deletions
diff --git a/tools/node_modules/eslint/lib/rules/prefer-const.js b/tools/node_modules/eslint/lib/rules/prefer-const.js
index 854da310e4..87f8389212 100644
--- a/tools/node_modules/eslint/lib/rules/prefer-const.js
+++ b/tools/node_modules/eslint/lib/rules/prefer-const.js
@@ -17,8 +17,7 @@ const DESTRUCTURING_HOST_TYPE = /^(?:VariableDeclarator|AssignmentExpression)$/u
/**
* Checks whether a given node is located at `ForStatement.init` or not.
- *
- * @param {ASTNode} node - A node to check.
+ * @param {ASTNode} node A node to check.
* @returns {boolean} `true` if the node is located at `ForStatement.init`.
*/
function isInitOfForStatement(node) {
@@ -27,8 +26,7 @@ function isInitOfForStatement(node) {
/**
* Checks whether a given Identifier node becomes a VariableDeclaration or not.
- *
- * @param {ASTNode} identifier - An Identifier node to check.
+ * @param {ASTNode} identifier An Identifier node to check.
* @returns {boolean} `true` if the node can become a VariableDeclaration.
*/
function canBecomeVariableDeclaration(identifier) {
@@ -51,9 +49,8 @@ function canBecomeVariableDeclaration(identifier) {
/**
* Checks if an property or element is from outer scope or function parameters
* in destructing pattern.
- *
- * @param {string} name - A variable name to be checked.
- * @param {eslint-scope.Scope} initScope - A scope to start find.
+ * @param {string} name A variable name to be checked.
+ * @param {eslint-scope.Scope} initScope A scope to start find.
* @returns {boolean} Indicates if the variable is from outer scope or function parameters.
*/
function isOuterVariableInDestructing(name, initScope) {
@@ -76,8 +73,7 @@ function isOuterVariableInDestructing(name, initScope) {
* belongs to.
* This is used to detect a mix of reassigned and never reassigned in a
* destructuring.
- *
- * @param {eslint-scope.Reference} reference - A reference to get.
+ * @param {eslint-scope.Reference} reference A reference to get.
* @returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or
* null.
*/
@@ -162,9 +158,8 @@ function hasMemberExpressionAssignment(node) {
* `/*exported foo` directive comment makes such variables. This rule does not
* warn such variables because this rule cannot distinguish whether the
* exported variables are reassigned or not.
- *
- * @param {eslint-scope.Variable} variable - A variable to get.
- * @param {boolean} ignoreReadBeforeAssign -
+ * @param {eslint-scope.Variable} variable A variable to get.
+ * @param {boolean} ignoreReadBeforeAssign
* The value of `ignoreReadBeforeAssign` option.
* @returns {ASTNode|null}
* An Identifier node if the variable should change to const.
@@ -262,9 +257,8 @@ function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) {
* reference of given variables belongs to.
* This is used to detect a mix of reassigned and never reassigned in a
* destructuring.
- *
- * @param {eslint-scope.Variable[]} variables - Variables to group by destructuring.
- * @param {boolean} ignoreReadBeforeAssign -
+ * @param {eslint-scope.Variable[]} variables Variables to group by destructuring.
+ * @param {boolean} ignoreReadBeforeAssign
* The value of `ignoreReadBeforeAssign` option.
* @returns {Map<ASTNode, ASTNode[]>} Grouped identifier nodes.
*/
@@ -308,10 +302,9 @@ function groupByDestructuring(variables, ignoreReadBeforeAssign) {
/**
* Finds the nearest parent of node with a given type.
- *
- * @param {ASTNode} node – The node to search from.
- * @param {string} type – The type field of the parent node.
- * @param {Function} shouldStop – a predicate that returns true if the traversal should stop, and false otherwise.
+ * @param {ASTNode} node The node to search from.
+ * @param {string} type The type field of the parent node.
+ * @param {Function} shouldStop A predicate that returns true if the traversal should stop, and false otherwise.
* @returns {ASTNode} The closest ancestor with the specified type; null if no such ancestor exists.
*/
function findUp(node, type, shouldStop) {
@@ -374,8 +367,7 @@ module.exports = {
* nullable. In simple declaration or assignment cases, the length of
* the array is 1. In destructuring cases, the length of the array can
* be 2 or more.
- *
- * @param {(eslint-scope.Reference|null)[]} nodes -
+ * @param {(eslint-scope.Reference|null)[]} nodes
* References which are grouped by destructuring to report.
* @returns {void}
*/