Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESLint does not format

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.

like image 534
vytaute Avatar asked Nov 30 '20 09:11

vytaute


People also ask

Does ESLint do formatting?

ESLint comes with several built-in formatters to control the appearance of the linting results, and supports third-party formatters as well. You can specify a formatter using the --format or -f flag on the command line. For example, --format json uses the json formatter.

Why is ESLint not working?

If ESLint is running in the terminal but not inside VSCode, it is probably because the extension is unable to detect both the local and the global node_modules folders. To verify, press Ctrl+Shift+U in VSCode to open the Output panel after opening a JavaScript file with a known eslint issue.

Why are you prettier over ESLint?

Benefits of using Prettier and ESLint As mentioned earlier, whereas Prettier takes care of your code formatting, ESLint takes care of your code style. The former does everything automatically for you. If you have set up Prettier, you can configure it to format your file on saving it.

How to Lint and format code with ESLint in Visual Studio Code?

How To Lint and Format Code with ESLint in Visual Studio Code Step 1 — Creating JavaScript Starter Code. You need to start with a demo project. ... Open app.js in Visual Studio Code. Step 2 — Setting Up ESLint. It’s important to include the --save-dev flag because this saves the package as a ...

How do I configure ESLint to automatically fix syntax and formatting?

To configure ESLint to automatically fix syntax and formatting issues every time you save, you will need to open the settings menu. To find the settings in Visual Studio Code, click on the gear icon in the lower left, and then choose Settings. Within the settings menu, search for Code Actions on Save.

Why is ESLint not working on my JS file?

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. Show activity on this post. ESLint is disabled since its execution has not been approved or denied yet. Use the light bulb menu to open the approval dialog.eslint

How to share ESLint settings across all ESLint rules?

ESLint supports adding shared settings into configuration files. Plugins use settings to specify information that should be shared across all of its rules. You can add settings object to ESLint configuration file and it will be supplied to every rule being executed.


1 Answers

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.

like image 174
vytaute Avatar answered Nov 13 '22 18:11

vytaute