@eslint-react/jsx 5.17.0 → 5.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +194 -209
  2. package/dist/index.js +723 -277
  3. package/package.json +8 -7
package/dist/index.d.ts CHANGED
@@ -1,23 +1,7 @@
1
1
  import { TSESTreeJSXAttributeLike, TSESTreeJSXElementLike } from "@eslint-react/ast";
2
2
  import { TSESTree } from "@typescript-eslint/types";
3
3
  import { RuleContext } from "@eslint-react/eslint";
4
- //#region src/collapse-multiline-text.d.ts
5
- /**
6
- * Collapse a multiline JSX text string following React's whitespace rules.
7
- *
8
- * This mirrors Babel's `cleanJSXElementLiteralChild` algorithm:
9
- * 1. Split the raw text into lines.
10
- * 2. Find the last non-empty line.
11
- * 3. Trim leading spaces on non-first lines and trailing spaces on non-last lines.
12
- * 4. Collapse tabs into spaces.
13
- * 5. Append a single space after each non-last non-empty line.
14
- * @param text The raw JSX text string to collapse.
15
- * @returns The collapsed string, or `null` if the text contains only whitespace.
16
- * @see https://github.com/babel/babel/blob/main/packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts
17
- */
18
- declare function collapseMultilineText(text: string): string | null;
19
- //#endregion
20
- //#region src/find-attribute.d.ts
4
+ //#region src/attribute-find.d.ts
21
5
  /**
22
6
  * Find a JSX attribute (or spread attribute containing the property) by name on a given element.
23
7
  *
@@ -26,15 +10,14 @@ declare function collapseMultilineText(text: string): string | null;
26
10
  *
27
11
  * Spread attributes are resolved when possible: if the spread argument is an identifier
28
12
  * that resolves to an object expression, the object's properties are searched for a matching key.
29
- * Nested object expressions and nested spread identifiers are also resolved.
13
+ * Nested object expressions and nested spread identifiers are also resolved
14
+ * (see {@link findSpreadProperty}).
30
15
  * @param context The ESLint rule context (needed for variable resolution in spread attributes).
31
16
  * @param element The `JSXElement` node to search.
32
17
  * @param name The attribute name to look for (ex: "className").
33
18
  * @returns The matching `JSXAttribute` or `JSXSpreadAttribute`, or `undefined` when not found.
34
19
  */
35
20
  declare function findAttribute(context: RuleContext, element: TSESTree.JSXElement, name: string): TSESTreeJSXAttributeLike | undefined;
