简体   繁体   English

禁用eslint警告

[英]Disable eslint warning

Anchor used as a button. 锚用作按钮。 Anchors are primarily expected to navigate. 锚点主要用于导航。 Use the button element instead. 请改用按钮元素。 (jsx-a11y/anchor-is-valid) (JSX-A11Y /锚是有效)的

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. 但上面的一个不起作用。

Use 使用

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

instead of () 而不是()

You can also do it globally in .eslintrc file: 您也可以在.eslintrc文件中全局执行此操作:

{
  "rules": {
    "jsx-a11y/anchor-is-valid": 0
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM