React 15.x升级到16.x 运行环境报警告的解决方案

在git_carvip项目升级React到16.8.0版本,运行npm run devreact laidiantong的时候,会发现有一句警告提示,Warning: React version not specified in eslint-plugin-react settings. See github.com/yannickcr/e… 。如图:


虽然程序可以正常的运行,但是看到这句话还是有些不爽。看了内容可以定位是eslint验证react版本发生的警告,百度了一番,发现真的没有这个问题存在,后来在github上的eslint-plugin-react插件中发现很多人问了这个问题。大概就是在.eslinttrc.json中加入

"settings": {
     "react": {                  
          "version": "detect" // React version. "detect" automatically picks the version you have installed.                                               
                              // You can also use `16.0`, `16.3`, etc, if you want to override the detected value.                                              
                              // default to latest and warns if missing                                             
                              // It will default to "detect" in the future                 
     }
}复制代码
老外把version设置成999.999.999,测试了一下也好用。加上这段设置代码运行如下图:



转载于:https://juejin.im/post/5c90da695188252daa18ec21

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值