Skip to content

Commit

Permalink
Fix: no-deprecated-report-api should consider spread operator(fixes #64
Browse files Browse the repository at this point in the history
…) (#65)
  • Loading branch information
aladdin-add authored and not-an-aardvark committed Oct 24, 2018
1 parent a128650 commit ec7a34c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/no-deprecated-report-api.js
Expand Up @@ -39,7 +39,7 @@ module.exports = {
node.callee.type === 'MemberExpression' &&
contextIdentifiers.has(node.callee.object) &&
node.callee.property.type === 'Identifier' && node.callee.property.name === 'report' &&
node.arguments.length > 1
(node.arguments.length > 1 || (node.arguments.length === 1 && node.arguments[0].type === 'SpreadElement'))
) {
context.report({
node: node.callee.property,
Expand Down
11 changes: 11 additions & 0 deletions tests/lib/rules/no-deprecated-report-api.js
Expand Up @@ -209,5 +209,16 @@ ruleTester.run('no-deprecated-report-api', rule, {
output: null,
errors: [ERROR],
},
{
code: `
module.exports = {
create(context) {
context.report(...error);
}
};
`,
output: null,
errors: [ERROR],
},
],
});

0 comments on commit ec7a34c

Please sign in to comment.