@eslint-react/jsx 5.18.7 → 5.18.9

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 (2) hide show
  1. package/dist/index.d.ts +23 -23
  2. package/package.json +7 -7
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ import { RuleContext } from "@eslint-react/eslint";
17
17
  * @param name The attribute name to look for (ex: "className").
18
18
  * @returns The matching `JSXAttribute` or `JSXSpreadAttribute`, or `undefined` when not found.
19
19
  */
20
- declare function findAttribute(context: RuleContext, element: TSESTree.JSXElement, name: string): TSESTreeJSXAttributeLike | undefined;
20
+ export declare function findAttribute(context: RuleContext, element: TSESTree.JSXElement, name: string): TSESTreeJSXAttributeLike | undefined;
21
21
  /**
22
22
  * Walk up the AST from `node` to find the nearest ancestor that is a `JSXAttribute`
23
23
  * and (optionally) passes a predicate.
@@ -28,7 +28,7 @@ declare function findAttribute(context: RuleContext, element: TSESTree.JSXElemen
28
28
  * @param test Optional predicate to filter candidate `JSXAttribute` nodes. When omitted every `JSXAttribute` ancestor matches.
29
29
  * @returns The first matching `JSXAttribute` ancestor, or `undefined` if none is found before reaching the root.
30
30
  */
31
- declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | undefined;
31
+ export declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | undefined;
32
32
  /**
33
33
  * Find the `Property` node that provides a given key inside a spread argument.
34
34
  *
@@ -51,7 +51,7 @@ declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree
51
51
  * @param seen Internal set of already-visited nodes (cycle guard).
52
52
  * @returns The matching `Property` node, or `undefined` when the key is not found.
53
53
  */
54
- declare function findSpreadProperty(context: RuleContext, argument: TSESTree.Expression, name: string, seen?: Set<TSESTree.Node>): TSESTree.Property | undefined;
54
+ export declare function findSpreadProperty(context: RuleContext, argument: TSESTree.Expression, name: string, seen?: Set<TSESTree.Node>): TSESTree.Property | undefined;
55
55
  //#endregion
56
56
  //#region src/attribute-has.d.ts
57
57
  /**
@@ -67,7 +67,7 @@ declare function findSpreadProperty(context: RuleContext, argument: TSESTree.Exp
67
67
  * @param name The attribute name to look for (ex: "className").
68
68
  * @returns `true` when the attribute is present on the element.
69
69
  */
70
- declare function hasAttribute(context: RuleContext, element: TSESTree.JSXElement, name: string): boolean;
70
+ export declare function hasAttribute(context: RuleContext, element: TSESTree.JSXElement, name: string): boolean;
71
71
  /**
72
72
  * Check whether a JSX element carries at least one of the given attributes.
73
73
  *
@@ -80,7 +80,7 @@ declare function hasAttribute(context: RuleContext, element: TSESTree.JSXElement
80
80
  * @param names The attribute names to look for.
81
81
  * @returns `true` when at least one of the attributes is present.
82
82
  */
83
- declare function hasAnyAttribute(context: RuleContext, element: TSESTree.JSXElement, names: string[]): boolean;
83
+ export declare function hasAnyAttribute(context: RuleContext, element: TSESTree.JSXElement, names: string[]): boolean;
84
84
  /**
85
85
  * Check whether a JSX element carries all of the given attributes (props).
86
86
  *
@@ -93,7 +93,7 @@ declare function hasAnyAttribute(context: RuleContext, element: TSESTree.JSXElem
93
93
  * @param names The attribute names to look for.
94
94
  * @returns `true` when every name in `names` is present on the element.
95
95
  */
96
- declare function hasEveryAttribute(context: RuleContext, element: TSESTree.JSXElement, names: string[]): boolean;
96
+ export declare function hasEveryAttribute(context: RuleContext, element: TSESTree.JSXElement, names: string[]): boolean;
97
97
  //#endregion
98
98
  //#region src/attribute-name.d.ts
99
99
  /**
@@ -106,7 +106,7 @@ declare function hasEveryAttribute(context: RuleContext, element: TSESTree.JSXEl
106
106
  * @param node A `JSXAttribute` AST node.
107
107
  * @returns The attribute name as a plain string.
108
108
  */
109
- declare function getAttributeName(node: TSESTree.JSXAttribute): string;
109
+ export declare function getAttributeName(node: TSESTree.JSXAttribute): string;
110
110
  /**
111
111
  * Check whether a node is a `JSXAttribute` with the given name.
112
112
  *
@@ -120,7 +120,7 @@ declare function getAttributeName(node: TSESTree.JSXAttribute): string;
120
120
  * @param name The attribute name to match (ex: "className").
121
121
  * @returns `true` when the node is a `JSXAttribute` named `name`.
122
122
  */
123
- declare const isAttribute: {
123
+ export declare const isAttribute: {
124
124
  (name: string): (node: TSESTree.Node) => node is TSESTree.JSXAttribute;
125
125
  (node: TSESTree.Node, name: string): node is TSESTree.JSXAttribute;
126
126
  };
@@ -184,7 +184,7 @@ type AttributeValue = {
184
184
  * @param name Optional property name used to resolve `toStatic()` for spread attributes.
185
185
  * @returns A discriminated-union descriptor of the attribute's value.
186
186
  */
187
- declare function resolveAttributeValue(context: RuleContext, attribute: TSESTreeJSXAttributeLike, name?: string): AttributeValue;
187
+ export declare function resolveAttributeValue(context: RuleContext, attribute: TSESTreeJSXAttributeLike, name?: string): AttributeValue;
188
188
  /**
189
189
  * Find an attribute by name on a JSX element and resolve its value in a single call.
190
190
  *
@@ -196,7 +196,7 @@ declare function resolveAttributeValue(context: RuleContext, attribute: TSESTree
196
196
  * @param name The attribute name to look up (ex: "className").
197
197
  * @returns An {@link AttributeValue} descriptor, or `undefined` when the attribute is not present on the element.
198
198
  */
199
- declare function getAttributeValue(context: RuleContext, element: TSESTree.JSXElement, name: string): AttributeValue | undefined;
199
+ export declare function getAttributeValue(context: RuleContext, element: TSESTree.JSXElement, name: string): AttributeValue | undefined;
200
200
  /**
201
201
  * Find an attribute by name on a JSX element and collapse its value to a plain
202
202
  * JavaScript value in a single step.
@@ -213,7 +213,7 @@ declare function getAttributeValue(context: RuleContext, element: TSESTree.JSXEl
213
213
  * @param name The attribute name to look up (ex: "className").
214
214
  * @returns The static value of the attribute, or `undefined` when absent or indeterminate.
215
215
  */
216
- declare function getAttributeStaticValue(context: RuleContext, element: TSESTree.JSXElement, name: string): unknown;
216
+ export declare function getAttributeStaticValue(context: RuleContext, element: TSESTree.JSXElement, name: string): unknown;
217
217
  //#endregion
218
218
  //#region src/children.d.ts
219
219
  /**
@@ -228,7 +228,7 @@ declare function getAttributeStaticValue(context: RuleContext, element: TSESTree
228
228
  * @param element A `JSXElement` or `JSXFragment` node.
229
229
  * @returns An array of children nodes that contribute to rendered output.
230
230
  */
231
- declare function getChildren(element: TSESTreeJSXElementLike): TSESTree.JSXChild[];
231
+ export declare function getChildren(element: TSESTreeJSXElementLike): TSESTree.JSXChild[];
232
232
  /**
233
233
  * Check whether a JSX element (or fragment) has meaningful children, that is,
234
234
  * at least one child that is not purely whitespace text or an empty string expression.
@@ -251,7 +251,7 @@ declare function getChildren(element: TSESTreeJSXElementLike): TSESTree.JSXChild
251
251
  * @param element A `JSXElement` or `JSXFragment` node.
252
252
  * @returns `true` when the element has at least one meaningful child.
253
253
  */
254
- declare function hasChildren(element: TSESTreeJSXElementLike): boolean;
254
+ export declare function hasChildren(element: TSESTreeJSXElementLike): boolean;
255
255
  //#endregion
256
256
  //#region src/element-is.d.ts
257
257
  /**
@@ -276,7 +276,7 @@ type ElementTest = string | readonly string[] | ((elementType: string, node: TSE
276
276
  * @param test Optional test to match the element type against.
277
277
  * @returns `true` when the node is a matching JSX element.
278
278
  */
279
- declare function isElement(node: TSESTree.Node | null | undefined, test?: ElementTest): node is TSESTreeJSXElementLike;
279
+ export declare function isElement(node: TSESTree.Node | null | undefined, test?: ElementTest): node is TSESTreeJSXElementLike;
280
280
  /**
281
281
  * Check whether a node is a React Fragment element.
282
282
  *
@@ -290,7 +290,7 @@ declare function isElement(node: TSESTree.Node | null | undefined, test?: Elemen
290
290
  * @param jsxFragmentFactory The configured fragment factory string (ex: "React.Fragment").
291
291
  * @returns `true` when the node represents a React Fragment.
292
292
  */
293
- declare function isFragmentElement(node: TSESTree.Node, jsxFragmentFactory?: string): node is TSESTreeJSXElementLike;
293
+ export declare function isFragmentElement(node: TSESTree.Node, jsxFragmentFactory?: string): node is TSESTreeJSXElementLike;
294
294
  /**
295
295
  * Check whether a node is a host (intrinsic / DOM) element.
296
296
  *
@@ -300,7 +300,7 @@ declare function isFragmentElement(node: TSESTree.Node, jsxFragmentFactory?: str
300
300
  * @param node The AST node to test.
301
301
  * @returns `true` when the node is a `JSXElement` with a lowercase tag name.
302
302
  */
303
- declare function isHostElement(node: TSESTree.Node): node is TSESTree.JSXElement;
303
+ export declare function isHostElement(node: TSESTree.Node): node is TSESTree.JSXElement;
304
304
  //#endregion
305
305
  //#region src/element-type.d.ts
306
306
  /**
@@ -314,7 +314,7 @@ declare function isHostElement(node: TSESTree.Node): node is TSESTree.JSXElement
314
314
  * @param node A `JSXElement` or `JSXFragment` node.
315
315
  * @returns The fully-qualified element type string.
316
316
  */
317
- declare function getElementFullType(node: TSESTreeJSXElementLike): string;
317
+ export declare function getElementFullType(node: TSESTreeJSXElementLike): string;
318
318
  /**
319
319
  * Get the self name (last dot-separated segment) of a JSX element type.
320
320
  *
@@ -324,7 +324,7 @@ declare function getElementFullType(node: TSESTreeJSXElementLike): string;
324
324
  * @param node A `JSXElement` or `JSXFragment` node.
325
325
  * @returns The last segment of the element type, or `""` for fragments.
326
326
  */
327
- declare function getElementSelfType(node: TSESTreeJSXElementLike): string;
327
+ export declare function getElementSelfType(node: TSESTreeJSXElementLike): string;
328
328
  //#endregion
329
329
  //#region src/text.d.ts
330
330
  /**
@@ -340,7 +340,7 @@ declare function getElementSelfType(node: TSESTreeJSXElementLike): string;
340
340
  * @returns The collapsed string, or `null` if the text contains only whitespace.
341
341
  * @see https://github.com/babel/babel/blob/main/packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts
342
342
  */
343
- declare function collapseMultilineText(text: string): string | null;
343
+ export declare function collapseMultilineText(text: string): string | null;
344
344
  /**
345
345
  * Check whether a JSX child node is whitespace padding that React would
346
346
  * trim away during rendering.
@@ -355,7 +355,7 @@ declare function collapseMultilineText(text: string): string | null;
355
355
  * @param node A JSX child node.
356
356
  * @returns `true` when the node is purely formatting whitespace.
357
357
  */
358
- declare function isPaddingWhitespace(node: TSESTree.JSXChild): boolean;
358
+ export declare function isPaddingWhitespace(node: TSESTree.JSXChild): boolean;
359
359
  /**
360
360
  * Check whether a JSX child node is any whitespace-only text.
361
361
  *
@@ -365,7 +365,7 @@ declare function isPaddingWhitespace(node: TSESTree.JSXChild): boolean;
365
365
  * @param node A JSX child node.
366
366
  * @returns `true` when the node is a whitespace-only `JSXText`.
367
367
  */
368
- declare function isWhitespaceText(node: TSESTree.JSXChild): boolean;
368
+ export declare function isWhitespaceText(node: TSESTree.JSXChild): boolean;
369
369
  /**
370
370
  * Check whether a JSX child node is an empty string expression (`{""}`).
371
371
  *
@@ -376,6 +376,6 @@ declare function isWhitespaceText(node: TSESTree.JSXChild): boolean;
376
376
  * @param node A JSX child node.
377
377
  * @returns `true` when the node is a `{""}` expression container.
378
378
  */
379
- declare function isEmptyStringExpression(node: TSESTree.JSXChild): boolean;
379
+ export declare function isEmptyStringExpression(node: TSESTree.JSXChild): boolean;
380
380
  //#endregion
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 };
381
+ export type { ElementTest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/jsx",
3
- "version": "5.18.7",
3
+ "version": "5.18.9",
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,10 +29,10 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@eslint-react/ast": "5.18.7",
33
- "@eslint-react/eslint": "5.18.7",
34
- "@eslint-react/shared": "5.18.7",
35
- "@eslint-react/var": "5.18.7",
32
+ "@eslint-react/ast": "5.18.9",
33
+ "@eslint-react/eslint": "5.18.9",
34
+ "@eslint-react/shared": "5.18.9",
35
+ "@eslint-react/var": "5.18.9",
36
36
  "@typescript-eslint/types": "^8.69.0",
37
37
  "@typescript-eslint/utils": "^8.69.0",
38
38
  "ts-pattern": "^5.9.0"
@@ -41,8 +41,8 @@
41
41
  "@local/configs": "0.0.0",
42
42
  "@local/eff": "0.0.0",
43
43
  "@local/testkit": "0.0.0",
44
- "eslint": "^10.9.1",
45
- "tsdown": "^0.22.14",
44
+ "eslint": "^10.10.0",
45
+ "tsdown": "^0.23.0",
46
46
  "typescript": "6.0.3"
47
47
  },
48
48
  "peerDependencies": {