Redux: Put action after state with default value in reducer will cause jshint to complain

Created on 16 Feb 2016  ·  1Comment  ·  Source: reduxjs/redux

JSHint will report:
Regular parameters should not come after default parameters. W138

Most helpful comment

Well, we don’t agree with this particular rule. You can either disable it, or not use optional parameters and write something like

function counter(state, action) {
  if (typeof state === 'undefined') {
    return 0
  }

  switch (action.type) {
    // ...
  }
}

>All comments

Well, we don’t agree with this particular rule. You can either disable it, or not use optional parameters and write something like

function counter(state, action) {
  if (typeof state === 'undefined') {
    return 0
  }

  switch (action.type) {
    // ...
  }
}
Was this page helpful?
0 / 5 - 0 ratings