36
- //#endregion
37
- //#region src/find-parent-attribute.d.ts
38
21
  /**
39
22
  * Walk up the AST from `node` to find the nearest ancestor that is a `JSXAttribute`
40
23
  * and (optionally) passes a predicate.
@@ -43,11 +26,76 @@ declare function findAttribute(context: RuleContext, element: TSESTree.JSXElemen
43
26
  * inside an expression container) and needs to know which JSX attribute it belongs to.
44
27
  * @param node The starting node for the upward search.
45
28
  * @param test Optional predicate to filter candidate `JSXAttribute` nodes. When omitted every `JSXAttribute` ancestor matches.
46
- * @returns The first matching `JSXAttribute` ancestor, or `null` if none is found before reaching the root.
29
+ * @returns The first matching `JSXAttribute` ancestor, or `undefined` if none is found before reaching the root.
30
+ */
31
+ declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | undefined;
32
+ /**
33
+ * Find the `Property` node that provides a given key inside a spread argument.
34
+ *
35
+ * This is the single resolution routine shared by {@link findAttribute} (existence
36
+ * checks) and the `spreadProps` variant of `resolveAttributeValue` (value extraction):
37
+ *
38
+ * - An `Identifier` argument is resolved to its initializer via variable
39
+ * resolution, following alias chains (`const b = a`) like `getStaticValue`
40
+ * does; an `ObjectExpression` argument is searched directly.
41
+ * - Properties are walked **in reverse** so that later entries win, matching
42
+ * JavaScript object semantics (`{ ...a, k: 1 }` -> the literal `k`).
43
+ * - Nested `SpreadElement`s (identifiers or inline object expressions) are
44
+ * searched recursively; a `seen` set guards against circular references.
45
+ * - Plain identifier keys and string literal keys are matched directly;
46
+ * computed keys are matched when they are statically evaluable
47
+ * (ex: `{ ["class" + "Name"]: 1 }`).
48
+ * @param context The ESLint rule context (needed for variable resolution).
49
+ * @param argument The spread argument expression to search.
50
+ * @param name The property name to look for.
51
+ * @param seen Internal set of already-visited nodes (cycle guard).
52
+ * @returns The matching `Property` node, or `undefined` when the key is not found.
53
+ */
54
+ declare function findSpreadProperty(context: RuleContext, argument: TSESTree.Expression, name: string, seen?: Set<TSESTree.Node>): TSESTree.Property | undefined;
55
+ //#endregion
56
+ //#region src/attribute-has.d.ts
57
+ /**
58
+ * Check whether a JSX element carries a given attribute (prop).
59
+ *
60
+ * This is a thin convenience wrapper around {@link findAttribute} for the
61
+ * common case where you only need a boolean answer.
62
+ *
63
+ * Spread attributes are taken into account: `<Comp {...{ disabled: true }} />`
64
+ * will report `true` for `"disabled"`.
65
+ * @param context The ESLint rule context (needed for variable resolution in spread attributes).
66
+ * @param element The `JSXElement` node to inspect.
67
+ * @param name The attribute name to look for (ex: "className").
68
+ * @returns `true` when the attribute is present on the element.
69
+ */
70
+ declare function hasAttribute(context: RuleContext, element: TSESTree.JSXElement, name: string): boolean;
71
+ /**
72
+ * Check whether a JSX element carries at least one of the given attributes.
73
+ *
74
+ * This is a batch variant of {@link hasAttribute} for the common pattern of
75
+ * short-circuiting on multiple prop names.
76
+ *
77
+ * Spread attributes are taken into account (see {@link findAttribute}).
78
+ * @param context The ESLint rule context (needed for variable resolution in spread attributes).
79
+ * @param element The `JSXElement` node to inspect.
80
+ * @param names The attribute names to look for.
81
+ * @returns `true` when at least one of the attributes is present.
82
+ */
83
+ declare function hasAnyAttribute(context: RuleContext, element: TSESTree.JSXElement, names: string[]): boolean;
84
+ /**
85
+ * Check whether a JSX element carries all of the given attributes (props).
86
+ *
87
+ * This is a batch variant of {@link hasAttribute} for the common pattern
88
+ * where a rule needs to verify that a set of required props are all present.
89
+ *
90
+ * Spread attributes are taken into account (see {@link findAttribute}).
91
+ * @param context The ESLint rule context (needed for variable resolution in spread attributes).
92
+ * @param element The `JSXElement` node to inspect.
93
+ * @param names The attribute names to look for.
94
+ * @returns `true` when every name in `names` is present on the element.
47
95
  */
48
- declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | null;
96
+ declare function hasEveryAttribute(context: RuleContext, element: TSESTree.JSXElement, names: string[]): boolean;
49
97
  //#endregion
50
- //#region src/get-attribute-name.d.ts
98
+ //#region src/attribute-name.d.ts
51
99
  /**
52
100
  * Get the stringified name of a `JSXAttribute` node.
53
101
  *
@@ -59,81 +107,84 @@ declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree
59
107
  * @returns The attribute name as a plain string.
60
108
  */
61
109
  declare function getAttributeName(node: TSESTree.JSXAttribute): string;
62
- //#endregion
63
- //#region src/get-attribute-static-value.d.ts
64
110
  /**
65
- * Find an attribute by name on a JSX element and collapse its value to a plain
66
- * JavaScript value in a single step.
111
+ * Check whether a node is a `JSXAttribute` with the given name.
67
112
  *
68
- * This is a convenience composition of {@link findAttribute} ->
69
- * {@link resolveAttributeValue} -> `toStatic()`, with automatic handling of the
70
- * `spreadProps` case (extracts the named property from the spread object).
113
+ * Only plain identifier names are matched (ex: `className`); namespaced
114
+ * attributes (ex: `xml:space`) do not match.
71
115
  *
72
- * Returns `null` when the attribute is absent, `undefined` when the value cannot
73
- * be statically determined (including empty expression containers), and the
74
- * resolved static value otherwise.
75
- * @param context The ESLint rule context.
76
- * @param element The `JSXElement` node to inspect.
77
- * @param name The attribute name to look up (ex: "className").
78
- * @returns The static value of the attribute, `null` when absent, or `undefined` when indeterminate.
116
+ * Supports both data-first and data-last (curried) call styles:
117
+ * - `isAttribute(node, "className")`
118
+ * - `isAttribute("className")(node)`.
119
+ * @param node The AST node to test.
120
+ * @param name The attribute name to match (ex: "className").
121
+ * @returns `true` when the node is a `JSXAttribute` named `name`.
79
122
  */
