I have a difficulty with setting up JSCS to work with JSX/React and ES6 (stage-0). It throws such errors:
Expected end of node list but "Punctuator" found at ./src/base/react/architecture/components/Dummy.component.jsx :
1 |import React, { PropTypes, Component } from 'react';
--------^
and
Expected end of node list but "Punctuator" found at ./src/base/react/architecture/utils/redux-ext.js :
1 |import React from 'react';
--------^
2 |import Immutable from 'immutable';
3 |import * as reactRedux from 'react-redux';
I wasn't able either to fix it or to find the cause of this problem.
My configuration is:
{
"preset": "airbnb",
"validateIndentation": 4,
"fileExtensions": [
".js",
".jsx"
],
"maxErrors": -1,
"excludeFiles": [
"**/ammap.js",
"**/worldHigh.js",
"**/worldLow.js",
"node_modules/*",
"**/assets/*"
]
}
I had the same problem. After some digging, I nailed it down to the semi-colon in my static propTypes. I am on JSCS 3.0.7 as well. Current workaround (still looking for a better fix):
import React from 'react';
import {connect} from 'react-redux';
//jscs:disable requireSemicolons
//unfortunately had to disable semicolons
const SomeComponent = WrappedComponent => class SomeComponent extends React.Component {
static propTypes = {
somePropType: React.PropTypes.func,
} //semicolon here caused the 'Punctuator' error
constructor (props) {
super(props); ....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.