【问题标题】:ESLint does not formatESLint 不格式化
【发布时间】:2021-01-21 00:46:09
【问题描述】:

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

另外,这个设置变成了全部

这是我的 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,所以它在一年前就可以使用。

【问题讨论】:

    标签: visual-studio-code formatting eslint


    【解决方案1】:

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

    我稍后收到了通知

    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 上并允许此扩展程序完成其工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-06
      • 2021-12-13
      • 1970-01-01
      • 2021-12-15
      • 2020-02-27
      • 1970-01-01
      • 2016-01-12
      • 2023-03-26
      相关资源
      最近更新 更多