react/jsx-props-no-multi-spaces
Disallow more than one space, or an empty line, between JSX props
fixable
Extra spaces between props, or an empty line between props that are each on their own line, are usually left over from an edit.
--fix replaces the extra spaces with one. It doesn't remove empty lines.
Configure#
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"react/jsx-props-no-multi-spaces" = "error" # or "warn"Examples#
example.jsx2 problems
const button = <Button type="submit"Expected only one space between “Button” and “type” disabledExpected only one space between “type” and “disabled” />;example.jsx1 problem
const button = (
<Button
type="submit"
disabledExpected no line gap between “type” and “disabled”
/>
);example.jsxNo problems
const button = <Button type="submit" disabled />;
const link = (
<Link
to="/settings"
replace
/>
);When not to use it#
A formatter such as bun fmt or Prettier already fixes this spacing.