Skip to content

Commit c502d72

Browse files
author
Nuno Campos
committed
Update forbid-prop-types.js
handle situation where getFirstTokens() call returns only 1 Token
1 parent 4cb2e9e commit c502d72

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rules/forbid-prop-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = function(context) {
3333
// (babel-eslint does not expose property name so we have to rely on tokens)
3434
if (node.type === 'ClassProperty') {
3535
var tokens = context.getFirstTokens(node, 2);
36-
if (tokens[0].value === 'propTypes' || tokens[1].value === 'propTypes') {
36+
if (tokens[0].value === 'propTypes' || (tokens[1] && tokens[1].value === 'propTypes')) {
3737
return true;
3838
}
3939
return false;

0 commit comments

Comments
 (0)