vue-cli - 请教一个Javascript的问题

查看:189
本文介绍了vue-cli - 请教一个Javascript的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

var a=1, b=1, c=1;

现在使用了eslint 插件,直接这样比较的话eslint会报错,

a == b == c (true 期望结果)

// eslint报错信息

error  eqeqeq  Expected '===' and instead saw '=='  

但是替换成这样,类型又不对了

a === b === c (false b === c 会返回 true ) 

请问有什么好的办法解决么?

.eslintrc配置

module.exports = {
  root: true,
  // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
  extends: 'standard',
  // required to lint *.vue files
  plugins: [
    'html'
  ],
  // add your custom rules here
  'rules': {
    // allow paren-less arrow functions
    'arrow-parens': 0,
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  }
}

解决方案

a===b && b===c

这篇关于vue-cli - 请教一个Javascript的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