Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find Auto Fix On Save button in Visual Studio Code

I was following tutorial to turn on ESLint Auto Fix on saving a file. Tutorial demonstrates to check a checkbox. And I cannot find it. Do I need any extension or smth?

Go to: View -> command pallete -> Preferences: Open Workspace Settings -> Extensions -> ESLint

This is how settings page look like in tutorial:

How settings page should look

this is what I see:

This is what I see

like image 391
vytaute Avatar asked Dec 25 '19 19:12

vytaute


People also ask

How do I fix ESLint on Save VS Code?

If you have the ESLint extension installed you can use CTRL+SHIFT+P to open the Command Palette. Then search for ESLint: Fix all auto-fixable Problems and press ENTER (or RETURN ). You are free from counting indentation and checking for quotation marks and semicolons!

How do I enable format in save VS Code?

Click the “Settings” gear icon in the bottom-left corner. Search “Formatter” and click the “Editor: Default Formatter” option. From the drop-down menu, select whichever code formatter you want to use. Scroll down a bit and check the box next to the “Editor: Format On Save” option.

How do I fix code in VS Code?

Clicking on the Code Action lightbulb or using the Quick Fix command Ctrl+. will display Quick Fixes and refactorings. If you'd just like to see refactorings without Quick Fixes, you can use the Refactor command (Ctrl+Shift+R).


1 Answers

The setting is deprecated. Auto Fix on Save is now part of VS Code's Code Action on Save infrastructure. See the release notes. Just for fun you can bring the checkbox back by adding "eslint.autoFixOnSave": true to your settings.json. However, what you need to add now instead is:

  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
like image 99
hotpink Avatar answered Oct 02 '22 13:10

hotpink