Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 751 Bytes

mapStateToProps-prefer-parameters-names.md

File metadata and controls

37 lines (26 loc) · 751 Bytes

Enforces that all mapStateToProps parameters have specific names. (teactn/mapStateToProps-prefer-parameters-names)

teactn mapStateToProps function has 2 optional arguments:

  • global
  • ownProps

This rule enforces that all of the provided parameters should follow the above naming conventions.

Rule details

The following pattern is considered incorrect:

const mapStateToProps = (anyOtherName) => {}
withGlobal(function(anyOtherName) {}, null)(App)

The following patterns are considered correct:

const mapStateToProps = (global, ownProps) => {}
const mapStateToProps = (global) => {}
const mapStateToProps = ({isActive}) => {isActive}
withGlobal((global) => global, null)(App)