Rules
jsx-shorthand-fragment
Full Name in eslint-plugin-react-x
react-x/jsx-shorthand-fragmentFull Name in @eslint-react/eslint-plugin
@eslint-react/jsx-shorthand-fragmentFeatures
🔧
Description
Enforces the use of shorthand syntax for fragments.
Examples
Failing
import React, { Fragment } from "react";
function MyComponent() {
  return (
    <Fragment>
      <button />
      <button />
    </Fragment>
  );
}Passing
import React from "react";
function MyComponent() {
  return (
    <>
      <button />
      <button />
    </>
  );
}Rule Options
This rule has a single integer option with the following values:
- 1(Default): Always use shorthand syntax for fragments.
- -1: Never use shorthand syntax for fragments.
Implementation
See Also
- jsx-shorthand-boolean
 Enforces the use of shorthand syntax for boolean attributes.