Auto-check code and format configuration when vscode saves

When developing with [vscode] , it will suddenly appear that the formatting code fails when saving. There are many configurations, but none of them take effect. After seeing the eslint official website, I found that the eslint plug-in should be configured, and it can be solved.

  1. Install the Eslint plugin

  2. In the configuration button of the plugin, click the extension settings

3. Add configuration directly:

  1. The most important configuration is to save and automatically repair eslint verification

//Run to run eslint check (onSave save) (onType input) 
    "" : "onType" ,
     //Control which problems are fixed when running code actions on save 
    "editor.codeActionsOnSave" : {
         // All auto-fixable eslint errors from all plugins will be fixed on save 
        "source.fixAll.eslint" : true 

Leave a Comment

Your email address will not be published. Required fields are marked *