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

ESLint does not format

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

I have simple project, just a few html and js files. Installed ESLint extension to VS code and set ESLint to be a default formater:

setting

also, this setting is turned to all

setting2

And here is my settings.json file:

 "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
}

When pressing save ESLint does not work on my js file (no brackets, spacing, etc. is corrected). I used ESLint before in React application, so it worked a year ago.

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

I have found an answer to my own question :)

I got a notification later on that

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

So I pressed here:

where to press

on ESLint and allowed this extension to do its job.