-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
Eslint and plugin versions:
"eslint": "7.32.0",
"eslint-plugin-react": "^7.27.0",Relevant eslint configuration:
"react/display-name": "error",Expected error:
Component definition is missing display name react/display-name
As described in the title, the following code does not produce error:
const processData = (options?: { value: string }) =>
options?.value || 'no data';
export const Component = observer(() => {
const data = processData({ value: 'data' });
return <Text>{data}</Text>;
});If I remove { value: 'data' } argument, error is produced, as expected:
const processData = (options?: { value: string }) =>
options?.value || 'no data';
export const Component = observer(() => {
const data = processData();
return <Text>{data}</Text>;
});If I extract this argument to a separate variable error is produced too:
const processData = (options?: { value: string }) =>
options?.value || 'no data';
export const Component = observer(() => {
const options = { value: 'data' };
const data = processData(options);
return <Text>{data}</Text>;
});That's weird, I don't think there is something wrong with configuration.
Repo reproducing error: https://github.com/berrtech/eslint-react-display-name
Metadata
Metadata
Assignees
Labels
No labels