【发布时间】:2017-01-23 09:58:55
【问题描述】:
我在设置 JSCS 以使用 JSX/React 和 ES6 (stage-0) 时遇到困难。它会抛出这样的错误:
Expected end of node list but "Punctuator" found at ./src/base/react/architecture/components/Dummy.component.jsx :
1 |import React, { PropTypes, Component } from 'react';
--------^
和
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';
我无法修复它或找到此问题的原因。
我的配置是:
{
"preset": "airbnb",
"validateIndentation": 4,
"fileExtensions": [
".js",
".jsx"
],
"maxErrors": -1,
"excludeFiles": [
"**/ammap.js",
"**/worldHigh.js",
"**/worldLow.js",
"node_modules/*",
"**/assets/*"
]
}
【问题讨论】:
-
检查您是否拥有最新 (3.0) 版本的 JSCS。另外,考虑切换到ESlint,因为 JSCS 不再维护,而 ESlint 是推荐的迁移方式。
-
我有 v3.0.7,现在迁移到 eslint 的成本很高,因为它在同一个预设(Airbnb)上发现了很多错误,而 JSCS 只像上面提到的 10 个。我对此感到困惑。
标签: reactjs import ecmascript-6 jscs