前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >前端-团队效率(二)代码规范

前端-团队效率(二)代码规范

作者头像
吴文周
发布2020-01-17 16:07:34
1.3K0
发布2020-01-17 16:07:34
举报
文章被收录于专栏:吴文周的专栏吴文周的专栏

团队协作中最重要的一点就是代码规范

  1. 开发规范文档为尺度
  2. vscode编码格式为利刃(文章结尾分享本人使用的vscode配置)
  3. 插件(重要) Beautify css/sass/scss/less,Chinese (Simplified) Language Pack for Visual Studio Code,ESLint,Git History,Git Project Manager,GitLens — Git supercharged,Path Intellisense,Vetur,npm,Live Server,koroFileHeader,Terminal
  4. 插件(不那么重要)Bracket Pair Colorizer,Code Spell Checker,Comment Translate
  5. 其他语言

{

// vscode默认启用了根据文件类型自动设置tabsize的选项

"editor.detectIndentation": false,

// 重新设定tabsize

"editor.tabSize": 2,

// #每次保存的时候自动格式化

"editor.formatOnSave": true,

// #每次保存的时候将代码按eslint格式进行修复

"eslint.autoFixOnSave": true,

// 添加 vue 支持

"eslint.validate": [

"javascript",

"javascriptreact",

{

"language": "vue",

"autoFix": true

}

],

// "javascript.suggest.autoImports": true,

// #让prettier使用eslint的代码格式进行校验

"prettier.eslintIntegration": true,

// #去掉代码结尾的分号

"prettier.semi": false,

// #使用带引号替代双引号

"prettier.singleQuote": true,

// #让函数(名)和后面的括号之间加个空格

"javascript.format.insertSpaceBeforeFunctionParenthesis": true,

// #这个按用户自身习惯选择

"vetur.format.defaultFormatter.html": "js-beautify-html",

// #让vue中的js按编辑器自带的ts格式进行格式化

"vetur.format.defaultFormatter.js": "vscode-typescript",

"vetur.format.defaultFormatterOptions": {

"js-beautify-html": {

"wrap_attributes": "force-aligned"

// #vue组件中html代码格式化样式

}

},

"explorer.confirmDelete": false,

"fileheader.customMade": {

"Description": "描述",

"Author": "吴文周",

"Github": "https://github.com/fodelf",

"Date": "Do not edit", // 文件创建时间(不变)

"LastEditors": "吴文周", // 文件最后编辑者

"LastEditTime": "Do not edit" // 文件最后编辑时间

},

// 函数注释

"fileheader.cursorMode": {

"name": "默认名称",

"description": "默认描述",

"param {type}": "默认参数",

"return {type}": "默认类型",

},

// 将该选项设置为true即可开启

"fileheader.configObj": {

"autoAdd": true,

},

"files.associations": {

"*.cjson": "jsonc",

"*.wxss": "css",

"*.wxs": "javascript",

"*.vue": "vue"

},

"editor.suggestSelection": "first",

"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",

"[javascript]": {

"editor.defaultFormatter": "esbenp.prettier-vscode"

},

// "npm-intellisense.scanDevDependencies": true,

// "npm-intellisense.importES6": true,

// "npm-intellisense.importQuotes": "'",

// "npm-intellisense.importLinebreak": ";\r\n",

// "npm-intellisense.importDeclarationType": "const",

}

代码语言:javascript
复制
{  // vscode默认启用了根据文件类型自动设置tabsize的选项  "editor.detectIndentation": false,  // 重新设定tabsize  "editor.tabSize": 2,  // #每次保存的时候自动格式化   "editor.formatOnSave": true,  // #每次保存的时候将代码按eslint格式进行修复  "eslint.autoFixOnSave": true,  // 添加 vue 支持  "eslint.validate": [    "javascript",    "javascriptreact",    {      "language": "vue",      "autoFix": true    }  ],  // "javascript.suggest.autoImports": true,  //  #让prettier使用eslint的代码格式进行校验   "prettier.eslintIntegration": true,  //  #去掉代码结尾的分号   "prettier.semi": false,  //  #使用带引号替代双引号   "prettier.singleQuote": true,  //  #让函数(名)和后面的括号之间加个空格  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,  // #这个按用户自身习惯选择   "vetur.format.defaultFormatter.html": "js-beautify-html",  // #让vue中的js按编辑器自带的ts格式进行格式化   "vetur.format.defaultFormatter.js": "vscode-typescript",  "vetur.format.defaultFormatterOptions": {    "js-beautify-html": {      "wrap_attributes": "force-aligned"      // #vue组件中html代码格式化样式    }  },  "explorer.confirmDelete": false,  "fileheader.customMade": {    "Description": "描述",    "Author": "吴文周",    "Github": "https://github.com/fodelf",    "Date": "Do not edit", // 文件创建时间(不变)    "LastEditors": "吴文周", // 文件最后编辑者    "LastEditTime": "Do not edit" // 文件最后编辑时间  },  // 函数注释   "fileheader.cursorMode": {    "name": "默认名称",    "description": "默认描述",    "param {type}": "默认参数",    "return {type}": "默认类型",  },  // 将该选项设置为true即可开启  "fileheader.configObj": {    "autoAdd": true,  },  "files.associations": {    "*.cjson": "jsonc",    "*.wxss": "css",    "*.wxs": "javascript",    "*.vue": "vue"  },  "editor.suggestSelection": "first",  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",  "[javascript]": {    "editor.defaultFormatter": "esbenp.prettier-vscode"  },  // "npm-intellisense.scanDevDependencies": true,  // "npm-intellisense.importES6": true,  // "npm-intellisense.importQuotes": "'",  // "npm-intellisense.importLinebreak": ";\r\n",  // "npm-intellisense.importDeclarationType": "const",}
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年10月13日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 团队协作中最重要的一点就是代码规范
相关产品与服务
Prowork 团队协同
ProWork 团队协同(以下简称 ProWork )是便捷高效的协同平台,为团队中的不同角色提供支持。团队成员可以通过日历、清单来规划每⽇的工作,同时管理者也可以通过统计报表随时掌握团队状况。ProWork 摒弃了僵化的流程,通过灵活轻量的任务管理体系,满足不同团队的实际情况,目前 ProWork 所有功能均可免费使用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档