Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react/display-name regression #3121

Closed
adriangodong opened this issue Nov 3, 2021 · 1 comment
Closed

react/display-name regression #3121

adriangodong opened this issue Nov 3, 2021 · 1 comment

Comments

@adriangodong
Copy link

I have the following code that was working with eslint@7.32.0 and eslint-plugin-react@7.26.1:

export function wrapComponent<T>(WrappedComponent: React.ComponentType<T>): React.ComponentClass<T>
{
    return class extends React.Component<T>
    {
        displayName = `wrapped(${WrappedComponent.displayName})`;

        render()
        {
            ...
        }
    }
    return Container;
}

After upgrading to eslint@8.1.0, there's a linting error for react/display-name rule.

If I extract the class into an actual class and then return it, the linting error goes away, e.g.:

export function wrapComponent()...
{
    class Wrap extends React.Component<T>
    {
        displayName = `wrapped(${WrappedComponent.displayName})`;
        ...
    }
    return Wrap;
}
@ljharb
Copy link
Member

ljharb commented Nov 4, 2021

We don't support eslint 8 yet; see #3055.

@ljharb ljharb closed this as completed Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants