V
V
Vadim Somov2018-07-14 09:56:12
JavaScript
Vadim Somov, 2018-07-14 09:56:12

How to solve a problem with Eslint?

I use ESlint config from airBnB. I am getting an error - Function 'errorHandlingSearch' expected no return value consistent-return . I read on the Internet, I did not understand anything, how to solve this problem. Here is the code - https://codepen.io/kafkae/pen/ajOWxB?editors=0010 . Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Mosyukov, 2018-07-14
@AleksKek

Instead of return; do return "";
ESlint assumes that your function should return a string, instead you return undefined. It's highly recommended that a function always return the same data type, or throw an exception on error when you want to return null/undefined.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question