80
- declare function getAttributeStaticValue(context: RuleContext, element: TSESTree.JSXElement, name: string): unknown;
123
+ declare const isAttribute: {
124
+ (name: string): (node: TSESTree.Node) => node is TSESTree.JSXAttribute;
125
+ (node: TSESTree.Node, name: string): node is TSESTree.JSXAttribute;
126
+ };
81
127
  //#endregion
82
- //#region src/jsx-attribute-value.d.ts
128
+ //#region src/attribute-value.d.ts
83
129
  /**
84
130
  * Discriminated union representing the resolved value of a JSX attribute.
85
131
  *
86
- * Each variant carries the original AST `node` (where applicable) and a
87
- * `toStatic()` helper that attempts to collapse the value into a plain
88
- * JavaScript value at analysis time.
132
+ * Each variant carries the original AST `node` (where applicable the
133
+ * `boolean` variant has no value node and reports `null`) and a `toStatic()`
134
+ * helper that attempts to collapse the value into a plain JavaScript value
135
+ * at analysis time.
136
+ *
137
+ * `toStatic()` returns `undefined` whenever no static value is available;
138
+ * structural information is carried by `kind`, value information by `toStatic()`.
89
139
  */
90
- type JsxAttributeValue = JsxAttributeValueBoolean | JsxAttributeValueElement | JsxAttributeValueLiteral | JsxAttributeValueUnknown | JsxAttributeValueMissing | JsxAttributeValueSpreadChild | JsxAttributeValueSpreadProps;
91
- /** Boolean attribute with no value (ex: `<input disabled />`). */
92
- interface JsxAttributeValueBoolean {
140
+ type AttributeValue = {
93
141
  readonly kind: "boolean";
94
142
  readonly node: null;
95
143
  toStatic(): true;
96
- }
97
- /** JSX element used as an attribute value (ex: `<Slot icon=<Icon /> />`). */
98
- interface JsxAttributeValueElement {
99
- readonly kind: "element";
100
- readonly node: TSESTree.JSXElement;
101
- toStatic(): null;
102
- }
103
- /** Literal value (ex: `<img alt="photo" />`). */
104
- interface JsxAttributeValueLiteral {
144
+ } | {
105
145
  readonly kind: "literal";
106
146
  readonly node: TSESTree.Literal;
107
147
  toStatic(): TSESTree.Literal["value"];
108
- }
109
- /** Expression container value (ex: `<Comp value={expr} />`). */
110
- interface JsxAttributeValueUnknown {
148
+ } | {
111
149
  readonly kind: "unknown";
112
- readonly node: TSESTree.JSXExpressionContainer["expression"];
150
+ readonly node: TSESTree.Expression;
113
151
  toStatic(): unknown;
114
- }
115
- /** Empty expression container (ex: `<Comp value={} />`). */
116
- interface JsxAttributeValueMissing {
152
+ } | {
153
+ readonly kind: "element";
154
+ readonly node: TSESTree.JSXElement;
155
+ toStatic(): undefined;
156
+ } | {
117
157
  readonly kind: "missing";
118
158
  readonly node: TSESTree.JSXEmptyExpression;
119
- toStatic(): null;
120
- }
121
- /** Spread child expression (ex: `{...items}` as children). */
122
- interface JsxAttributeValueSpreadChild {
159
+ toStatic(): undefined;
160
+ } | {
123
161
  readonly kind: "spreadChild";
124
- getChildren(): unknown;
125
- readonly node: TSESTree.JSXSpreadChild["expression"];
126
- toStatic(): null;
127
- }
128
- /** Spread props (ex: `<Comp {...props} />`). */
129
- interface JsxAttributeValueSpreadProps {
162
+ readonly node: TSESTree.JSXSpreadChild;
163
+ toStatic(): undefined;
164
+ } | {
130
165
  readonly kind: "spreadProps";
131
166
  getProperty(name: string): unknown;
132
167
  readonly node: TSESTree.JSXSpreadAttribute["argument"];
133
- toStatic(): null;
134
- }
135
- //#endregion
136
- //#region src/get-attribute-value.d.ts
168
+ toStatic(): unknown;
169
+ };
170
+ /**
171
+ * Resolve the value of a JSX attribute (or spread attribute) into an
172
+ * {@link AttributeValue} descriptor that can be inspected further.
173
+ *
174
+ * This is the low-level building block; it operates on a single attribute
175
+ * node that the caller has already located. For the higher-level "find by
176
+ * name and resolve" combo, see {@link getAttributeValue}.
177
+ *
178
+ * When the attribute is a `JSXSpreadAttribute`, passing `name` (typically the
179
+ * same name the attribute was found by) makes `toStatic()` return the static
180
+ * value of that named property, eliminating the need to branch on
181
+ * `kind === "spreadProps"` at the call site.
182
+ * @param context The ESLint rule context (needed for scope look-ups).
183
+ * @param attribute A `JSXAttribute` or `JSXSpreadAttribute` node.
184
+ * @param name Optional property name used to resolve `toStatic()` for spread attributes.
185
+ * @returns A discriminated-union descriptor of the attribute's value.
186
+ */
187
+ declare function resolveAttributeValue(context: RuleContext, attribute: TSESTreeJSXAttributeLike, name?: string): AttributeValue;
137
188
  /**
138
189
  * Find an attribute by name on a JSX element and resolve its value in a single call.
139
190
  *
@@ -143,11 +194,28 @@ interface JsxAttributeValueSpreadProps {
143
194
  * @param context The ESLint rule context.
144
195
  * @param element The `JSXElement` node to search.
145
196
  * @param name The attribute name to look up (ex: "className").
146
- * @returns A {@link JsxAttributeValue} descriptor, or `null` when the attribute is not present on the element.
197
+ * @returns An {@link AttributeValue} descriptor, or `undefined` when the attribute is not present on the element.
198
+ */
199
+ declare function getAttributeValue(context: RuleContext, element: TSESTree.JSXElement, name: string): AttributeValue | undefined;
200
+ /**
201
+ * Find an attribute by name on a JSX element and collapse its value to a plain
202
+ * JavaScript value in a single step.
203
+ *
204
+ * This is a convenience composition of {@link findAttribute} ->
205
+ * {@link resolveAttributeValue} -> `toStatic()`, with automatic handling of the
206
+ * `spreadProps` case (extracts the named property from the spread object).
207
+ *
208
+ * Returns `undefined` both when the attribute is absent and when its value
209
+ * cannot be statically determined; use {@link findAttribute} or
210
+ * {@link hasAttribute} when presence itself matters.
211
+ * @param context The ESLint rule context.
212
+ * @param element The `JSXElement` node to inspect.
213
+ * @param name The attribute name to look up (ex: "className").
214
+ * @returns The static value of the attribute, or `undefined` when absent or indeterminate.
147
215
  */
