"Missing return type on function" for every React class method
I just got it working by adding the rule into .eslintrc.json
with
{ "allowTypedFunctionExpressions": true }
.eslintrc.json
{
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowTypedFunctionExpressions": true }
]
}
}
versions
"@typescript-eslint/eslint-plugin": "^1.10.2",
"@typescript-eslint/parser": "^1.10.2",
"eslint": "^6.0.0",
Try writing the return type for render function as
render(): JSX.Element {
// render code
}
This works for me!