Skip to content
Permalink
Browse files
fix(valid-describe): allow concise body arrow function (#106)
  • Loading branch information
Saberre authored and SimenB committed May 23, 2018
1 parent 8213ada commit 4586bdcd9a629492da6825269d41d0982ab979db
Showing with 15 additions and 8 deletions.
  1. +5 −0 rules/__tests__/valid-describe.test.js
  2. +10 −8 rules/valid-describe.js
@@ -34,6 +34,11 @@ ruleTester.run('valid-describe', rule, {
})
})
`,
`
describe('foo', () =>
test('bar', () => {})
)
`,
],
invalid: [
{
@@ -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,
});
}
});
}
}
},
};

0 comments on commit 4586bdc

Please sign in to comment.