lint rule to ban anonymous functions inside HOCs

In our codebase at work we have a lot of components that are wrapped by HoCs. Basically fine, just one huge problem: some of the react-hooks lint rules aren't checked for when you do this, see: https://github.com/facebook/react/issues/20499 Does anyone know if it's possible to set up a lint rule that catches this? ie:
// this should make the linter complain
export const SomeComponent = observer(() => {
return <div />
});
// this should make the linter complain
export const SomeComponent = observer(() => {
return <div />
});
// this is ok
export const SomeComponent = Observer(function SomeOtherComponent() {
return <div />
});
// this is ok
export const SomeComponent = Observer(function SomeOtherComponent() {
return <div />
});
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server