jsx_equals_spacing

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT, MIT Imports: 4 Imported by: 0

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

View Source
var JsxEqualsSpacingRule = BuildRule("react/jsx-equals-spacing")

JsxEqualsSpacingRule is the eslint-plugin-react variant.

Functions

func BuildRule added in v0.22.0

func BuildRule(name string) rule.Rule

BuildRule constructs the jsx-equals-spacing rule registered under `name`.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL