-
Notifications
You must be signed in to change notification settings - Fork 15
semi-colons in react classes #6
Copy link
Copy link
Open
Description
Hi,
It appears that sweetjs cannot compile react classes whose functions are written without semi-colons.
E.g. the following code
var React = require('react')
var CommentBox = React.createClass({
hey: function(){
var how = 0 //no semicolon here
if (are){
console.log('you');
}
},
render: function() {
return (
<div className="commentBox">
Hello, world! I am a CommentBox.
</div>
);
}
});
will throw the following error :
Error: Line 4: Unexpected token if
[... how = 0 if ( are ...]
at throwError (/home/mael/.node/lib/node_modules/sweet.js/lib/parser.js:1887:21)
at throwUnexpected (/home/mael/.node/lib/node_modules/sweet.js/lib/parser.js:1933:13)
at consumeSemicolon (/home/mael/.node/lib/node_modules/sweet.js/lib/parser.js:1994:13)
Is this unavoidable ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels