Modifying semi rule to support for await (babel/eslint-plugin-babel#126)

This commit is contained in:
Brandon Kobel 2017-05-10 12:09:23 -04:00
parent dc0109ad3d
commit da75b8484f
3 changed files with 3 additions and 2 deletions

View File

@ -44,7 +44,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options.
- `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`)
- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠) - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠)
- `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`) - `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`)
- `babel/semi`: Includes class properties (🛠) - `babel/semi`: doesn't fail when using `for await (let something of {})`. Includes class properties (🛠)
#### Deprecated #### Deprecated

View File

@ -187,7 +187,7 @@ module.exports = {
parent = ancestors[parentIndex]; parent = ancestors[parentIndex];
if ((parent.type !== "ForStatement" || parent.init !== node) && if ((parent.type !== "ForStatement" || parent.init !== node) &&
(!/^For(?:In|Of)Statement/.test(parent.type) || parent.left !== node) (!/^For(?:In|Of|Await)Statement/.test(parent.type) || parent.left !== node)
) { ) {
checkForSemicolon(node); checkForSemicolon(node);
} }

View File

@ -102,6 +102,7 @@ ruleTester.run("semi", rule, {
// babel // babel
"class Foo { bar = 'example'; }", "class Foo { bar = 'example'; }",
"class Foo { static bar = 'example'; }", "class Foo { static bar = 'example'; }",
{ code: "async function foo() { for await (let thing of {}) { console.log(thing); } }", parserOptions: { ecmaVersion: 6 } },
// babel, "never" // babel, "never"
{ code: "class Foo { bar = 'example' }", options: ["never"] }, { code: "class Foo { bar = 'example' }", options: ["never"] },