Documentation
Rules
prefer-shorthand-boolean

prefer-shorthand-boolean

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} />;
  //             ^^^^^^^^^^^^^^^
  //             - Prefer using shorthand syntax for 'disabled' attribute.
}

Passing

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