Webstorm 不识别es6 import React from ‘react’——webstorm不支持jsx语法怎么办

2016-10-31更新

webstorm不支持es6语法怎么办?

webstorm不支持jsx语法怎么办?

参考:webstorm不支持jsx语法怎么办


I spent ages trying to fix this. Every solution talks about 'setting options'. I don't know what that means. Finally, I figured it out. You can just include a commented out line at the top of the file /*jshint esversion: 6 */.

//如果jsx语法报错 在顶部加入
/*jshint esversion: 6 */这段注释
另外如果提示导入的包报错,请使用双引号 "react","antd"

可以参考这篇文章:http://stackoverflow.com/questions/27441803/why-does-jshint-throw-a-warning-if-i-am-using-const (需要翻墙好像。。。)

最后上张效果图:

原文地址:https://www.cnblogs.com/zxyun/p/5855699.html