vue 代码规范 运行报错 信息统计

2024-01-25  本文已影响0人  IssunRadiance
  1. Extra space after key 'xxx' (key-spacing)
// 对象下面的key 后面 有空格
this.data_from = {
  supplier_status : 1
}
  1. Expected space(s) after "if" (keyword-spacing)
// if 后面需要加一个空格
if() {}
  1. Strings must use singlequote (quotes)
// 字符串必须使用单引号
this.data_from = {
  supplier_status: "1"
}
  1. Empty block statement (no-empty)
// 不能出现空块语句
if (this.num_address == 1) {

} else {
  this.num = 1
}
  1. Block must not be padded by blank lines (padded-blocks)
// 不能用空行填充
if (supplier_id) {

  if (!this.supplier_name) {
    return false;
  }
}
  1. Expected 1 space before '}}', but not found (vue/mustache-interpolation-spacing)
// }} 前 应该有一个空格,但是没找到
{{data_from.social_code?data_from.social_code:'--'}}
  1. Attribute "v-if" should go before "class" (vue/attributes-order)
// v-if”应位于“class”之前
<span class="formItem" v-if="is_edit==1">1</span>
  1. 'data' is already defined (no-redeclare)
// 变量已经被声明
var data = 1;
var data = 2;
  1. Require self-closing on Vue.js custom components (<el-date-picker>)
// 需要在组件上自动关闭
<el-date-picker v-model="time"  size="mini"type="date"></el-date-picker>
// 改为
<el-date-picker v-model="time"  size="mini"type="date" />
  1. Unexpected trailing comma (comma-dangle)
// UTC  对象多数组的结尾不需要逗号
const arr = [1, 2, 3,];
const obj = {a: 1, b: 2,};
  1. Expected indentation of 2 spaces but found 3 spaces (vue/html-indent)
// 预期缩进2个空格,但是找到3个空格
   <span></span>
  1. There should be no spaces inside this paren (space-in-parens)
// paren 中不应该有空格
.catch( () => {})
  1. Expected space or tab after '//' in comment (spaced-comment)
//  // 后面要有空格
//先判断当前是否存在supplier_id
  1. 'cope' is never reassigned. Use 'const' instead (prefer-const)
// 改用const
let cope = {
  finance_type: ''
}
  1. Operator '*' must be spaced (space-infix-ops)
// 运算符必须空格间隔
this.supplier_id = this.supplier_id*1
  1. Newline required at end of file but not found (eol-last)
// 结尾需要加一个换行符
  1. 'xxx' is defined but never used (no-unused-vars)
// 被定义了,但是没有被用到
  1. Expected error to be handled (handle-callback-err)
// 回调函数中的参数没有被用到(error)
.catch(error => {
  this.uploadFormFileList = []
})
上一篇下一篇

猜你喜欢

热点阅读