Closed
Description
Got an error, probably some es7 case?
Cannot read property 'type' of null
TypeError: Cannot read property 'type' of null
at EventEmitter.ClassProperty (/Users/roadhump/Projects/Targetprocess/Mashups/ViewGallery/node_modules/eslint-plugin-react/lib/rules/jsx-sort-prop-types.js:64:53)
at emitOne (events.js:82:20)
at EventEmitter.emit (events.js:169:7)
at Controller.controller.traverse.enter (/Users/roadhump/Projects/Targetprocess/Mashups/ViewGallery/node_modules/eslint/lib/eslint.js:728:25)
at Controller.__execute (/Users/roadhump/Projects/Targetprocess/Mashups/ViewGallery/node_modules/eslint/node_modules/estraverse/estraverse.js:393:31)
at Controller.traverse (/Users/roadhump/Projects/Targetprocess/Mashups/ViewGallery/node_modules/eslint/node_modules/estraverse/estraverse.js:491:28)
at EventEmitter.module.exports.api.verify (/Users/roadhump/Projects/Targetprocess/Mashups/ViewGallery/node_modules/eslint/lib/eslint.js:721:24)
at processText (/Users/roadhump/Projects/Targetprocess/Mashups/ViewGallery/node_modules/eslint/lib/cli-engine.js:201:27)
at CLIEngine.executeOnText (/Users/roadhump/Projects/Targetprocess/Mashups/ViewGallery/node_modules/eslint/lib/cli-engine.js:361:26)
at Object.cli.execute (/Users/roadhump/Projects/Targetprocess/Mashups/ViewGallery/node_modules/eslint/lib/cli.js:179:70)
.babelrc
{
"stage": 0
}
Code
var React, {Component, PropTypes} = require('react');
export default class HelpTooltipsManager extends Component {
propTypes: {
dispatch: PropTypes.func.isRequired,
items: PropTypes.array.isRequired,
visibility: PropTypes.object.isRequired
}
}
Activity
mathieumg commentedon Jun 25, 2015
Totally unrelated, by just out of curiosity, why do you not use the
import
syntax?yannickcr commentedon Jun 25, 2015
Seems your code is not valid, it should be
propTypes =
instead ofpropTypes:
.In this case Babel do not trigger any error but it does not attach the propTypes method to the outputed class.
However, I will patch the rule to avoid the crash but I will be difficult for us to validate the propTypes order since Babel does not output much informations here.
roadhump commentedon Jun 25, 2015
@mathieumg I just rewrite my old code and some things are out of my attention, it will be import there.
roadhump commentedon Jun 25, 2015
@yannickcr thanks. I thought that if code are not valid, babel will not parse it at all.
yannickcr commentedon Jun 25, 2015
@roadhump yes, in it should not parse it, but there is a few cases were it accept invalid code (like in #125). I don't know if it can be considered as a bug or not.
Fix invalid class property handling in jsx-sort-prop-types (fixes #129)
fix(deps): update dependency eslint-plugin-react to v7.35.0
fix(deps): update dependency eslint-plugin-react to v7.35.0
32 remaining items