sort-comp
UnreleasedConfiguration
Rule Details
Enforce a consistent order for methods and properties in React components.
The default order is static methods, lifecycle members, other members, and
then render. Lifecycle members follow React's conventional order, beginning
with displayName and ending with componentWillUnmount.
Options
The rule accepts an object with order and groups properties. order is an
array of method names, special groups, or JavaScript regular-expression
strings such as "/^on.+$/". groups defines named arrays that can be used
from order; it extends the built-in lifecycle group.
Special groups include:
static-variables,static-methodsinstance-variables,instance-methodstype-annotations,getters,setterseverything-elseandrender
A member that matches no configured entry belongs to everything-else when
that group is present. Members that match multiple entries may be valid in any
compatible position.
Differences from ESLint
The upstream documentation describes automatic fixing through the separate
react-codemod sort-comp transform. rslint reports the same ordering
diagnostics but does not invoke that external codemod.