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
  • Loading branch information
aladdin-add committed Oct 24, 2018
1 parent a128650 commit 5473e50
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 5473e50

Please sign in to comment.