The purpose of .map is to produce a new array from an old one. The return value from your function specifies what the new value at that spot in the array should be. Since you're not returning anything an array of undefined's will be produced. This is probably a mistake, and therefore that lint rule is warning you about it.
In your case, you don't seem to care about the array that map produces at all, so the fix is to use a more appropriate method, such as .forEach
let categories = [];
items.forEach(cat => {
if (categories.indexOf(cat.category) === -1) {
categories.push(cat.category);
}
});
From the documentation on array-callback-return:
Array has several methods for filtering, mapping, and folding. If we forget to write return statement in a callback of those, it's probably a mistake. If you don't want to use a return or don't need the returned results, consider using .forEach instead.
itemswithout duplicates. Which can be written asthis.setState({ categories: items.filter((el, i, arr) => arr.indexOf(el) === i) });