Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

Commit

Permalink
Modifying semi rule to support for await (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobelb authored and Kent C. Dodds committed May 10, 2017
1 parent 14b2765 commit 9468524
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/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/semi`: Includes class properties (🛠)
- `babel/semi`: doesn't fail when using `for await (let something of {})`. Includes class properties (🛠)

#### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion rules/semi.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ module.exports = {
parent = ancestors[parentIndex];

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);
}
Expand Down
1 change: 1 addition & 0 deletions tests/rules/semi.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ ruleTester.run("semi", rule, {
// babel
"class Foo { bar = 'example'; }",
"class Foo { static bar = 'example'; }",
{ code: "async function foo() { for await (let thing of {}) { console.log(thing); } }", parserOptions: { ecmaVersion: 6 } },

// babel, "never"
{ code: "class Foo { bar = 'example' }", options: ["never"] },
Expand Down

0 comments on commit 9468524

Please sign in to comment.