Rules
jsx-shorthand-fragment
Full Name in eslint-plugin-react-x
react-x/jsx-shorthand-fragment
Full Name in @eslint-react/eslint-plugin
@eslint-react/jsx-shorthand-fragment
Features
🔧
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 />
</>
);
}
Implementation
See Also
jsx-shorthand-boolean
Enforces the use of shorthand syntax for boolean attributes.