eslint-plugin-jsx-a11y icon indicating copy to clipboard operation
eslint-plugin-jsx-a11y copied to clipboard

Enable `anchor-is-valid` on more components

Open fregante opened this issue 3 years ago • 1 comments

react-bootstrap has a Button component that renders as an button-styled anchor when href is supplied. I've just seen <Button href="#" onClick={onClick}> in a codebase, but href="#" does effectively nothing useful here.

Is it possible to enable this rule on more link-based components?

https://react-bootstrap.github.io/components/buttons/#api

fregante avatar Aug 08 '22 08:08 fregante

Using the "components" setting mentioned in the readme, you can make a Button be considered a button.

However, this is a perfect case for propTypes, which should be banning href when onClick is supplied.

ljharb avatar Aug 08 '22 17:08 ljharb