-
Notifications
You must be signed in to change notification settings - Fork 50.8k
Open
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
eslint-plugin-react-hooks: 7.0.1
Steps To Reproduce
1.Create react app
2. Add this eslint-plugin-react-hooks plugin
3. Lint the next code
import { FeatureRemovalBuildTime } from '@xxx/build-time-tools/FeatureRemovalBuildTime';
import { PlatformSwitchBuildTime } from '@xxx/build-time-tools/PlatformSwitchBuildTime';
import { isMyFeature } from '@xxx/config/exporter';
import ErrorMessageMT from './ErrorMessageMT';
import ErrorMessageBase from './ErrorMessageBase';
import type { ErrorMessageProps } from './types';
const ErrorMessage = (props: ErrorMessageProps) => {
'use memo';
const ErrorMessageView = PlatformSwitchBuildTime.select({
anyMT:
FeatureRemovalBuildTime.isMyFeature && isMyFeature()
? ErrorMessageMT
: ErrorMessageBase,
default: ErrorMessageBase,
});
return <ErrorMessageView {...props} />; // Error: react-hooks/static-components
};
export default ErrorMessage;The current behavior
Eslint will complain that ErrorMessageView was created during the render
The expected behavior
But all values inside if check are stable and valid as in this example: https://react.dev/reference/eslint-plugin-react-hooks/lints/static-components#valid
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug