Skip to content

Commit

Permalink
fix(valid-describe): allow concise body arrow function (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saberre authored and SimenB committed May 23, 2018
1 parent 8213ada commit 4586bdc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions rules/__tests__/valid-describe.test.js
Expand Up @@ -34,6 +34,11 @@ ruleTester.run('valid-describe', rule, {
})
})
`,
`
describe('foo', () =>
test('bar', () => {})
)
`,
],
invalid: [
{
Expand Down
18 changes: 10 additions & 8 deletions rules/valid-describe.js
Expand Up @@ -76,14 +76,16 @@ module.exports = {
loc: paramsLocation(callbackFunction.params),
});
}
callbackFunction.body.body.forEach(node => {
if (node.type === 'ReturnStatement') {
context.report({
message: 'Unexpected return statement in describe callback',
node,
});
}
});
if (callbackFunction.body.type === 'BlockStatement') {
callbackFunction.body.body.forEach(node => {
if (node.type === 'ReturnStatement') {
context.report({
message: 'Unexpected return statement in describe callback',
node,
});
}
});
}
}
},
};
Expand Down

0 comments on commit 4586bdc

Please sign in to comment.