Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable eslint warning

Anchor used as a button. Anchors are primarily expected to navigate. Use the button element instead. (jsx-a11y/anchor-is-valid)

I would like to disable the above warning.

So i write

<div data-g-id={this.props.g.id}>
  (// eslint-disable-next-line anchor-is-valid)
  <a
    className='classname'
    href="#"
    data-point="TL"
    onClick={this.callFunction}
   >
</div>

But the above one is not working.

like image 942
Sourabh Banka Avatar asked Apr 26 '18 06:04

Sourabh Banka


2 Answers

Use

{
  // eslint-disable-next-line anchor-is-valid
}
<a
...

instead of ()

like image 127
16kb Avatar answered Sep 30 '22 04:09

16kb


You can also do it globally in .eslintrc file:

{
  "rules": {
    "jsx-a11y/anchor-is-valid": 0
  }
}
like image 27
plkpiotr Avatar answered Sep 30 '22 05:09

plkpiotr