# anchor-is-valid

Rule `jsx-a11y/anchor-is-valid`. Enforce all anchors are valid, navigable elements.

- Source: jsx-a11y
- Technologies: Accessibility, React
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 103.1M weekly downloads of presets that enable it
- Trend: +52.4% last quarter
- Rank: #146 by reach, #763 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `jsx-a11y/anchor-is-valid` | yes | no | package `eslint-plugin-jsx-a11y` | [docs](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/anchor-is-valid.md) |
| Oxlint | `jsx-a11y/anchor-is-valid` | no | no | plugin `jsx-a11y`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/jsx_a11y/anchor-is-valid.html) |
| Biome | `a11y/useValidAnchor` | yes | no | group a11y, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/use-valid-anchor/) |

## Code examples

### Incorrect: the rule reports this

```jsx
<a onClick={foo} />
<a href="#" onClick={foo} />
<a href={"#"} onClick={foo} />
<a href={`#`} onClick={foo} />
<a href="javascript:void(0)" onClick={foo} />
<a href={"javascript:void(0)"} onClick={foo} />
<a href={`javascript:void(0)`} onClick={foo} />
```

```jsx
<a />
<a href={undefined} />
<a href={null} />
```

```jsx
<a href="#" />
<a href={"#"} />
<a href={`#`} />
<a href="javascript:void(0)" />
<a href={"javascript:void(0)"} />
<a href={`javascript:void(0)`} />
```

### Correct: the rule accepts this

```jsx
<a href="/some/valid/uri">Navigate to page</a>
<a href="/some/valid/uri#top">Navigate to page and location</a>
<a href="#top">Navigate to internal page location</a>
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import jsxA11y from "eslint-plugin-jsx-a11y";

export default [
  {
    plugins: { "jsx-a11y": jsxA11y },
    rules: {
      "jsx-a11y/anchor-is-valid": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "jsx-a11y"
  ],
  "rules": {
    "jsx-a11y/anchor-is-valid": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "a11y": {
        "useValidAnchor": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [jsx-a11y recommended](https://lintradar.dev/presets/jsx-a11y-recommended.md) | ESLint | `eslint-plugin-jsx-a11y` | 31 | 65.1M | +42.0% |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [jsx-a11y strict](https://lintradar.dev/presets/jsx-a11y-strict.md) | ESLint | `eslint-plugin-jsx-a11y` | 31 | 65.1M | +42.0% |
| [Create React App](https://lintradar.dev/presets/react-app.md) | ESLint | `eslint-config-react-app` | 109 | 4.1M | +4.3% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [jsx-a11y/anchor-has-content](https://lintradar.dev/rules/jsx-a11y/anchor-has-content.md): Enforce all anchors to contain accessible content.
- [jsx-a11y/aria-activedescendant-has-tabindex](https://lintradar.dev/rules/jsx-a11y/aria-activedescendant-has-tabindex.md): Enforce elements with aria-activedescendant are tabbable.
- [jsx-a11y/aria-role](https://lintradar.dev/rules/jsx-a11y/aria-role.md): Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role.
- [jsx-a11y/heading-has-content](https://lintradar.dev/rules/jsx-a11y/heading-has-content.md): Enforce heading (`h1`, `h2`, etc) elements contain accessible content.
- [jsx-a11y/iframe-has-title](https://lintradar.dev/rules/jsx-a11y/iframe-has-title.md): Enforce iframe elements have a title attribute.
- [jsx-a11y/img-redundant-alt](https://lintradar.dev/rules/jsx-a11y/img-redundant-alt.md): Enforce `<img>` alt prop does not contain the word "image", "picture", or "photo".

---

Web page: https://lintradar.dev/rules/jsx-a11y/anchor-is-valid. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
