@eslint-react/jsx 5.27.3 → 5.28.0

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.
package/dist/index.d.ts CHANGED
@@ -128,7 +128,7 @@ type AttributeValue = {
128
128
  toStatic(): unknown;
129
129
  } | {
130
130
  readonly kind: "element";
131
- readonly node: TSESTree.JSXElement;
131
+ readonly node: TSESTreeJSXElementLike;
132
132
  toStatic(): undefined;
133
133
  } | {
134
134
  readonly kind: "missing";
@@ -283,8 +283,8 @@ export declare function getElementSelfType(node: TSESTreeJSXElementLike): string
283
283
  * Mirrors Babel's `cleanJSXElementLiteralChild` algorithm:
284
284
  * 1. Split the raw text into lines.
285
285
  * 2. Find the last non-empty line.
286
- * 3. Trim leading spaces on non-first lines and trailing spaces on non-last lines.
287
- * 4. Collapse tabs into spaces.
286
+ * 3. Collapse tabs into spaces.
287
+ * 4. Trim leading spaces on non-first lines and trailing spaces on non-last lines.
288
288
  * 5. Append a single space after each non-last non-empty line.
289
289
  * @param text The raw JSX text string to collapse.
290
290
  * @returns The collapsed string, or `null` when the text contains only whitespace.
@@ -297,6 +297,10 @@ export declare function collapseMultilineText(text: string): string | null;
297
297
  * {@link collapseMultilineText}) and contains a newline.
298
298
  *
299
299
  * For the looser "any whitespace-only text" check, see {@link isWhitespaceText}.
300
+ *
301
+ * Reads the entity-decoded `node.value`; `value` and `raw` differ only when the
302
+ * text contains HTML entities (ex: ` `), which is never whitespace-only,
303
+ * so reading either field yields the same result here.
300
304
  * @param node The JSX child node to check.
301
305
  * @returns `true` if the node is purely formatting whitespace.
302
306
  */
@@ -306,6 +310,10 @@ export declare function isPaddingWhitespace(node: TSESTree.JSXChild): boolean;
306
310
  *
307
311
  * Looser variant of {@link isPaddingWhitespace}; matches every `JSXText` node
308
312
  * whose raw content is empty after trimming, regardless of newlines.
313
+ *
314
+ * Reads `node.raw` rather than the entity-decoded `value`; for whitespace-only
315
+ * text the two are identical (an entity is never whitespace), matching React's
316
+ * behavior of rendering entity text like ` ` as a real text node.
309
317
  * @param node The JSX child node to check.
310
318
  * @returns `true` if the node is a whitespace-only `JSXText`.
311
319
  */
package/dist/index.js CHANGED
@@ -213,6 +213,11 @@ function resolveJsxAttribute(context, node) {
213
213
  node: node.value,
214
214
  toStatic() {}
215
215
  };
216
+ case AST_NODE_TYPES.JSXFragment: return {
217
+ kind: "element",
218
+ node: node.value,
219
+ toStatic() {}
220
+ };
216
221
  case AST_NODE_TYPES.JSXSpreadChild: return {
217
222
  kind: "spreadChild",
218
223
  node: node.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/jsx",
3
- "version": "5.27.3",
3
+ "version": "5.28.0",
4
4
  "description": "ESLint React's TSESTree JSX utility module for static analysis of JSX patterns.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -29,9 +29,9 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@eslint-react/ast": "5.27.3",
33
- "@eslint-react/eslint": "5.27.3",
34
- "@eslint-react/var": "5.27.3",
32
+ "@eslint-react/ast": "5.28.0",
33
+ "@eslint-react/eslint": "5.28.0",
34
+ "@eslint-react/var": "5.28.0",
35
35
  "@typescript-eslint/types": "^8.71.2",
36
36
  "@typescript-eslint/utils": "^8.71.2",
37
37
  "ts-pattern": "^5.9.2"