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

JSHint compatibility #54

Open
adambene opened this issue Oct 11, 2014 · 0 comments
Open

JSHint compatibility #54

adambene opened this issue Oct 11, 2014 · 0 comments

Comments

@adambene
Copy link

When the return value of an async operation is not assigned to a variable, then the result translates into a single expression and it raises a JSHint error.

set timeout! ^ 1000
log "Hello World!"

translates to

(function() {
    var Promise = require("bluebird");
    var gen1_promisify = function(fn) {
        return new Promise(function(onFulfilled, onRejected) {
            fn(function(error, result) {
                if (error) {
                    onRejected(error);
                } else {
                    onFulfilled(result);
                }
            });
        });
    };
    var self = this;
    var gen2_asyncResult;
    new Promise(function(gen3_onFulfilled) {
        gen3_onFulfilled(gen1_promisify(function(gen4_callback) {
            return setTimeout(gen4_callback, 1e3);
        }).then(function(gen2_asyncResult) {
            gen2_asyncResult; // <===== the JSHint error is here
            return log("Hello World!");
        }));
    });
}).call(this);

JSHint error on line 20:

20: Expected an assignment or function call and instead saw an expression
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