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)}</>;
};
What happens with v7.20.5?
So, specifically, this is likely because React.createElement is what jsx syntax uses.
Also, do you have any idea what linting rule is being applied?
Got a fix anyways.
Can you link the fix PR to this issue @ljharb.
@jbizkit there was no fix PR; it was just the commit, which is linked in the closing message.
@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.
Yes, I'll cut one soon.