unclosed regular expression

雨燕双飞 提交于 2020-01-14 14:37:07

问题


I have the following code:

render() {  
         /* jshint laxbreak: true */  
         var buttonClasses = classSet({  
              'Button' : true,  
        }),  
        buttonContainerClasses = classSet({  
          'u-textRight': !this.props.fullscreen  
        }),  
        allowedTypes = /^(submit|button)$/i,  
        type = allowedTypes.test(this.props.type)  
             ? this.props.type  
             : 'button';  

    return (  
      <div className={buttonContainerClasses}>  
        <input  
          type = {type}  
          value = {this.props.label}  
        />  
      </div>  
   );  
}  

and JSHint is giving me the following error:

Unclosed regular expression

on the line that closes the input tag (second last line). I'm currently trying to upgrade to React 0.12.2, and im fixing up all the errors. Any ideas how to fix it?


回答1:


I've worked it out! So in React 0.12, the pragma can be removed, however lint won't work without it, hence the error popping up. Thank you to everyone who helped out!



来源:https://stackoverflow.com/questions/29403094/unclosed-regular-expression

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!