eslint-plugin-react-redux icon indicating copy to clipboard operation
eslint-plugin-react-redux copied to clipboard

Rule proposal: sort-connect/sort-map-state-to-props

Open fsmaia opened this issue 6 years ago • 2 comments

Similar to eslint-plugin-react's sort-prop-types, it would be nice to have a rule to sort mapStateToProps and mapDispatchToProps object keys (when object is returned).

fsmaia avatar Dec 06 '18 01:12 fsmaia

Is there a reason the core rule for sorting object keys wouldn’t apply here?

ljharb avatar Dec 06 '18 01:12 ljharb

The core rule would have to be applied for entire codebase, or manually applied in mapStateToProps special objects.

This rule proposal is about being consistent only with sort-prop-types, which has an specific sorting constraint.

And I think here is the place 'cause is where we have connect and mapStateToProps awareness.

fsmaia avatar Dec 07 '18 03:12 fsmaia