diff --git a/lib/rules/no-array-index-key.js b/lib/rules/no-array-index-key.js
index 1e4602ad7f..d5e9241af8 100644
--- a/lib/rules/no-array-index-key.js
+++ b/lib/rules/no-array-index-key.js
@@ -177,8 +177,8 @@ module.exports = {
}
var value = node.value;
- if (value.type !== 'JSXExpressionContainer') {
- // key='foo'
+ if (!value || value.type !== 'JSXExpressionContainer') {
+ // key='foo' or just simply 'key'
return;
}
diff --git a/tests/lib/rules/no-array-index-key.js b/tests/lib/rules/no-array-index-key.js
index 3bcd60488e..fbf41deb8b 100644
--- a/tests/lib/rules/no-array-index-key.js
+++ b/tests/lib/rules/no-array-index-key.js
@@ -30,6 +30,7 @@ ruleTester.run('no-array-index-key', rule, {
valid: [
{code: ';'},
{code: ';'},
+ {code: ';'},
{code: ';'},
{code: ';'},
@@ -71,6 +72,10 @@ ruleTester.run('no-array-index-key', rule, {
].join('\n')
},
+ {
+ code: 'foo.map((baz, i) => )'
+ },
+
{
code: 'foo.reduce((a, b) => a.concat(), [])'
},