[email protected]
eslint-config-airbnb@^16.0.0
eslint@^4.8.0
eslint-plugin-jsx-a11y@^6.0.2
eslint-plugin-import@^2.7.0
eslint-plugin-react@^7.4.0
When I use <Link to="/path"> I get the following linting error:
[eslint] The href attribute is required on an anchor. Provide a valid, navigable address as the href value. (jsx-a11y/anchor-is-valid)
https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md
From the linked page, you need to configure the rule. Specifically, this line implies that you should add to to the specialLink:
For the components option, these strings determine which JSX elements (always including ) should be checked for the props designated in the specialLink options (always including href).
Alternatively, you could just not include <Link> in the components and be confident knowing that React Router always renders an anchor with an href.
FYI, https://github.com/airbnb/javascript/pull/1648 addresses the problem for eslint-config-airbnb. So if you're using this config (OP was), there should be no need for overriding this in the config once > 16.1.0 gets released :)
Most helpful comment
From the linked page, you need to configure the rule. Specifically, this line implies that you should add
toto thespecialLink:Alternatively, you could just not include
<Link>in thecomponentsand be confident knowing that React Router always renders an anchor with anhref.