Warm tip: This article is reproduced from serverfault.com, please click

visual studio code-ESLint不格式化

(visual studio code - ESLint does not format)

发布于 2020-11-30 09:21:56

我有一个简单的项目,只有几个html和js文件。将ESLint扩展安装到VS代码,并将ESLint设置为默认格式化程序:

环境

此外,此设置已全部

设置2

这是我的settings.json文件:

 "window.zoomLevel": 1,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
"eslint.validate": ["javascript"],
  "git.enableSmartCommit": true,
  "eslint.alwaysShowStatus": true,
  "files.autoSave": "off",
  "editor.formatOnSave": true,
  "editor.formatOnPaste": true,
  "editor.formatOnType": true,
  "git.ignoreWindowsGit27Warning": true,
  "eslint.options": {
    "eslint brace-style": [
      "error",
      "allman",
      {
        "allowSingleLine": true
      }
    ]
  },
  "eslint.codeAction.showDocumentation": {

    "enable": true
  },
  "editor.defaultFormatter": "dbaeumer.vscode-eslint",
  "eslint.format.enable": true
}

当按下保存时,ESLint无法在我的js文件上运行(不纠正方括号,空格等)。我之前在React应用程序中使用过ESLint,所以一年前就可以使用。

Questioner
vytaute
Viewed
0
vytaute 2021-01-21 00:46:09

我已经找到了自己的问题的答案:)

后来我收到通知

ESLint is disabled since its execution has not been approved or denied yet. Use the light bulb menu to open the approval dialog.eslint

所以我按这里:

在哪里按

在ESLint上,并允许此扩展程序执行其工作。