Documentation
¶
Overview ¶
Package jsx_equals_spacing implements jsx-equals-spacing (`react/jsx-equals-spacing`).
The rule enforces or disallows spaces around the `=` sign in JSX attributes: under `never` (default) there must be no space on either side of `=`, and under `always` a single space is required on both sides. Spread attributes (`{...props}`) and valueless attributes (`<App foo />`) are never checked.
Upstream listens on ESTree's `JSXOpeningElement`, which covers both the `<App ... />` self-closing form and the `<App ...>` form. tsgo splits these into KindJsxSelfClosingElement and KindJsxOpeningElement, so the rule registers a listener for each. Spacing is decided the way ESLint's `sourceCode.isSpaceBetween` does: a whitespace/newline token anywhere between the two operands counts as a space, while the inner bytes of a comment do NOT (a comment is a single token, so its content never surfaces as a whitespace gap). The diagnostic is reported on the `=` token itself, matching upstream's `loc: equalToken.loc.start`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var JsxEqualsSpacingRule = BuildRule("react/jsx-equals-spacing")
JsxEqualsSpacingRule is the eslint-plugin-react variant.
Functions ¶
Types ¶
This section is empty.