DocumentationRulesavoid-shorthand-boolean

avoid-shorthand-boolean

🔧 This rule is automatically fixable by the --fix CLI option.

Rule category

Style.

What it does

Enforces the use of explicit boolean values for boolean attributes.

Examples

Failing

import React from "react";
 
function Example() {
  return <button disabled />;
  //             ^^^^^^^^
  //             - Avoid using shorthand syntax for 'disabled' attribute.
}

Passing

import React from "react";
 
function Example() {
  return <button disabled={true} />;
}