Skip to content

Commit 60aed2e

Browse files
authored
Merge pull request #1372 from jseminck/no-typos-fix
Fix crash for no-typos rule
2 parents 7b305bd + fc1f873 commit 60aed2e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/rules/no-typos.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ module.exports = {
6666
},
6767

6868
MemberExpression: function(node) {
69+
if (node.parent.type !== 'AssignmentExpression') {
70+
return;
71+
}
72+
6973
const relatedComponent = utils.getRelatedComponent(node);
7074

7175
if (

tests/lib/rules/no-typos.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ ruleTester.run('no-typos', rule, {
240240
'}'
241241
].join('\n'),
242242
parserOptions: parserOptions
243+
}, {
244+
// https://github.com/yannickcr/eslint-plugin-react/issues/1353
245+
code: `
246+
function test(b) {
247+
return a.bind(b);
248+
}
249+
function a() {}
250+
`,
251+
parserOptions: parserOptions
243252
}],
244253

245254
invalid: [{

0 commit comments

Comments
 (0)