博客
关于我
前端工程化:wepy配置vscode代码格式化
阅读量:304 次
发布时间:2019-03-01

本文共 984 字,大约阅读时间需要 3 分钟。

Vetur插件配置指南

安装插件Vetur是一个强大的Vue工具链插件,安装前可以通过以下步骤完成配置:

  • 打开你的项目,在终端输入以下命令安装插件:
  • npm install vetur-wepy --save-dev

    创建配置文件在你的项目根目录下,新建一个.vscode/settings.json文件,添加必要的配置内容:

    {    "editor.defaultFormatter": "hu2ren.vetur-wepy",    "vetur.validation.script": false,    "vetur.validation.interpolation": false,    "vetur.validation.template": false,    "vetur.format.defaultFormatter.js": "none",    "vetur.format.defaultFormatter.html": "js-beautify-html",    "editor.formatOnSave": true,    "eslint.run": "onSave",    "eslint.validate": ["vue"],    "editor.codeActionsOnSave": {        "source.fixAll": true,        "source.fixAll.stylelint": true    }}

    配置说明上述配置文件主要包含以下几个关键设置:

    • editor.defaultFormatter:指定代码格式化器,默认使用Vetur的formatter。
    • vetur.format.defaultFormatter.html:设置HTML文件的格式化方式。
    • editor.formatOnSave:启用格式化保存功能。
    • eslint.run:设置ESLint的运行方式。
    • editor.codeActionsOnSave:定义保存时的代码修复规则。

    结果测试在完成以上配置后,你可以按照以下步骤进行测试:

  • 保存你的HTML、CSS或JS文件
  • IDE会自动触发格式化和校验
  • 查看输出结果,确保格式正确
  • 通过以上配置,你可以在每次保存时自动校验代码格式和ESLint规则,提升开发效率。

    转载地址:http://rmpo.baihongyu.com/

    你可能感兴趣的文章
    npm install CERT_HAS_EXPIRED解决方法
    查看>>
    npm install digital envelope routines::unsupported解决方法
    查看>>
    npm install 卡着不动的解决方法
    查看>>
    npm install 报错 EEXIST File exists 的解决方法
    查看>>
    npm install 报错 ERR_SOCKET_TIMEOUT 的解决方法
    查看>>
    npm install 报错 Failed to connect to github.com port 443 的解决方法
    查看>>
    npm install 报错 fatal: unable to connect to github.com 的解决方法
    查看>>
    npm install 报错 no such file or directory 的解决方法
    查看>>
    npm install 权限问题
    查看>>
    npm install报错,证书验证失败unable to get local issuer certificate
    查看>>
    npm install无法生成node_modules的解决方法
    查看>>
    npm install的--save和--save-dev使用说明
    查看>>
    npm node pm2相关问题
    查看>>
    npm run build 失败Compiler server unexpectedly exited with code: null and signal: SIGBUS
    查看>>
    npm run build报Cannot find module错误的解决方法
    查看>>
    npm run build部署到云服务器中的Nginx(图文配置)
    查看>>
    npm run dev 和npm dev、npm run start和npm start、npm run serve和npm serve等的区别
    查看>>
    npm run dev 报错PS ‘vite‘ 不是内部或外部命令,也不是可运行的程序或批处理文件。
    查看>>
    npm scripts 使用指南
    查看>>
    npm should be run outside of the node repl, in your normal shell
    查看>>