Skip to content

Commit

Permalink
bug fix: function expression as computed property
Browse files Browse the repository at this point in the history
  • Loading branch information
kaicataldo committed Oct 10, 2017
1 parent 3bb0529 commit 7365f7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/require-jsdoc.js
Expand Up @@ -85,7 +85,7 @@ module.exports = {
FunctionExpression(node) {
if (
(options.MethodDefinition && node.parent.type === "MethodDefinition") ||
(options.FunctionExpression && (node.parent.type === "VariableDeclarator" || node.parent.type === "Property"))
(options.FunctionExpression && (node.parent.type === "VariableDeclarator" || (node.parent.type === "Property" && node === node.parent.value)))
) {
checkJsDoc(node);
}
Expand Down
9 changes: 9 additions & 0 deletions tests/lib/rules/require-jsdoc.js
Expand Up @@ -216,6 +216,15 @@ ruleTester.run("require-jsdoc", rule, {
FunctionExpression: true
}
}]
},
{
code: " var foo = { [function() {}]: 1 };",
options: [{
require: {
FunctionExpression: true
}
}],
parserOptions: { ecmaVersion: 6 }
}
],

Expand Down

0 comments on commit 7365f7d

Please sign in to comment.