unclosed regular expression

2019-07-02 18:04发布

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条回答
不美不萌又怎样
2楼-- · 2019-07-02 18:24

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!

查看更多
登录 后发表回答