# jsx-filename-extension

Rule `react/jsx-filename-extension`. Disallow file extensions that may contain JSX

- Source: react
- Technologies: React
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 5.2M weekly downloads of presets that enable it
- Trend: +1.9% last quarter
- Rank: #1406 by reach, #1622 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react/jsx-filename-extension` | no | no | package `eslint-plugin-react` | [docs](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/jsx-filename-extension.md) |
| Oxlint | `react/jsx-filename-extension` | no | no | plugin `react`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-filename-extension.html) |

## Code examples

### Incorrect: the rule reports this

```jsx
// filename: MyComponent.js
function MyComponent() {
  return <div />;
}
```

### Correct: the rule accepts this

```jsx
// filename: MyComponent.jsx
function MyComponent() {
  return <div />;
}
```

Examples from the ESLint documentation.

## Enable it

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

```js
import react from "eslint-plugin-react";

export default [
  {
    plugins: { react },
    rules: {
      "react/jsx-filename-extension": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "react"
  ],
  "rules": {
    "react/jsx-filename-extension": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Airbnb TypeScript](https://lintradar.dev/presets/airbnb-typescript.md) | ESLint | `eslint-config-airbnb-typescript` | 19 | 1.8M | +1.2% |

## Related rules

- [react/jsx-no-bind](https://lintradar.dev/rules/react/jsx-no-bind.md): Disallow `.bind()` or arrow functions in JSX props
- [react/no-did-update-set-state](https://lintradar.dev/rules/react/no-did-update-set-state.md): Disallow usage of setState in componentDidUpdate
- [react/jsx-fragments](https://lintradar.dev/rules/react/jsx-fragments.md): Enforce shorthand or standard form for React fragments
- [react/no-unstable-nested-components](https://lintradar.dev/rules/react/no-unstable-nested-components.md): Disallow creating unstable components inside components
- [react/jsx-curly-brace-presence](https://lintradar.dev/rules/react/jsx-curly-brace-presence.md): Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes
- [react/jsx-no-script-url](https://lintradar.dev/rules/react/jsx-no-script-url.md): Disallow usage of `javascript:` URLs

---

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