summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/rules/no-useless-return.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/lib/rules/no-useless-return.js')
-rw-r--r--tools/eslint/lib/rules/no-useless-return.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/tools/eslint/lib/rules/no-useless-return.js b/tools/eslint/lib/rules/no-useless-return.js
index 29f644cc43..5415bf59b8 100644
--- a/tools/eslint/lib/rules/no-useless-return.js
+++ b/tools/eslint/lib/rules/no-useless-return.js
@@ -222,10 +222,12 @@ module.exports = {
fix(fixer) {
if (isRemovable(node)) {
- // Extend the replacement range to include the
- // entire function to avoid conflicting with
- // no-else-return.
- // https://github.com/eslint/eslint/issues/8026
+ /*
+ * Extend the replacement range to include the
+ * entire function to avoid conflicting with
+ * no-else-return.
+ * https://github.com/eslint/eslint/issues/8026
+ */
return new FixTracker(fixer, context.getSourceCode())
.retainEnclosingFunction(node)
.remove(node);
@@ -238,8 +240,10 @@ module.exports = {
scopeInfo = scopeInfo.upper;
},
- // Initializes segments.
- // NOTE: This event is notified for only reachable segments.
+ /*
+ * Initializes segments.
+ * NOTE: This event is notified for only reachable segments.
+ */
onCodePathSegmentStart(segment) {
const info = {
uselessReturns: getUselessReturns([], segment.allPrevSegments),
@@ -270,8 +274,10 @@ module.exports = {
scopeInfo.uselessReturns.push(node);
},
- // Registers for all statement nodes except FunctionDeclaration, BlockStatement, BreakStatement.
- // Removes return statements of the current segments from the useless return statement list.
+ /*
+ * Registers for all statement nodes except FunctionDeclaration, BlockStatement, BreakStatement.
+ * Removes return statements of the current segments from the useless return statement list.
+ */
ClassDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed,
ContinueStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
DebuggerStatement: markReturnStatementsOnCurrentSegmentsAsUsed,