Skip to content

Commit

Permalink
Fix: scope for arrow functions
Browse files Browse the repository at this point in the history
Closes gh-173
  • Loading branch information
Sergey Zarouski authored and qfox committed Dec 5, 2015
1 parent 5cae034 commit 84def6a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/esprima-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module.exports = {
var scopeNodeTypes = [
'Program',
'FunctionDeclaration',
'FunctionExpression'
'FunctionExpression',
'ArrowFunctionExpression'
];

/**
Expand Down
9 changes: 9 additions & 0 deletions test/lib/rules/validate-jsdoc/check-redundant-returns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 84def6a

Please sign in to comment.