ixartz/Next-js-Boilerplate

Airbnb style conflict?

comverser opened this issue · 1 comments

Arrow functions are used for the TSX components in this boilerplate (e.g. Meta.tsx), but it is discouraged in Airbnb styles as shown below.

Could you please tell me why?

// bad
class Listing extends React.Component {
  render() {
    return <div>{this.props.hello}</div>;
  }
}

// bad (relying on function name inference is discouraged)
const Listing = ({ hello }) => (
  <div>{hello}</div>
);

// good
function Listing({ hello }) {
  return <div>{hello}</div>;
}

Source: https://stackoverflow.com/questions/37288950/why-does-the-airbnb-style-guide-say-that-relying-on-function-name-inference-is-d

The stackoverflow post is 6 years old and might not be relevant. Currently, it doesn't raise any ESLint error in the boilerplate.
The source of truth is ESLint.