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

"sort-comp" Flow property definitions #235

Closed
thealjey opened this issue Oct 6, 2015 · 5 comments
Closed

"sort-comp" Flow property definitions #235

thealjey opened this issue Oct 6, 2015 · 5 comments
Labels

Comments

@thealjey
Copy link

thealjey commented Oct 6, 2015

I was wondering if it was possible to have property definitions at the top when using this rule, cause if I write something like this:

class Something extends Component {

  state: Object;

  constructor(props: Object) {
...

it complains that constructor must be placed before state

@yannickcr
Copy link
Member

It is not currently possible to sort classes properties according to their type (property, method, etc.). See #128 for this issue.

But you can still configure the rule to force state to be placed before constructor. See the rule options for this.

Let me know if you need more help.

@satya164
Copy link

+1

@MoOx
Copy link
Contributor

MoOx commented Mar 25, 2016

I am facing the same issue and I am using babel-plugin-flow-react-proptypes that transform the static value to propTypes (so this make sense to be defined before constructor). I will take a look to custom order to "fix" this :)

@dozoisch
Copy link
Contributor

dozoisch commented Jul 12, 2016

If people that use flow can use my branch and tell me if it works properly for them, that would be cool! It's based on 6.0.0-alpha.1

"eslint-plugin-react": "https://github.com/dozoisch/eslint-plugin-react#typeannotations",

@TSMMark
Copy link
Contributor

TSMMark commented Oct 22, 2017

For the record, you can now use the "type-annotations" group to determine where you would like to place your type annotations. https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md#rule-options

type-annotations. This group is not specified by default, but can be used to enforce flow annotations to be at the top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

7 participants