148
- declare function getAttributeValue(context: RuleContext, element: TSESTree.JSXElement, name: string): JsxAttributeValue | null;
216
+ declare function getAttributeStaticValue(context: RuleContext, element: TSESTree.JSXElement, name: string): unknown;
149
217
  //#endregion
150
- //#region src/get-children.d.ts
218
+ //#region src/children.d.ts
151
219
  /**
152
220
  * Get the meaningful children of a JSX element or fragment.
153
221
  *
@@ -155,68 +223,12 @@ declare function getAttributeValue(context: RuleContext, element: TSESTree.JSXEl
155
223
  * 1. Iterate over `element.children`.
156
224
  * 2. Skip `JSXText` nodes that clean to nothing (padding whitespace).
157
225
  * 3. Skip `JSXExpressionContainer` nodes whose expression is empty.
158
- * 4. Skip `JSXEmptyExpression` nodes.
226
+ * 4. Skip empty string expressions (`{""}`), which produce no DOM node.
159
227
  * 5. Collect everything else.
160
228
  * @param element A `JSXElement` or `JSXFragment` node.
161
229
  * @returns An array of children nodes that contribute to rendered output.
162
230
  */
163
231
  declare function getChildren(element: TSESTreeJSXElementLike): TSESTree.JSXChild[];
