vscode-settings.json配置(prettier + eslint)

栏目: JavaScript · 发布时间: 5年前

内容简介:在项目根目录新建.vscode文件夹,文件夹中新建settings.json覆盖全局的setings.json文件,配置同上

command + p 搜索到settings.json文件,文件配置及注释如下

"workbench.iconTheme": "vscode-icons-mac",
  "editor.renderIndentGuides": false,
  "cSpell.ignoreWords": ["antd"],
  //编辑器失去焦点时自动保存更新后的文件
  "files.autoSave": "onFocusChange",
  "workbench.colorTheme": "Monokai",
  "git.confirmSync": false,
  "window.title": "${activeEditorLong}${separator}${rootName}",
  "window.zoomLevel": 0,
  "editor.fontSize": 14,
  //为了符合eslint的两个空格间隔原则
  "editor.tabSize": 2,
  // 文件头部注释
  "fileheader.Author": "niuchunling",
  "fileheader.LastModifiedBy": "niuchunling",
  //关闭编辑器默认代码检查,为了不跟eslint配置冲突
  "editor.formatOnSave": false,
  "javascript.format.enable": false,
  //eslint 格式化插件,保存时应用eslint规则自动格式化后保存
  "eslint.autoFixOnSave": true,
  "prettier.eslintIntegration": true,
  // 去掉代码结尾分号
  "prettier.semi": false,
  "git.path": "/usr/bin/git",
  "editor.fontFamily": "Microsoft YaHei,Menlo, Monaco, 'Courier New', monospace",
  "editor.fontWeight": "bold",
  "javascript.updateImportsOnFileMove.enabled": "never",
  "explorer.confirmDragAndDrop": false
}
复制代码

2、 设置项目自己的规则

在项目根目录新建.vscode文件夹,文件夹中新建settings.json覆盖全局的setings.json文件,配置同上

tips: 以上都是基于几个前提

  • 编辑器安装了Prettier - Code formatter 插件并启用
  • 项目配置了使用eslint
  • fileheader相关配置是安装了Document This插件

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Elements of Information Theory

Elements of Information Theory

Thomas M. Cover、Joy A. Thomas / Wiley-Blackwell / 2006-7 / GBP 76.50

The latest edition of this classic is updated with new problem sets and material The Second Edition of this fundamental textbook maintains the book's tradition of clear, thought-provoking instr......一起来看看 《Elements of Information Theory》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

MD5 加密
MD5 加密

MD5 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具