Click to save eslint automatic repair--VScode

Click in turn: File-Preferences-Settings, select ESlint, click Edit in settings.json

Insert picture description here

Replace the contents with the following code:

Insert picture description here

{
    
    
    "editor.formatOnSave": true,
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    "eslint.run": "onSave", // 点击保存自动修复
    "eslint.options": {
    
    
        "extensions": [
            ".js",
            ".vue"
        ]
    },
    "editor.codeActionsOnSave": {
    
    
        "source.fixAll.eslint": true 
    },
    "eslint.codeAction.showDocumentation": {
    
    

        "enable": true
    },
}

Original link: https://my.oschina.net/jjyuangu/blog/2998993

Guess you like

Origin blog.csdn.net/weixin_43361722/article/details/113918471