prefer-shorthand-boolean
Full Name in eslint-plugin-react-x
react-x/prefer-shorthand-boolean
Full Name in @eslint-react/eslint-plugin
@eslint-react/prefer-shorthand-boolean
Features
🔍
🔧
What it does
Enforces the use of shorthand syntax for boolean attributes.
A safe auto-fix is available for this rule.
Examples
This rule enforces the use of shorthand syntax for boolean attributes.
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 />;
}