Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semi-colons in react classes #6

Open
laem opened this issue Jul 29, 2014 · 0 comments
Open

semi-colons in react classes #6

laem opened this issue Jul 29, 2014 · 0 comments

Comments

@laem
Copy link

laem commented Jul 29, 2014

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant