zoukankan      html  css  js  c++  java
  • vscode 保存时按eslint自动格式化部分代码

    1) First, you need to install the ESLint extension in the VS code.

    This extension uses the ESLint library.If you haven't installed ESLint either locally or globally do so by running

    npm install eslint //For a local install
     or 
    npm install -g eslint //For a global install.
    

    2) Then, open Setting.json file in VS code. by File-> Preferences->Settings.

    3) Add following setting.

     {
        "eslint.enable": true,
        "eslint.autoFixOnSave": true,
        "eslint.run": "onType",
        "eslint.options": {
            "extensions": [".js",".vue"]
        },
        "eslint.validate": [
          "javascript",
          "javascriptreact",
         {
          "language": "html",
          "autoFix": true
         },
         { "language": "vue", "autoFix": true },
         { "language": "js", "autoFix": true }
       ],
    
    }

    4) Now, check your vue file.It will start showing linting error.If not, restart the VS code.

    5) eslint --init

  • 相关阅读:
    Smart Client智能客户端技术
    SaaS介绍
    SaaS介绍
    开源软件介绍
    SaaS介绍
    SaaS介绍
    开源软件介绍
    开源软件介绍
    GPUCUDA安装
    Linux 下的段错误(Segmentation fault)调试方法
  • 原文地址:https://www.cnblogs.com/wtaog/p/9317208.html
Copyright © 2011-2022 走看看