试图修复错误,因为很长一段时间,无法弄清楚为什么我得到错误由于一些在我的react-native项目中,它一直在说'Insert;'/'Insert enter'。
在App.js也显示错误错误:Line 1:9:将View,.Text
替换为.View, .Text.
prettier/prettier
我的.eslintrc.js文件:
module.exports = {
root:true,
extends:'@react-native-community'
}
这是我的pretier .js文件:
module.exports = {
arrowParens:'avoid',
bracketSameLine:true,
bracketSpacing:false,
singleQuote:true,
trailingComma: 'all',
}
App.js第一行
import {View , Text} from 'react-native'
我已经安装了所需的eslint和其他包,但它没有解决。另外,我没有安装任何与它们相关的VScode扩展。如有任何帮助,不胜感激!
您是否尝试过安装更漂亮的代码格式化程序?如何在VS code
中设置保存时的格式?找了很多才找到答案!
对eslintrc.js做如下修改:
模块。出口= {根:没错,延伸:"@react-native-community"规则:{"漂亮/漂亮":0}}
这样问题就解决了!