Babel-eslint: for await loop triggers semi rule

Created on 20 Oct 2016  路  7Comments  路  Source: babel/babel-eslint

Can't get this to not throw a Missing semicolon (semi) error on line 2 (for await line):

async function * foo(generator) {
    for await (const value of generator) {
        yield await value;
    }
}

Can't find any info on this. Is it not supported yet? It's a stage-3 candidate proposal, same as async generators, which are parsed properly.

My config:

{
    "env": {
        "es6": true,
        "node": true
    },
    "parser": "babel-eslint",
    "extends": "eslint:recommended",
    "rules": {
        "semi": ["error", "always"]
    }
}
help wanted eslint-plugin-babel

Most helpful comment

See also https://github.com/eslint/eslint/pull/7417. I guess I'll PR it to eslint-plugin-babel if that PR is rejected.

All 7 comments

Can you provide the actual output from ESLint?

@taion mentioned this on Slack earlier and linked to https://github.com/eslint/eslint/blob/master/lib/rules/semi.js#L190 as the likely cause since this is represented by a new ForAwaitStatement.

See also https://github.com/eslint/eslint/pull/7417. I guess I'll PR it to eslint-plugin-babel if that PR is rejected.

Ah, got it. Thanks for the info! @taion sounds like a plan.

@taion so the eslint PR got rejected. Could you please redirect it to eslint-plugin-babel? :)

This was added to eslint-plugin-babel a while back; it's in 4.1.2 and newer.

Fantastic! Thanks for the update.

Was this page helpful?
0 / 5 - 0 ratings