//安装依赖
npm install
//服务器环境
npm run build
npm run server
//开发环境
npm run start
请启用 prettier 插件,在文件保存时会自动规范代码
插件->prettier->安装
file->setting->搜索 prettier->启用 prettier 插件,并指定 prettier 包地址(需要本地全局安装 prettier 包)->fileWatcher->add 添加 prettier 文件监听,指定 perttier.cmd 执行文件位置
#安装eslint相关包
npm i babel-eslint eslint eslint-config-airbnb eslint-config-prettier eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react
{
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
},
"extends": ["airbnb", "prettier"],
"env": {
"browser": true,
"node": true
},
"rules": {
"arrow-parens": ["off"],
"consistent-return": "off",
"comma-dangle": "off",
"generator-star-spacing": "off",
"jsx-a11y/anchor-is-valid": "off",
"no-console": "off",
"no-use-before-define": "off",
"no-multi-assign": "off"
},
"plugins": ["import", "react"],
"settings": {
"import/resolver": {
"webpack": {
"config": "../webpack.config.eslint.js"
}
}
}
}