[英]Eslint Parsing error: Unexpected token
I'm getting the error Parsing error: Unexpected token ..
from eslint for this snippet. 我收到此代码段的错误Parsing error: Unexpected token ..
来自eslint的 Parsing error: Unexpected token ..
What's wrong with that? 怎么了
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="/" />);
}} />
)
You probably need to configure eslint to use the right parser for your project. 您可能需要将eslint配置为对项目使用正确的解析器。 If you're using babel you'll need babel-eslint: 如果您正在使用babel,则需要babel-eslint:
npm install --save-dev babel-eslint
And then add this to your .eslintrc file: 然后将其添加到您的.eslintrc文件中:
{
...
"parser": "babel-eslint"
}
If you're not using babel check out http://eslint.org/docs/user-guide/configuring#specifying-parser-options for other options. 如果您不使用babel,请查看http://eslint.org/docs/user-guide/configuring#specifying-parser-options中的其他选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.