Prettier: Semicolons after class properties

Created on 6 Feb 2017  路  3Comments  路  Source: prettier/prettier

If you use babel-plugin-transform-class-properties, properties you add to classes are automatically punctuated with a semicolon by prettier. Is this intended/preferable? I've been omitting a trailing semicolon in these situations myself.

locked-due-to-inactivity needs discussion

Most helpful comment

Yes, it is intended.

class A {
  a = 1
  [b] = 2
}

The above actually means (demo):

class A {
  a = 1[b] = 2
}

while you probably meant (demo):

class A {
  a = 1;
  [b] = 2;
}

All 3 comments

Yes, it is intended.

class A {
  a = 1
  [b] = 2
}

The above actually means (demo):

class A {
  a = 1[b] = 2
}

while you probably meant (demo):

class A {
  a = 1;
  [b] = 2;
}

@lydell This is good to know, thank you!

Thanks for responding @lydell!

Was this page helpful?
0 / 5 - 0 ratings