Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform ASI for class properties #1682

Closed
mmazzarolo opened this issue Apr 19, 2016 · 7 comments
Closed

Perform ASI for class properties #1682

mmazzarolo opened this issue Apr 19, 2016 · 7 comments
Assignees
Labels

Comments

@mmazzarolo
Copy link
Contributor

Hello there,
it seems that semicolons are required by Flow for class methods and variables (#825 , #1517) and maybe even in other statements.
Is there any plan for dropping the need of semicolons in the future?
Babel doesn't need them (it has already been discussed in the past) and unfortunately semicolons clash with StandardJS and other common standards/linter configs.

Thank you in advance.

@samwgoldman samwgoldman changed the title Optional semicolons Perform ASI for class properties Apr 19, 2016
@samwgoldman
Copy link
Member

I think an earlier version of the class properties proposal required semicolons, but I believe updated versions allow for automatic semicolon insertion. You still need to be careful about starting a line with ( and [, I imagine.

Kicking this over to Jeff, since he's the authority on this proposal. Thanks, Jeff!

@mmazzarolo
Copy link
Contributor Author

mmazzarolo commented Apr 19, 2016

You still need to be careful about starting a line with ( and [, I imagine.

Yep, you are right, but this is easily forced by linting (and it's not that common).

P.S.: Thanks, the title sounds definitely better now.

@aluanhaddad
Copy link

Semicolons are good for your health.

ghost pushed a commit that referenced this issue May 4, 2016
Summary:
Closes #1698 and #1682
Closes #1702

Differential Revision: D3259450

Pulled By: mroch

fb-gh-sync-id: a7c16e1e7887ee86579e13c7896532ac336d5686
fbshipit-source-id: a7c16e1e7887ee86579e13c7896532ac336d5686
@mmazzarolo
Copy link
Contributor Author

mmazzarolo commented May 9, 2016

Hello there!
Should the commit up here have fixed it?
It's still not working for me on flow-bin@0.24.2:

The following snippet works:

/** @flow */
import React, { Component } from 'react'
import { View } from 'react-native'

export default class Test extends Component {

  _testFunction = () => {
    return null
  }; // !!!

  render (): ReactElement {
    return <View />
  }
}

The following snippet returns render (): ReactElement { -> Unexpected identifier

/** @flow */
import React, { Component } from 'react'
import { View } from 'react-native'

export default class Test extends Component {

  _testFunction = () => {
    return null
  }

  render (): ReactElement {
    return <View />
  }
}

Thank you again guys, have a nice day

@marudor

@marudor
Copy link
Contributor

marudor commented May 10, 2016

Ah. My Commit was only for Class Properties. Not in general.

@mmazzarolo
Copy link
Contributor Author

@marudor ouch, thank you anyway
I'd gladly contribute if anyone can point me to the right direction.

@mroch mroch added the parsing label May 31, 2016
@ghost ghost closed this as completed in fc744c2 Jun 9, 2016
ghost pushed a commit that referenced this issue Jun 10, 2016
Summary:
tests arrow functions followed by an implicit semicolon

this was an example included in #1682 that I didn't add a test for

Reviewed By: gabelevi

Differential Revision: D3415236

fbshipit-source-id: 93220d910b8bacb6dc7d0da5b5451fea755a602f
@mmazzarolo
Copy link
Contributor Author

FYI it works fine now on :)
#1517 (comment)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants