Fixing 'consistent-return' linter issue with simple arrow function

As title, I have an arrow function with the error. How can I refactor it so the error goes away?

Expected to return a value at the end of arrow function consistent-return

This is my code:

// Disable default form submission when user hits enter.
const $facetInput = $('.facet-input');
const $submitButton = $('.facet-submit');

$facetInput.on('keydown', (event) => {
  if ((event.key === 'enter' || event.keyCode === 13) && !== $submitButton) {
    return false;


100 thoughts on “Fixing 'consistent-return' linter issue with simple arrow function”

Leave a Comment