Skip to content

Commit 0091ac8

Browse files
committed
fix: correct report node
1 parent 483ae9e commit 0091ac8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/rules/jsx-key.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,12 @@ module.exports = {
9090
function checkIteratorElement(node) {
9191
if (node.type === 'JSXElement') {
9292
if (!hasProp(node.openingElement.attributes, 'key')) {
93-
report(context, messages.missingIterKey, 'missingIterKey', {
94-
node,
95-
});
93+
report(context, messages.missingIterKey, 'missingIterKey', { node });
9694
} else {
9795
const attrs = node.openingElement.attributes;
9896

9997
if (checkKeyMustBeforeSpread && isKeyAfterSpread(attrs)) {
100-
report(context, messages.keyBeforeSpread, 'keyBeforeSpread', {
101-
node: node.type === 'ArrayExpression' ? node : node.parent,
102-
});
98+
report(context, messages.keyBeforeSpread, 'keyBeforeSpread', { node });
10399
}
104100
}
105101
} else if (checkFragmentShorthand && node.type === 'JSXFragment') {

0 commit comments

Comments
 (0)