Flow: Perform ASI for class properties

Created on 19 Apr 2016  路  7Comments  路  Source: facebook/flow

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.

parsing

All 7 comments

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!

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.

Semicolons are good for your health.

Hello there!
Should the commit up here have fixed it?
It's still not working for me on [email protected]:

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

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

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

FYI it works fine now on :)
https://github.com/facebook/flow/issues/1517#issuecomment-265607128

Was this page helpful?
0 / 5 - 0 ratings

Related issues

john-gold picture john-gold  路  3Comments

bennoleslie picture bennoleslie  路  3Comments

ghost picture ghost  路  3Comments

philikon picture philikon  路  3Comments

funtaps picture funtaps  路  3Comments