You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the mobx-reactobserver function with a component that is also wrapped with React forwardRef, such as the example below:
import{observer}from'mobx-react';import{ForwardedRef,forwardRef}from'react';constMobxObserverForwardRefExample=observer(forwardRef(functionMobxObserverForwardRefExample({ name }: {name: string},ref: ForwardedRef<HTMLHeadingElement>){return(<div><h1ref={ref}>MobxObserverForwardRefExample{name}</h1></div>);}),);exportdefaultMobxObserverForwardRefExample;
I am extending plugin:mobx/recommended in my .eslintrc.json.
Actual outcome:
With the mobx/missing-observer eslint rule enabled, it fails to detect the observer wrapper on this component because of the forwardRef call in between:
MobxObserverForwardRefExample.tsx
5:14 warning Component `MobxObserverForwardRefExample` is missing `observer` mobx/missing-observer
✖ 1 problem (0 errors, 1 warning)
0 errors and 1 warning potentially fixable with the `--fix` option.
How to reproduce the issue:
I wasn't able to quickly figure out how to make ESLint work in a CodeSandbox, but this is easy to reproduce with the component above.
Versions
React 18.3.1
MobX 6.12.0
mobx-react 9.1.0
eslint-plugin-mobx 0.0.10
The text was updated successfully, but these errors were encountered:
Intended outcome:
I am using the
mobx-react
observer
function with a component that is also wrapped with ReactforwardRef
, such as the example below:I am extending
plugin:mobx/recommended
in my.eslintrc.json
.Actual outcome:
With the mobx/missing-observer eslint rule enabled, it fails to detect the
observer
wrapper on this component because of theforwardRef
call in between:How to reproduce the issue:
I wasn't able to quickly figure out how to make ESLint work in a CodeSandbox, but this is easy to reproduce with the component above.
Versions
The text was updated successfully, but these errors were encountered: