Skip to content

Commit ad41177

Browse files
committed
Fix regression in jsx-uses-vars (fixes #73)
1 parent a8737b5 commit ad41177

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/rules/jsx-uses-vars.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ module.exports = function(context) {
2020
variableUtil.markVariableAsUsed(context, node.expression.name);
2121
},
2222

23-
JSXOpeningElement: function(node) {
24-
variableUtil.markVariableAsUsed(context, node.name.name);
23+
JSXIdentifier: function(node) {
24+
if (node.parent.type === 'JSXAttribute') {
25+
return;
26+
}
27+
variableUtil.markVariableAsUsed(context, node.name);
2528
}
2629

2730
};

tests/lib/rules/jsx-uses-vars.js

100644100755
+8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ eslintTester.addRuleTest('node_modules/eslint/lib/rules/no-unused-vars', {
6060
ecmaFeatures: {
6161
jsx: true
6262
}
63+
}, {
64+
code: '\
65+
/*eslint jsx-uses-vars:1*/\
66+
var App;\
67+
<App.Hello />',
68+
ecmaFeatures: {
69+
jsx: true
70+
}
6371
}
6472
],
6573
invalid: [

0 commit comments

Comments
 (0)