[英]Eslint Parsing error: Unexpected token
我收到此代碼段的錯誤Parsing error: Unexpected token ..
來自eslint的 Parsing error: Unexpected token ..
怎么了
const Public = ({ loggingIn, authenticated, component, ...rest }) => (
<Route {...rest} render={(props) => {
if (loggingIn) return <div></div>
return !authenticated
? (React.createElement(component, { ...props, loggingIn, authenticated }))
: (<Redirect to="/" />);
}} />
)
您可能需要將eslint配置為對項目使用正確的解析器。 如果您正在使用babel,則需要babel-eslint:
npm install --save-dev babel-eslint
然后將其添加到您的.eslintrc文件中:
{
...
"parser": "babel-eslint"
}
如果您不使用babel,請查看http://eslint.org/docs/user-guide/configuring#specifying-parser-options中的其他選項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.