vscode格式的带有eslint的行

问题描述

在我当前的项目中,有几个开发人员使用不同的编码样式。因此,我需要使用以下设置配置vscode

  1. 仅格式化由我更改的行
  2. 格式化应仅在保存时运行
  3. 可以从eslint切换到tslint

我当前的配置:

{
  "editor.formatOnPaste": false,"editor.formatOnType": false,"editor.formatOnSave": false,"editor.insertSpaces": true,"editor.defaultFormatter": "esbenp.prettier-vscode","[typescript]": {
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": true
    }
  },"[javascript]": {
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": true
    }
  },"[json]": {
    "editor.formatOnSave": true
  },}

好吧,我也希望听到开发人员在Vim中工作时如何解决类似的问题(因为有时我会使用它)。谢谢!

解决方法

2020年8月的更新带有“仅修改格式”选项 https://code.visualstudio.com/updates/v1_49#_only-format-modified-text 那应该涵盖1.和2.我相信。

如果您想通过eslint --fix进行格式化,那也是我在寻找答案的东西。 only "eslint --fix" modified lines

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...