2023年7月18日发(作者:)
[HBuilderX开发uniapp]⾃动代码格式化插件安装及配置⼀、前⾔HBuilderX作为H5 web开发的IDE其使⽤的普及化⼤幅提⾼,在应⽤中为使代码更加优美明晰,⾃动化格式代码插件的配置在我们编译过程中为我们提供极⼤的便利⼆、插件位置1.在HBuilderX中找到⼯具------>插件安装2.点击“安装新插件”------>"前往插件市场安装" 3.插件市场搜索eslint----->点击下载------>使⽤HBuilderX导⼊插件 : ⽤于js和html中的代码校验-plugin-vue:⽤于vue内的代码校验(因此两个都需要下载)
4. 下载后找到设置--->⼯具--->插件配置---->保存时⾃动修复 三、⼩结⾄此⾃动保存代码插件下载配置已经完成。四、补充因为每个⼈的代码习惯不同,格式化代码要求也有所不⼀,想要依据⾃⼰的习惯进⾏细节配置可以继续看1.⼯具--->插件安装--->已安装插件--->配置 2.⾃定义校验规则 3.可根据需要⾃⾏寻找符合⾃⼰需求的配置信息复制到⾃⼰的17181920//更详细的配置⽂档请参考:/vuejs/eslint-plugin-vue#s = { "extends": "plugin:vue/base", parserOptions: { ecmaVersion: 2017, sourceType: 'module' }, 'settings': { 'html/html-extensions': [ ".erb", ".handlebars", ".hbs", ".htm", ".html", ".mustache", ".nunjucks", ".php", ".tag", ".twig", ".wxml",2627282936373839464748495657585966676869767778798 ".wxml", ".we", ] }, "rules":{ //在computed properties中禁⽤异步actions 'vue/no-async-in-computed-properties': 'error', //不允许重复的keys 'vue/no-dupe-keys': 'error', //不允许重复的attributes 'vue/no-duplicate-attributes': 'warn', //在 标签下不允许解析错误 'vue/no-parsing-error': ['error',{ 'x-invalid-end-tag': false, }], //不允许覆盖保留关键字 'vue/no-reserved-keys': 'error', //强制data必须是⼀个带返回值的函数 // 'vue/no-shared-component-data': 'error', //不允许在computed properties中出现副作⽤。 'vue/no-side-effects-in-computed-properties': 'error', //不允许key属性 'vue/no-template-key': 'warn', //在
'vue/return-in-computed-property': 'error', // 强制校验 template 根节点 'vue/valid-template-root': 'error', // 强制校验 v-bind 指令 'vue/valid-v-bind': 'error', // 强制校验 v-cloak 指令 'vue/valid-v-cloak': 'error', // 强制校验 v-else-if 指令 'vue/valid-v-else-if': 'error', // 强制校验 v-else 指令
'vue/valid-v-else': 'error', // 强制校验 v-for 指令 'vue/valid-v-for': 'error', // 强制校验 v-html 指令 'vue/valid-v-html': 'error', // 强制校验 v-if 指令 'vue/valid-v-if': 'error', // 强制校验 v-model 指令 'vue/valid-v-model': 'error', // 强制校验 v-on 指令 'vue/valid-v-on': 'error', // 强制校验 v-once 指令 'vue/valid-v-once': 'error', // 强制校验 v-pre 指令 'vue/valid-v-pre': 'error', // 强制校验 v-show 指令 'vue/valid-v-show': 'error', // 强制校验 v-text 指令 'vue/valid-v-text': 'error', 'vue/comment-directive': 0858687 'vue/comment-directive': 0 }}; 4.⾃⼰的
发布者:admin,转转请注明出处:http://www.yc00.com/news/1689629811a272210.html
评论列表(0条)