[英]ESLint Unexpected Parsing error with Atom & React Native
While playing around with a simple react-native setup, I suddenly stumbled upon some (maybe not so) weird ESLint stuff. 在玩一个简单的本机设置时,我突然发现了一些(也许不是这样)奇怪的ESLint东西。
Here is my Javascript file: 这是我的Javascript文件:
import React from 'react';
import { Text, View } from 'react-native';
const Header = () => {
const { textStyle } = styles;
return (
<View>
<Text style={textStyle}>App Header!</Text>
<View/>
);
};
const styles = {
textStyle: {
fontSize: 20
}
};
export default Header;
The issue comes as the following ESLint error in textStyle: {
line: 该问题来自textStyle中的以下ESLint错误
textStyle: {
行:
Parsing error: Unexpected token, expected "}" (Fatal)
I have installed latest linter
(v2.2.0) and linter-eslint
(v8.4.1) packages in Atom
. 我已经安装了最新的
linter
(V2.2.0)和linter-eslint
(V8.4.1)封装Atom
。
I am using a predefined set of rules from the npm
package rally-coding
that I have installed as a dev dependency in the project, and here's my .eslintrc
file: 我使用的是
npm
软件包rally-coding
中的一组预定义规则,这些规则已作为dev依赖项安装在项目中,这是我的.eslintrc
文件:
{
"extends": "rallycoding",
"parser": "babel-eslint",
"ecmaFeatures": {
"jsx": true
}
}
Any ideas where this might be coming from? 任何想法可能从何而来? None of the workarounds suggested in the (many) Github issues threads helped so far.
到目前为止,(很多)Github问题线程中建议的任何变通办法都没有帮助。
Syntax error is caused by a not closed View
tag. 语法错误是由未关闭的
View
标记引起的。
<View/>
should be </View>
<View/>
应该是</View>
Side note: linter is not always really accurate with these sort of errors. 旁注:对于这些错误,lint并不总是很准确。 A small suggestion is that always check if you closed all your tags if you had a
expected "}"
error and already checked all your }
一个小建议是,如果出现
expected "}"
错误并已经检查了所有}
,请务必检查是否关闭了所有标签
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.