Skip to content

Commit

Permalink
fix: correct report node
Browse files Browse the repository at this point in the history
  • Loading branch information
akulsr0 committed Jun 18, 2024
1 parent 483ae9e commit 0091ac8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/rules/jsx-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,12 @@ module.exports = {
function checkIteratorElement(node) {
if (node.type === 'JSXElement') {
if (!hasProp(node.openingElement.attributes, 'key')) {
report(context, messages.missingIterKey, 'missingIterKey', {
node,
});
report(context, messages.missingIterKey, 'missingIterKey', { node });
} else {
const attrs = node.openingElement.attributes;

if (checkKeyMustBeforeSpread && isKeyAfterSpread(attrs)) {
report(context, messages.keyBeforeSpread, 'keyBeforeSpread', {
node: node.type === 'ArrayExpression' ? node : node.parent,
});
report(context, messages.keyBeforeSpread, 'keyBeforeSpread', { node });
}
}
} else if (checkFragmentShorthand && node.type === 'JSXFragment') {
Expand Down

0 comments on commit 0091ac8

Please sign in to comment.