Skip to content

Commit 33a8be0

Browse files
committed
Improve errors locations for prop-types
1 parent 70fef71 commit 33a8be0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/rules/prop-types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ module.exports = function(context) {
128128
case 'direct':
129129
usedPropTypes.push({
130130
name: node.parent.property.name,
131-
node: node
131+
node: node.parent.property
132132
});
133133
break;
134134
case 'destructuring':
@@ -139,7 +139,7 @@ module.exports = function(context) {
139139
}
140140
usedPropTypes.push({
141141
name: properties[i].key.name,
142-
node: node
142+
node: properties[i]
143143
});
144144
}
145145
break;

tests/lib/rules/prop-types.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ eslintTester.addRuleTest('lib/rules/prop-types', {
253253
errors: [{
254254
message: '\'name\' is missing in props validation',
255255
line: 3,
256-
column: 23,
257-
type: 'MemberExpression'
256+
column: 34,
257+
type: 'Identifier'
258258
}]
259259
}, {
260260
code: [
@@ -271,8 +271,8 @@ eslintTester.addRuleTest('lib/rules/prop-types', {
271271
errors: [{
272272
message: '\'name\' is missing in props validation for Hello',
273273
line: 3,
274-
column: 23,
275-
type: 'MemberExpression'
274+
column: 34,
275+
type: 'Identifier'
276276
}]
277277
}, {
278278
code: [

0 commit comments

Comments
 (0)