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

mapStateToProps-prefer-hoisted: Cannot read property 'type' of null #63

Closed
AriPerkkio opened this issue Dec 17, 2020 · 1 comment · Fixed by #64
Closed

mapStateToProps-prefer-hoisted: Cannot read property 'type' of null #63

AriPerkkio opened this issue Dec 17, 2020 · 1 comment · Fixed by #64
Labels

Comments

@AriPerkkio
Copy link

Hello, mapStateToProps-prefer-hoisted rule seems to crash in certain cases. This issue was spotted by automated CI run - it is not blocking my development or anything. https://github.com/AriPerkkio/eslint-remote-tester/runs/1569548843?check_suite_focus=true

This plugin had only a single rule crashing after linting over 10K repositories in 6 hours. [INFO/STATUS] Repositories (11428/14527) 👍

"eslint-plugin-react-redux": "3.3.1",
  "plugins": ["react-redux"],
  "rules": {
    "react-redux/mapStateToProps-prefer-hoisted": "error"
  }

Minimal repro:

const mapStateToProps = () => {
    return;
};
TypeError: Cannot read property 'type' of null
Occurred while linting <text>:74
    at Object.getReturnNode (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/utils.js:19:15)
    at checkFunction(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/rules/mapStateToProps-prefer-hoisted.js:34:28)
Crash reports from real projects

Rule: mapStateToProps-prefer-hoisted

  • Message: Cannot read property 'type' of null Occurred while linting <text>:74
  • Path: kaanbayram/React.js_Kafka_Node.js_Chat_app/kafka_client/src/components/CreateTopic.js
  • Link
}


const mapStateToProps = ({messagesResponse}) => {
    return ;
};


export default connect(mapStateToProps,
{createTopic,getTopics,set_Topic,postTopic})(CreateTopic);
TypeError: Cannot read property 'type' of null
Occurred while linting <text>:74
    at Object.getReturnNode (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/utils.js:19:15)
    at checkFunction(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/rules/mapStateToProps-prefer-hoisted.js:34:28)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/rules/mapStateToProps-prefer-hoisted.js:46:11
    at Array.forEach (<anonymous>)
    at VariableDeclaration(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/rules/mapStateToProps-prefer-hoisted.js:43:25)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
@github-actions
Copy link

github-actions bot commented Jan 7, 2021

🎉 This issue has been resolved in version 3.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant