DocumentationRulesavoid-shorthand-boolean

avoid-shorthand-boolean

Full Name in eslint-plugin-react-x

react-x/avoid-shorthand-boolean

Full Name in @eslint-react/eslint-plugin

@eslint-react/avoid-shorthand-boolean

Features

🔍 🔧

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} />;
}