Skip to content

Commit 84def6a

Browse files
Sergey Zarouskiqfox
authored andcommitted
Fix: scope for arrow functions
Closes gh-173
1 parent 5cae034 commit 84def6a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/esprima-helpers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module.exports = {
55
var scopeNodeTypes = [
66
'Program',
77
'FunctionDeclaration',
8-
'FunctionExpression'
8+
'FunctionExpression',
9+
'ArrowFunctionExpression'
910
];
1011

1112
/**

test/lib/rules/validate-jsdoc/check-redundant-returns.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ describe('lib/rules/validate-jsdoc/check-redundant-returns', function () {
6666
if (true) { return x; }
6767
}
6868
}
69+
}, {
70+
it: 'should not report redundant @returns for arrow function',
71+
code: [
72+
'/** @returns {String}*/',
73+
'var funcName = () => {',
74+
' var x = function () { return 1; }',
75+
' if (true) { return x; }',
76+
'}'
77+
].join('\n')
6978
}, {
7079
it: 'should not report expression return for inner call result',
7180
code: function () {

0 commit comments

Comments
 (0)