Skip to content

Error while loading rule 'react/prefer-stateless-function': Cannot read property 'version' of null Occurred while linting #3219

Closed
@tipleavalentin

Description

@tipleavalentin

Hi!

I found a bug, please take a look, thanks!

npx eslint src_site/pages/HomePage.js

Oops! Something went wrong! :(

ESLint: 8.8.0

TypeError: Error while loading rule 'react/prefer-stateless-function': Cannot read properties of null (reading 'version')
Occurred while linting D:\project\src_site\pages\HomePage.js
at getReactVersionFromContext (D:\project\node_modules\eslint-plugin-react\lib\util\version.js:92:81)
at testReactVersion (D:\project\node_modules\eslint-plugin-react\lib\util\version.js:138:28)
at usedPropTypesInstructions (D:\project\node_modules\eslint-plugin-react\lib\util\usedPropTypes.js:285:36)
at Function.componentRule (D:\project\node_modules\eslint-plugin-react\lib\util\Components.js:1018:37)
at createRuleListeners (D:\project\node_modules\eslint\lib\linter\linter.js:915:21)
at D:\project\node_modules\eslint\lib\linter\linter.js:1097:31
at Array.forEach ()
at runRules (D:\project\node_modules\eslint\lib\linter\linter.js:1034:34)
at Linter._verifyWithoutProcessors (D:\project\node_modules\eslint\lib\linter\linter.js:1382:31)
at Linter._verifyWithConfigArray (D:\project\node_modules\eslint\lib\linter\linter.js:1722:21)

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions