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

TypeError: Cannot read property 'callee' of null #2733

Closed
jbizkit opened this issue Jul 29, 2020 · 8 comments
Closed

TypeError: Cannot read property 'callee' of null #2733

jbizkit opened this issue Jul 29, 2020 · 8 comments

Comments

@jbizkit
Copy link

jbizkit commented Jul 29, 2020

Version 7.20.5 seems to crash when tsx file has a function with the name createElement

yarn eslint
yarn run v1.22.4
$ node --max_old_space_size=8000 node_modules/eslint/bin/eslint.js --quiet -f compact --ext .ts,.tsx -o eslint-errors.txt src/

Oops! Something went wrong! :(

ESLint: 7.5.0

TypeError: Cannot read property 'callee' of null
Occurred while linting src\faq\components\Test.tsx:7
    at Object.isDestructuredFromPragmaImport (node_modules\eslint-plugin-react\lib\util\Components.js:348:33)
    at Object.isCreateElement (node_modules\eslint-plugin-react\lib\util\Components.js:393:16)
    at Object.isReturningJSX (node_modules\eslint-plugin-react\lib\util\Components.js:467:47)
    at Object.isReturningJSXOrNull (node_modules\eslint-plugin-react\lib\util\Components.js:503:20)
    at Object.getStatelessComponent (node_modules\eslint-plugin-react\lib\util\Components.js:699:64)
    at Object.getParentStatelessComponent (node_modules\eslint-plugin-react\lib\util\Components.js:728:42)
    at Object.getParentComponent (node_modules\eslint-plugin-react\lib\util\Components.js:623:18)
    at Object.ArrowFunctionExpression (node_modules\eslint-plugin-react\lib\util\Components.js:916:31)
    at updatedRuleInstructions.<computed> (node_modules\eslint-plugin-react\lib\util\Components.js:970:43)
    at node_modules\eslint\lib\linter\safe-emitter.js:45:58

Component

import * as React from 'react';

interface Props {
    text: string;
}

export const Test: React.FC<Props> = (props: Props) => {
    const createElement = (text: string) => {
        return (
            <div>
                {text}
            </div>
        );
    };

    return <>{createElement(props.text)}</>;
};
@ljharb
Copy link
Member

ljharb commented Jul 29, 2020

What happens with v7.20.5?

@ljharb
Copy link
Member

ljharb commented Jul 29, 2020

So, specifically, this is likely because React.createElement is what jsx syntax uses.

@ljharb
Copy link
Member

ljharb commented Jul 29, 2020

Also, do you have any idea what linting rule is being applied?

@ljharb
Copy link
Member

ljharb commented Jul 29, 2020

Got a fix anyways.

@ljharb ljharb closed this as completed in 8466625 Jul 29, 2020
@jbizkit
Copy link
Author

jbizkit commented Jul 29, 2020

Can you link the fix PR to this issue @ljharb.

@ljharb
Copy link
Member

ljharb commented Jul 29, 2020

@jbizkit there was no fix PR; it was just the commit, which is linked in the closing message.

@riceboyler
Copy link

@ljharb Can we get a new patch release cut that has this fix in it? We've had to revert to a previous version due to this bug.

@ljharb
Copy link
Member

ljharb commented Aug 6, 2020

Yes, I'll cut one soon.

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

3 participants