Skip to content

Commit

Permalink
[patch] destructuring-assignment: use report helper for all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 16, 2023
1 parent c4c54cb commit 161e5a8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/rules/destructuring-assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ module.exports = {
// foo.aProp
const isContextUsed = contextSet.has(node.object.name) && !isAssignmentLHS(node);
if (isContextUsed && configuration === 'always') {
context.report({
report(context, messages.useDestructAssignment, 'useDestructAssignment', {
node,
message: `Must use destructuring ${node.object.name} assignment`,
data: {
type: node.object.name,
},
});
}
}
Expand Down Expand Up @@ -243,9 +245,11 @@ module.exports = {
}

if (SFCComponent && destructuringUseContext && configuration === 'never') {
context.report({
report(context, messages.noDestructAssignment, 'noDestructAssignment', {
node,
message: `Must never use destructuring ${node.init.callee.name} assignment`,
data: {
type: node.init.callee.name,
},
});
}

Expand Down

0 comments on commit 161e5a8

Please sign in to comment.