Skip to content

Commit

Permalink
fix(eslint-plugin): explicit-function-return-type: ensure class arrow…
Browse files Browse the repository at this point in the history
… methods are validated (#377)

Fixes #348
  • Loading branch information
gavinbarron authored and bradzacher committed Mar 27, 2019
1 parent 6f5c0fa commit 643a223
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -114,6 +114,7 @@ export default util.createRule<Options, MessageIds>({
): void {
if (
options.allowExpressions &&
node.type !== AST_NODE_TYPES.ArrowFunctionExpression &&
node.parent &&
node.parent.type !== AST_NODE_TYPES.VariableDeclarator &&
node.parent.type !== AST_NODE_TYPES.MethodDefinition
Expand Down
Expand Up @@ -41,6 +41,7 @@ class Test {
method(): void {
return;
}
arrow = (): string => 'arrow';
}
`,
},
Expand Down Expand Up @@ -171,6 +172,7 @@ class Test {
method() {
return;
}
arrow = () => 'arrow';
}
`,
errors: [
Expand All @@ -184,6 +186,11 @@ class Test {
line: 8,
column: 9,
},
{
messageId: 'missingReturnType',
line: 11,
column: 11,
},
],
},
{
Expand Down

0 comments on commit 643a223

Please sign in to comment.