问题
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