> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# jsx-no-undef

[Added in v0.5.0](https://github.com/web-infra-dev/rslint/releases/tag/v0.5.0)
## Configuration

| Preset                            | Configured Value |
| --------------------------------- | ---------------- |
| ✅ reactPlugin.configs.recommended | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, reactPlugin } from '@rslint/core';

export default defineConfig([
  reactPlugin.configs.recommended,
  {
    rules: {
      'react/jsx-no-undef': 'error',
    },
  },
]);
```

## Rule Details

This rule helps locate potential `ReferenceError`s resulting from misspellings or missing components. It flags any JSX tag whose leftmost identifier is not in scope.

Examples of **incorrect** code for this rule:

```jsx
<Hello name="John" />;
```

```jsx
var Hello = React.createClass({
  render: function () {
    return <Text>Hello</Text>;
  },
});
module.exports = Hello;
```

Examples of **correct** code for this rule:

```jsx
var Hello = require('./Hello');

<Hello name="John" />;
```

- Intrinsic (lowercase) tags such as `<div>`, `<span>`, `<svg:path>`, and `<x-gif>` are always allowed.
- Namespaced JSX tags such as `<a:b />` are skipped.
- For member-expression tags (`<Foo.Bar>`, `<foo.bar.Baz>`), only the leftmost identifier is checked. `<this.Foo>` is always allowed.

## Options

### `allowGlobals`

When `false` (default), a JSX tag identifier in a module (a file with `import`/`export`) is only recognized if it's declared in the source file (via `var` / `let` / `const` / `function` / `class` / `enum` / `namespace` / `import` / `declare` / function parameter / catch binding / loop binding) — names declared only via config [`languageOptions.globals`](https://rslint.rs/config/language-options.md#languageoptionsglobals) or `/* global */` comments are still reported. Set `allowGlobals: true` to also allow those. Script files (no `import`/`export`) always consult declared globals, regardless of this option — matching ESLint.

Use the `globals` catalog exported by `@rslint/core` when JSX components are provided by a runtime or test environment rather than imported by the file.

## Original Documentation

- [eslint-plugin-react: jsx-no-undef](https://github.com/jsx-eslint/eslint-plugin-react/blob/v7.37.5/docs/rules/jsx-no-undef.md)
- [Source code](https://github.com/jsx-eslint/eslint-plugin-react/blob/v7.37.5/lib/rules/jsx-no-undef.js)
