Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Latest commit

 

History

History
35 lines (25 loc) · 730 Bytes

jsx-filename-extension.md

File metadata and controls

35 lines (25 loc) · 730 Bytes

Restrict file extensions that may contain JSX (jsx-filename-extension)

Rule Details

The following pattern is considered a warning:

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

The following pattern is not considered a warning:

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

Rule Options

The set of allowed extensions is configurable. By default '.jsx' is allowed. If you wanted to allow both '.jsx' and '.js', the configuration would be:

"rules": {
  "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
}

When Not To Use It

If you don't care about restricting the file extensions that may contain JSX.