Skip to content

Commit f5a40c0

Browse files
committed
Fix: no-deprecated-report-api should consider spread operator(fixes #64)
1 parent 7df313d commit f5a40c0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/rules/no-deprecated-report-api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = {
3939
node.callee.type === 'MemberExpression' &&
4040
contextIdentifiers.has(node.callee.object) &&
4141
node.callee.property.type === 'Identifier' && node.callee.property.name === 'report' &&
42-
node.arguments.length > 1
42+
(node.arguments.length > 1 || (node.arguments.length === 1 && node.arguments[0].type === 'SpreadElement'))
4343
) {
4444
context.report({
4545
node: node.callee.property,

tests/lib/rules/no-deprecated-report-api.js

+11
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,16 @@ ruleTester.run('no-deprecated-report-api', rule, {
209209
output: null,
210210
errors: [ERROR],
211211
},
212+
{
213+
code: `
214+
module.exports = {
215+
create(context) {
216+
context.report(...error);
217+
}
218+
};
219+
`,
220+
output: null,
221+
errors: [ERROR],
222+
},
212223
],
213224
});

0 commit comments

Comments
 (0)