美文网首页
estlint -Cannot read property 'r

estlint -Cannot read property 'r

作者: YoungEvita | 来源:发表于2021-05-24 20:16 被阅读0次

问题

修改了.eslintrc.js文件中默认缩进为4个之后

"rules": {
      'indent': ['warn', 4]
}

编译出现"Cannot read property 'range' of null

eslint error.png

解决方法

方法一

卸载babel-eslint 重新安装
可以先进行清除cache之后,再进行安装

  npm cache clean
  npm install
  npm cache clean // npm cache clean --force 
方法二

增加‘ignoredNodes’配置

"rules": {
      'indent': ['warn', 4, {
                'ignoredNodes': ['TemplateLiteral']
      }]
}

参考

eslint error cannot read property 'range' of null

相关文章

网友评论

      本文标题:estlint -Cannot read property 'r

      本文链接:https://www.haomeiwen.com/subject/kqcfsltx.html