[explicit-function-return-type] allowExpressions should not allow methods #950
Labels
bug
Something isn't working
good first issue
Good for newcomers
has pr
there is a PR raised to close this
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Repro
Expected Result
Both lines should get hit with the error: "Missing return type on function".
Actual Result
Only
variable
gets the error;method
does not.method
is erroneously allowed due toallowExpressions
.Additional Info
From reading old issues, it looks like the idea behind
allowExpressions
is to allow expressions, but not to allow pure declarations which consist of only a function expression (source). This categorization is working great already for variable declarartions. I think theallowExpressions
option should follow the same reasoning for both, and also treat a class property method declaration as a function declaration.Versions
@typescript-eslint/eslint-plugin
2.1.0
@typescript-eslint/parser
2.1.0
TypeScript
3.5.1
ESLint
6.3.0
node
8.10.0
npm
5.6.0
The text was updated successfully, but these errors were encountered: