no-unused-prop-types: Cannot read property 'name' of null
AriPerkkio opened this issue · comments
Hello, I'm testing stability of well known community ESlint plugins with eslint-remote-tester
. This ESLint plugin seems to contain a rule which causes linter to crash. ESlint rules should not crash in any condition since this makes all valid linting problems disappear. If this is a false flag please let me know.
CI run: https://github.com/AriPerkkio/eslint-remote-tester/actions/runs/404195599
Crashing rule:
no-unused-prop-types
Minimal repro:
const rows = [];
function mapStateToProps(state, props) {
for (const { value } of rows) {
}
}
Error crashes from real-world examples
Rule: no-unused-prop-types
Message: Cannot read property 'name' of null
Path: oknosoft/windowbuilder/src/components/CalcOrder/ClientOfDealerSearch/connect.js
Link
})
.then(({rows}) => {
// сворачиваем
const res = {};
for (const {value} of rows) {
const id = `${value[2]} ${value[1]}`;
if(!res[value[0]]) {
res[value[0]] = [id];
}
else {
Error:
TypeError: Cannot read property 'name' of null
Occurred while linting <text>:28
at checkProp (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/rules/no-unused-prop-types.js:13:93)
at belongsToReduxReact (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/rules/no-unused-prop-types.js:31:11)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/rules/no-unused-prop-types.js:67:27
at Array.some (<anonymous>)
at ObjectPattern (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react-redux/lib/rules/no-unused-prop-types.js:67:10)
at ObjectPattern (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-rule-composer/lib/rule-composer.js:210:41)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/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/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
Beautiful! I love the initiative. Thanks for testing this plugin. I will look into fixing this and other issue you reported.