Search code examples
javascriptreactjseslintprettier

React functional component props sort alphabetically. (At the definition side)


I know an eslint rule, to sort the component props at the usage side.
Like <Cmp alpha={true} beta={true} /> (rule)

But is there a rule, what sorts the props from the definition side?
Like:
const Cmp = ({ beta, alpha = false }) => null; should be const Cmp = ({ alpha = false, beta }) => null;


Solution

  • No such a rule exists, so I made one at PR. This remains to be accepted and pushed so will take some time.