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

Commit

Permalink
Merge pull request #194 from simonkotwicz/sk/dev
Browse files Browse the repository at this point in the history
Fix babel/semi for private properties
  • Loading branch information
JLHwung committed Jun 29, 2020
2 parents 0f558b3 + 7c96021 commit db19a0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rules/semi.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const report = (context, node, missing) => {
const semiRuleWithClassProperty = ruleComposer.joinReports([
semiRule,
context => ({
ClassProperty(node) {
"ClassProperty, ClassPrivateProperty"(node) {
const options = context.options[1];
const exceptOneLine = options && options.omitLastInOneLineBlock === true;

Expand Down
4 changes: 4 additions & 0 deletions tests/rules/semi.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ ruleTester.run("semi", rule, {

// babel
"class Foo { bar = 'example'; }",
"class Foo { #bar = 'example'; }",
"class Foo { static bar = 'example'; }",
{ code: "async function foo() { for await (let thing of {}) { console.log(thing); } }", parserOptions: { ecmaVersion: 6 } },
{ code: "class Foo { bar = () => {}; }", options: ["always", { omitLastInOneLineBlock: true }] },

// babel, "never"
{ code: "class Foo { bar = 'example' }", options: ["never"] },
{ code: "class Foo { #bar = 'example' }", options: ["never"] },
{ code: "class Foo { static bar = 'example' }", options: ["never"] },
{ code: "class Foo { bar = () => {} }", options: ["never"] },
],
Expand Down Expand Up @@ -185,6 +187,7 @@ ruleTester.run("semi", rule, {

// babel
{ code: "class Foo { bar = 'example' }", errors: [{ message: "Missing semicolon." }] },
{ code: "class Foo { #bar = 'example' }", errors: [{ message: "Missing semicolon." }] },
{ code: "class Foo { static bar = 'example' }", errors: [{ message: "Missing semicolon." }] },
{
code: "class Foo { bar = () => {} }",
Expand All @@ -194,6 +197,7 @@ ruleTester.run("semi", rule, {

// babel, "never"
{ code: "class Foo { bar = 'example'; }", options: ["never"], errors: [{ message: "Extra semicolon." }] },
{ code: "class Foo { #bar = 'example'; }", options: ["never"], errors: [{ message: "Extra semicolon." }] },
{ code: "class Foo { static bar = 'example'; }", options: ["never"], errors: [{ message: "Extra semicolon." }] },
{
code: "class Foo { bar = () => {}; }",
Expand Down

0 comments on commit db19a0a

Please sign in to comment.