Rules
jsx-shorthand-boolean
Full Name in eslint-plugin-react-x
react-x/jsx-shorthand-boolean
Full Name in @eslint-react/eslint-plugin
@eslint-react/jsx-shorthand-boolean
Features
🔧
Description
Enforces the use of shorthand syntax for boolean attributes.
Examples
Failing
import React from "react";
function MyComponent() {
return <button disabled={true} />;
// ^^^^^^^^^^^^^^^
// - Use shorthand boolean attribute 'disabled'.
}
Passing
import React from "react";
function MyComponent() {
return <button disabled />;
}
Implementation
See Also
jsx-shorthand-fragment
Enforces the use of shorthand syntax for fragments.