在VSCode中让JS Intellisense与React一起工作,可以通过以下步骤实现:
npx create-react-app my-app
cd my-app
npm install eslint eslint-plugin-react eslint-plugin-react-hooks --save-dev
{
"extends": [
"react-app",
"plugin:react/recommended"
],
"plugins": [
"react",
"react-hooks"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
],
"javascript.validate.enable": false
}
现在,当你在React项目中编写代码时,VSCode的JS Intellisense将与React一起工作,提供代码补全、语法检查和代码格式化等功能。
企业创新在线学堂
TVP技术夜未眠
云+社区技术沙龙[第8期]
腾讯技术开放日
云+社区技术沙龙[第5期]
云+社区技术沙龙[第9期]
Techo Youth2022学年高校公开课
领取专属 10元无门槛券
手把手带您无忧上云