164
- //#endregion
165
- //#region src/get-element-type.d.ts
166
- /**
167
- * Get the string representation of a JSX element's type.
168
- *
169
- * - `<div>` -> `"div"`
170
- * - `<Foo.Bar>` -> `"Foo.Bar"`
171
- * - `<React.Fragment>` -> `"React.Fragment"`
172
- * - `<></>` -> `""`.
173
- * @param node A `JSXElement` or `JSXFragment` node.
174
- * @returns The fully-qualified element type string.
175
- */
176
- declare function getElementFullType(node: TSESTreeJSXElementLike): string;
177
- /**
178
- * Get the self name (last dot-separated segment) of a JSX element type.
179
- *
180
- * - `<Foo.Bar.Baz>` -> `"Baz"`
181
- * - `<div>` -> `"div"`
182
- * - `<></>` -> `""`.
183
- * @param node A `JSXElement` or `JSXFragment` node.
184
- * @returns The last segment of the element type, or `""` for fragments.
185
- */
186
- declare function getElementSelfType(node: TSESTreeJSXElementLike): string;
187
- //#endregion
188
- //#region src/has-any-attribute.d.ts
189
- /**
190
- * Check whether a JSX element carries at least one of the given attributes.
191
- *
192
- * This is a batch variant of {@link hasAttribute} for the common pattern of
193
- * short-circuiting on multiple prop names.
194
- *
195
- * Spread attributes are taken into account (see {@link findAttribute}).
196
- * @param context The ESLint rule context (needed for variable resolution in spread attributes).
197
- * @param element The `JSXElement` node to inspect.
198
- * @param names The attribute names to look for.
199
- * @returns `true` when at least one of the attributes is present.
200
- */
201
- declare function hasAnyAttribute(context: RuleContext, element: TSESTree.JSXElement, names: string[]): boolean;
202
- //#endregion
203
- //#region src/has-attribute.d.ts
204
- /**
205
- * Check whether a JSX element carries a given attribute (prop).
206
- *
207
- * This is a thin convenience wrapper around {@link findAttribute} for the
208
- * common case where you only need a boolean answer.
209
- *
210
- * Spread attributes are taken into account: `<Comp {...{ disabled: true }} />`
211
- * will report `true` for `"disabled"`.
212
- * @param context The ESLint rule context (needed for variable resolution in spread attributes).
213
- * @param element The `JSXElement` node to inspect.
214
- * @param name The attribute name to look for (ex: "className").
215
- * @returns `true` when the attribute is present on the element.
216
- */
217
- declare function hasAttribute(context: RuleContext, element: TSESTree.JSXElement, name: string): boolean;
218
- //#endregion
219
- //#region src/has-children.d.ts
220
232
  /**
221
233
  * Check whether a JSX element (or fragment) has meaningful children, that is,
222
234
  * at least one child that is not purely whitespace text or an empty string expression.
@@ -241,22 +253,7 @@ declare function hasAttribute(context: RuleContext, element: TSESTree.JSXElement
241
253
  */
242
254
  declare function hasChildren(element: TSESTreeJSXElementLike): boolean;
243
255
  //#endregion
244
- //#region src/has-every-attribute.d.ts
245
- /**
246
- * Check whether a JSX element carries all of the given attributes (props).
247
- *
248
- * This is a batch variant of {@link hasAttribute} for the common pattern
249
- * where a rule needs to verify that a set of required props are all present.
250
- *
251
- * Spread attributes are taken into account (see {@link findAttribute}).
252
- * @param context The ESLint rule context (needed for variable resolution in spread attributes).
253
- * @param element The `JSXElement` node to inspect.
254
- * @param names The attribute names to look for.
255
- * @returns `true` when every name in `names` is present on the element.
256
- */
257
- declare function hasEveryAttribute(context: RuleContext, element: TSESTree.JSXElement, names: string[]): boolean;
258
- //#endregion
259
- //#region src/is-element.d.ts
256
+ //#region src/element-is.d.ts
260
257
  /**
261
258
  * A test that determines whether a JSX element matches.
262
259
  *
@@ -280,8 +277,6 @@ type ElementTest = string | readonly string[] | ((elementType: string, node: TSE
280
277
  * @returns `true` when the node is a matching JSX element.
281
278
  */
282
279
  declare function isElement(node: TSESTree.Node | null | undefined, test?: ElementTest): node is TSESTreeJSXElementLike;
283
- //#endregion
284
- //#region src/is-fragment-element.d.ts
285
280
  /**
286
281
  * Check whether a node is a React Fragment element.
287
282
  *
@@ -296,8 +291,6 @@ declare function isElement(node: TSESTree.Node | null | undefined, test?: Elemen
296
291
  * @returns `true` when the node represents a React Fragment.
297
292
  */
298
293
  declare function isFragmentElement(node: TSESTree.Node, jsxFragmentFactory?: string): node is TSESTreeJSXElementLike;
299
- //#endregion
300
- //#region src/is-host-element.d.ts
301
294
  /**
302
295
  * Check whether a node is a host (intrinsic / DOM) element.
303
296
  *
@@ -309,7 +302,45 @@ declare function isFragmentElement(node: TSESTree.Node, jsxFragmentFactory?: str
309
302
  */
310
303
  declare function isHostElement(node: TSESTree.Node): node is TSESTree.JSXElement;
311
304
  //#endregion
312
- //#region src/is-whitespace.d.ts
305
+ //#region src/element-type.d.ts
306
+ /**
307
+ * Get the string representation of a JSX element's type.
308
+ *
309
+ * - `<div>` -> `"div"`
310
+ * - `<Foo.Bar>` -> `"Foo.Bar"`
311
+ * - `<React.Fragment>` -> `"React.Fragment"`
312
+ * - `<xml:space>` -> `"xml:space"`
313
+ * - `<></>` -> `""`.
314
+ * @param node A `JSXElement` or `JSXFragment` node.
315
+ * @returns The fully-qualified element type string.
316
+ */
317
+ declare function getElementFullType(node: TSESTreeJSXElementLike): string;
318
+ /**
319
+ * Get the self name (last dot-separated segment) of a JSX element type.
320
+ *
321
+ * - `<Foo.Bar.Baz>` -> `"Baz"`
322
+ * - `<div>` -> `"div"`
323
+ * - `<></>` -> `""`.
324
+ * @param node A `JSXElement` or `JSXFragment` node.
325
+ * @returns The last segment of the element type, or `""` for fragments.
326
+ */
327
+ declare function getElementSelfType(node: TSESTreeJSXElementLike): string;
328
+ //#endregion
329
+ //#region src/text.d.ts
330
+ /**
331
+ * Collapse a multiline JSX text string following React's whitespace rules.
332
+ *
333
+ * This mirrors Babel's `cleanJSXElementLiteralChild` algorithm:
334
+ * 1. Split the raw text into lines.
335
+ * 2. Find the last non-empty line.
336
+ * 3. Trim leading spaces on non-first lines and trailing spaces on non-last lines.
337
+ * 4. Collapse tabs into spaces.
338
+ * 5. Append a single space after each non-last non-empty line.
339
+ * @param text The raw JSX text string to collapse.
340
+ * @returns The collapsed string, or `null` if the text contains only whitespace.
341
+ * @see https://github.com/babel/babel/blob/main/packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts
342
+ */
343
+ declare function collapseMultilineText(text: string): string | null;
313
344
  /**
314
345
  * Check whether a JSX child node is whitespace padding that React would
315
346
  * trim away during rendering.
@@ -317,16 +348,18 @@ declare function isHostElement(node: TSESTree.Node): node is TSESTree.JSXElement
317
348
  * A child is considered whitespace padding when it is a `JSXText` node whose
318
349
  * content is empty after applying React's whitespace normalization
319
350
  * (see {@link collapseMultilineText}, modelled after Babel's
320
- * `cleanJSXElementLiteralChild`). This is the whitespace that appears between
321
- * JSX tags purely for formatting.
351
+ * `cleanJSXElementLiteralChild`) **and** it contains a newline. This is the
352
+ * whitespace that appears between JSX tags purely for formatting.
353
+ *
354
+ * For the looser "any whitespace-only text" check, see {@link isWhitespaceText}.
322
355
  * @param node A JSX child node.
323
356
  * @returns `true` when the node is purely formatting whitespace.
324
357
  */
