Skip to content

Commit 1301fe9

Browse files
author
Joachim Seminck
committed
More robust no-typos fix
1 parent 8365d29 commit 1301fe9

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/rules/no-typos.js

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

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

7571
if (

lib/util/Components.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ function componentRule(rule, context) {
215215
* @returns {Boolean} True if the node is explicitly declared as a descendant of a React Component, false if not
216216
*/
217217
isExplicitComponent: function(node) {
218-
const comment = sourceCode.getJSDocComment(node);
218+
let comment;
219+
try {
220+
comment = sourceCode.getJSDocComment(node);
221+
} catch (e) {
222+
comment = null;
223+
}
219224

220225
if (comment === null) {
221226
return false;

0 commit comments

Comments
 (0)