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

Faulty Codemod: [react/19/remove-context-provider] Extra Parentheses in Return Statement #1437

Open
waterbird-i opened this issue Jan 6, 2025 · 0 comments
Labels
codemod-issue Any issues related to a codemod, FP or FN.

Comments

@waterbird-i
Copy link

waterbird-i commented Jan 6, 2025


Issue Title: Faulty Codemod: [react/19/remove-context-provider] Extra Parentheses in Return Statement

Description:

I found an issue while using codemod react/19/remove-context-provider. The generated code adds extra parentheses after the return statement, which makes the code appear redundant.

Example Code:

return (
    (
        <Context
            value={{
                selectedKeys,
                setSelectedKeys,
                expandedKeys,
                setExpandedKeys,
                searchValue,
                setSearchValue,
                autoExpandParent,
                setAutoExpandParent,
                oprations,
            }}
        >
            {children}
        </Context>
    )
);

Suggested Improvement:

I suggest removing the outer parentheses to make the code more concise, as shown below:

return (
    <Context
        value={{
            selectedKeys,
            setSelectedKeys,
            expandedKeys,
            setExpandedKeys,
            searchValue,
            setSearchValue,
            autoExpandParent,
            setAutoExpandParent,
            oprations,
        }}
    >
        {children}
    </Context>
);

Additional Information:

Please confirm whether this is an intentional design choice or an issue that needs to be fixed. Thank you for your efforts and contributions!


@waterbird-i waterbird-i added the codemod-issue Any issues related to a codemod, FP or FN. label Jan 6, 2025
@waterbird-i waterbird-i changed the title Faulty Codemod: Extra Parentheses in Return Statement Faulty Codemod: [react/19/remove-context-provider] Extra Parentheses in Return Statement Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codemod-issue Any issues related to a codemod, FP or FN.
Projects
None yet
Development

No branches or pull requests

1 participant