325
- declare function isWhitespace(node: TSESTree.JSXChild): boolean;
358
+ declare function isPaddingWhitespace(node: TSESTree.JSXChild): boolean;
326
359
  /**
327
360
  * Check whether a JSX child node is any whitespace-only text.
328
361
  *
329
- * This is a looser variant of {@link isWhitespace}; it matches every
362
+ * This is a looser variant of {@link isPaddingWhitespace}; it matches every
330
363
  * `JSXText` node whose raw content is empty after trimming, regardless of
331
364
  * whether it contains a newline.
332
365
  * @param node A JSX child node.
@@ -345,52 +378,4 @@ declare function isWhitespaceText(node: TSESTree.JSXChild): boolean;
345
378
  */
346
379
  declare function isEmptyStringExpression(node: TSESTree.JSXChild): boolean;
347
380
  //#endregion
348
- //#region src/jsx-detection-hint.d.ts
349
- /**
350
- * BitFlags for configuring JSX detection behavior.
351
- *
352
- * Used by `isJsxLike` to control which AST node kinds are considered
353
- * "JSX-like". Combine flags with the `|` operator.
354
- */
355
- type JsxDetectionHint = bigint;
356
- /**
357
- * Hints for JSX detection.
358
- */
359
- declare const JsxDetectionHint: {
360
- readonly None: 0n;
361
- readonly DoNotIncludeJsxWithNullValue: bigint;
362
- readonly DoNotIncludeJsxWithNumberValue: bigint;
363
- readonly DoNotIncludeJsxWithBigIntValue: bigint;
364
- readonly DoNotIncludeJsxWithStringValue: bigint;
365
- readonly DoNotIncludeJsxWithBooleanValue: bigint;
366
- readonly DoNotIncludeJsxWithUndefinedValue: bigint;
367
- readonly DoNotIncludeJsxWithEmptyArrayValue: bigint;
368
- readonly DoNotIncludeJsxWithCreateElementValue: bigint;
369
- readonly RequireAllArrayElementsToBeJsx: bigint;
370
- readonly RequireBothSidesOfLogicalExpressionToBeJsx: bigint;
371
- readonly RequireBothBranchesOfConditionalExpressionToBeJsx: bigint;
372
- };
373
- /**
374
- * Default JSX detection hint.
375
- *
376
- * Skips number, bigint, boolean, string, and undefined literals,
377
- * the value types that are commonly returned alongside JSX in React
378
- * components but are not themselves renderable elements.
379
- */
380
- declare const DEFAULT_JSX_DETECTION_HINT: JsxDetectionHint;
381
- //#endregion
382
- //#region src/resolve-attribute-value.d.ts
383
- /**
384
- * Resolve the value of a JSX attribute (or spread attribute) into a
385
- * {@link JsxAttributeValue} descriptor that can be inspected further.
386
- *
387
- * This is the low-level building block; it operates on a single attribute
388
- * node that the caller has already located. For the higher-level "find by
389
- * name and resolve" combo, see {@link getAttributeValue}.
390
- * @param context The ESLint rule context (needed for scope look-ups).
391
- * @param attribute A `JSXAttribute` or `JSXSpreadAttribute` node.
392
- * @returns A discriminated-union descriptor of the attribute's value.
393
- */
394
- declare function resolveAttributeValue(context: RuleContext, attribute: TSESTreeJSXAttributeLike): JsxAttributeValue;
395
- //#endregion
396
- export { DEFAULT_JSX_DETECTION_HINT, ElementTest, JsxAttributeValue, JsxDetectionHint, collapseMultilineText, findAttribute, findParentAttribute, getAttributeName, getAttributeStaticValue, getAttributeValue, getChildren, getElementFullType, getElementSelfType, hasAnyAttribute, hasAttribute, hasChildren, hasEveryAttribute, isElement, isEmptyStringExpression, isFragmentElement, isHostElement, isWhitespace, isWhitespaceText, resolveAttributeValue };
381
+ export { type ElementTest, collapseMultilineText, findAttribute, findParentAttribute, findSpreadProperty, getAttributeName, getAttributeStaticValue, getAttributeValue, getChildren, getElementFullType, getElementSelfType, hasAnyAttribute, hasAttribute, hasChildren, hasEveryAttribute, isAttribute, isElement, isEmptyStringExpression, isFragmentElement, isHostElement, isPaddingWhitespace, isWhitespaceText, resolveAttributeValue };