-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin

Description
Repro
{
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": ["error"],
}
}
Other rules are omitted for brevity. I can hand them in, if needed.
import React, { FC } from "react"
export const Comp: FC = () => (
<div
onClick={e => {
console.log("click!", e)
}}
// Missing return type on function.
// Argument 'e' should be typed.
></div>
)
Expected Result
No eslint error is triggered, as the exported outer function Comp
is explicitely typed as FC
. My interpretation of the rule is, that only directly exported members should be checked.
Actual Result
Two errors are raised:
1) Missing return type on function.eslint(@typescript-eslint/explicit-module-boundary-types)
2) Argument 'e' should be typed.eslint(@typescript-eslint/explicit-module-boundary-types)
I am also not sure about the second error, as e
should be contextually typed by onClick?: MouseEventHandler<T>;
in DOMAttributes<T>
. It seems that this rule wants a fully typed function, even if the function is only part of Comp
and itself not exported.
Additional Info
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
2.20.0 |
@typescript-eslint/parser |
2.20.0 |
TypeScript |
3.7.5 |
ESLint |
6.8.0 |
node |
13.9.0 |
npm |
6.13.7 |
ckknight
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin