jfmengels/eslint-plugin-fp

no-nil doesn't seem to understand default switch case

Open

#14 opened on Oct 15, 2016

View on GitHub
 (10 comments) (8 reactions) (0 assignees)JavaScript (35 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (968 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

const reducer = (state = {}, action) => {
  switch (action.type) {
    case 'CHANGE_TEXT':
      return { text: action.payload };
    default:
      return state;
  }
};

This function will always return something, but sadly I get the error Function must end with a return statement, so that it doesn't return undefined fp/no-nil.

Contributor guide