vscode react-native,vscode
vscode react-native,vscode
vscode
File-perference-settings --workspace settings
Settings.json中,增加 "javascript.validate.enable": false (这个是不启用检查)
2.2)yarn add husky lint-staged prettier
需要先安装yarn,然后重启电脑,原因是增加了环境变量
然后在package.json的第一个{}中最后增加 "precommit": "lint-staged"
然后增加一个json
"lint-staged": {
"src/**/*.{js,jsx,json,css}": [
"prettier --single-quote --write",
"git add"
]
}
2.3)安装prettier flow eslint ,格式化代码
2.4)https://github.com/prettier/eslint-config-prettier
新建一个.eclintrc.json文件,文件中内容
{
"extends": [
"standard",
"plugin:flowtype/recommended",
"plugin:react/recommended",
"prettier",
"prettier/flowtype",
"prettier/react",
"prettier/standard"
],
"plugins": [
"flowtype",
"react",
"prettier",
"standard"
],
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"es6": true,
"node": true
},
"rules": {
"prettier/prettier": "error"
}
}
2.5)重启vscode,安装 eslint
yarn add eslint --dev
2.6)新建.prettierrc
{
"printWidth": 100,
"semi": false,
"singleQuote": true
}
3)使用vscode 进行调试
3.1)vscode安装 react native tools
3.2)使用react native tools调试
在debug android 下面有个配置项,选择那个配置,可以在右边弹出很多项,选择react native:debug android
然后点击三角按钮,进行调试运行
在VScode debug调试出现Could not debug. Unknown error: not all success patterns were matched.
It means that "react-native run-android" command failed. Please, check the View -> Toggle Output -> React-native, View -> Toggle Output -> React-native: Run android output windows.
是什么问题?
原因是没有启动虚拟机。
使用的参考文章
https://blog.csdn.net/guoer9973/article/details/54669885
https://www.bilibili.com/video/av17087983/
https://blog.csdn.net/young_emily/article/details/79005728
相关文章
- 暂无相关文章
用户点评