当我们react项目中使用a标签但是没加href属性时,会看到如下警告:
The href attribute is required for an anchor to be keyboard accessible. Provide a valid,
navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md jsx-a11y/anchor-is-valid
我们可以在package.json文件中添加配置消除这个警告
"eslintConfig": { ..."rules": { "jsx-a11y/anchor-is-valid": "off" } }
标签:valid,a11y,React,href,ESLint,警告,jsx,anchor From: https://www.cnblogs.com/maxiaocang/p/16969392.html