Eslint Parsing error: Unexpected token
Eslint 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 其他选项。
我从 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 其他选项。