<commit_before># Enforce component methods order (sort-comp)

When creating React components it is more convenient to always follow the same organisation for methods order to helps you to easily find lifecyle methods, event handlers, etc.

## Rule Details

With default configuration the following organisation must be followed:

  1. lifecycle methods: `displayName`, `propTypes`, `contextTypes`, `childContextTypes`, `mixins`, `statics`,`defaultProps`, `constructor`, `getDefaultProps`, `getInitialState`, `state`, `getChildContext`, `componentWillMount`, `componentDidMount`, `componentWillReceiveProps`, `shouldComponentUpdate`, `componentWillUpdate`, `componentDidUpdate`, `componentWillUnmount` (in this order).
  2. custom methods
  3. `render` method

The following patterns are considered warnings:

```js
var Hello = React.createClass({
  render: function() {
    return <div>Hello</div>;
  },
  displayName : 'Hello'
});
```

The following patterns are not considered warnings:

```js<commit_msg>Docs: How to automatically sort-comp compliance<commit_after># Enforce component methods order (sort-comp)

When creating React components it is more convenient to always follow the same organisation for methods order to helps you to easily find lifecyle methods, event handlers, etc.

**Fixable:** This rule is automatically fixable using the [`sort-comp` transform](https://github.com/reactjs/react-codemod/blob/master/transforms/sort-comp.js) in [react-codemod](https://www.npmjs.com/package/react-codemod).

## Rule Details

With default configuration the following organisation must be followed:

  1. lifecycle methods: `displayName`, `propTypes`, `contextTypes`, `childContextTypes`, `mixins`, `statics`,`defaultProps`, `constructor`, `getDefaultProps`, `getInitialState`, `state`, `getChildContext`, `componentWillMount`, `componentDidMount`, `componentWillReceiveProps`, `shouldComponentUpdate`, `componentWillUpdate`, `componentDidUpdate`, `componentWillUnmount` (in this order).
  2. custom methods
  3. `render` method

The following patterns are considered warnings:

```js
var Hello = React.createClass({
  render: function() {
    return <div>Hello</div>;
  },
  displayName : 'Hello'
});
```

The following patterns are not considered warnings:

```js
{'fraction_non_alphanumeric': 0.11565523306948108, 'fraction_numerical': 0.002638522427440633, 'mean_word_length': 6.199367088607595, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3913536', 'n_tokens_mistral': 601, 'n_tokens_neox': 586, 'n_words': 214}