prefer-shorthand-boolean
🔧 This rule is automatically fixable by the --fix
CLI option.
Rule category
Style.
What it does
Enforces the use of shorthand syntax for boolean attributes.
Examples
This rule enforces the use of shorthand syntax for boolean attributes.
Failing
import React from "react";
function Example() {
return <button disabled={true} />;
// ^^^^^^^^^^^^^^^
// - Use shorthand boolean attribute 'disabled'.
}
Passing
import React from "react";
function Example() {
return <button disabled />;
}