How to declare multiple prop-types using eslint airbnb in a component arguments?

73 views Asked by At

Function declaration:

export default function Labyrinth({ theme = 1 }, { inverted = 0 }) {

While declaring proptypes

Labyrinth.propTypes = {
  inverted: PropTypes.bool.isRequired,
  theme: PropTypes.oneOf([1, 2, 3]).isRequired,
}

And it shows 'inverted' PropType is defined but prop is never usedeslintreact/no-unused-prop-types

It works but it shows an eslint error.

1

There are 1 answers

0
Diego Alonzo On

The way to do this is to declare all inside the same curly brackets just like:

export default function Labyrinth({ theme = 1, inverted = 0 }) {}