diff --git a/lib/esprima-helpers.js b/lib/esprima-helpers.js index d36dff6..5e874d6 100644 --- a/lib/esprima-helpers.js +++ b/lib/esprima-helpers.js @@ -5,7 +5,8 @@ module.exports = { var scopeNodeTypes = [ 'Program', 'FunctionDeclaration', - 'FunctionExpression' + 'FunctionExpression', + 'ArrowFunctionExpression' ]; /** diff --git a/test/lib/rules/validate-jsdoc/check-redundant-returns.js b/test/lib/rules/validate-jsdoc/check-redundant-returns.js index 6f9c103..fe8d58a 100644 --- a/test/lib/rules/validate-jsdoc/check-redundant-returns.js +++ b/test/lib/rules/validate-jsdoc/check-redundant-returns.js @@ -66,6 +66,15 @@ describe('lib/rules/validate-jsdoc/check-redundant-returns', function () { if (true) { return x; } } } + }, { + it: 'should not report redundant @returns for arrow function', + code: [ + '/** @returns {String}*/', + 'var funcName = () => {', + ' var x = function () { return 1; }', + ' if (true) { return x; }', + '}' + ].join('\n') }, { it: 'should not report expression return for inner call result', code: function () {