What to do when lintern tells you that the line is too long, but you only have one line of code to return.
Problem:
So I have a line of code:
const someLongName = aLotOfstuff.filter(longStuff => longStuff.longField === 'some very long string);
Linter warns me that this line is longer than it should be, so I need to break it up somehow. I could go with thee return route:
const someLongName = aLotOfstuff.filter(longStuff => {
return longStuff.longField === 'some very long string);
});
but that's not nice is it? I want to avoid using the unnecessary 'return'.
Solution:
So how can I do that? Youn can just use brackets:
const someLongName = aLotOfstuff.filter(longStuff => (
longStuff.longField === 'some very long string);
));
Top comments (0)