AphrodyBun GitHub

Runtime docs · Linter · Rules

react/jsx-equals-spacing

Enforce or disallow spaces around the = of JSX attributes

name="email" and name = "email" mean the same thing. Using one style everywhere keeps props easy to scan. By default the rule doesn't allow a space on either side of the =.

--fix adds or removes the spaces.

Configure

Off by default. To turn it on:

bunfig.toml
[lint.rules]
"react/jsx-equals-spacing" = "error" # or "warn"

Every option, set to its default:

bunfig.toml
[lint.rules]
"react/jsx-equals-spacing" = ["error", "never"] # "always" or "never"

Examples

Reported:

const field = <input name = "email" />;

Not reported:

const field = <input name="email" required />;

Options

OptionWhat it does
"never" (default)Don't allow a space before or after the =.
"always"Require a space before and after the =.
const field = <input name="email" />;
const field = <input name = "email" />;

When not to use it

A formatter such as bun fmt or Prettier already fixes this spacing.