jdavisclark / JsFormat

Javascript formatting for Sublime Text 2 & 3
1.42k stars 222 forks source link

Breaks async/await #181

Closed etiennea closed 6 years ago

etiennea commented 7 years ago

My problem is that async (req, res) => {} gets formatted to async(req, res) => {}

The space that get removed makes this invalid, this rule should not happen when there is an async.

jdavisclark commented 6 years ago

@etiennea: what javascript platform are you on? node? on node v8.1.4 I have no issues with or without the space. That said, I don't think JsBeautifier exposes a setting to control this right now.

e.g. this works fine, no syntax errors:

var Promise = require("bluebird");

async function main() {
    var wait = async(interval) => {
        return Promise.delay(interval, "all done");
    };

    var message = await wait(5000);
    console.log(message);
}

main();
bitwiseman commented 6 years ago

@jdc0589 @etiennea also this is fixed in JsBeautifier 1.7.4, released today.

etiennea commented 6 years ago

Good news! Thanks!

On 9 October 2017 at 01:22, Liam Newman notifications@github.com wrote:

@etiennea https://github.com/etiennea also this is fixed in JsBeautifier 1.7.4, released today.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jdc0589/JsFormat/issues/181#issuecomment-335049317, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGRBc0u-_bB5TFUXqGHtTaAhy1AMjXyks5sqWdigaJpZM4O06WH .

jdavisclark commented 6 years ago

just merged #184, this should be resolved