@eslint-react/jsx 5.20.6 → 5.20.8
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 +9 -3
- package/dist/index.js +8 -2
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -232,11 +232,17 @@ export declare function isElement(node: TSESTree.Node | null | undefined, test?:
|
|
|
232
232
|
* against the self name (last dot-separated segment) of both the node and the
|
|
233
233
|
* configured factory, so `<React.Fragment>` matches `"React.Fragment"` and
|
|
234
234
|
* `<Fragment>` matches `"Fragment"`.
|
|
235
|
+
*
|
|
236
|
+
* The factory is a required parameter (no implicit `"React.Fragment"` default) so
|
|
237
|
+
* that callers always pass the project-configured pragma — see `getJsxConfig` in
|
|
238
|
+
* `@eslint-react/core` — and cannot silently use the wrong factory under a custom
|
|
239
|
+
* JSX runtime (ex: Preact). Note the self-name comparison is a heuristic: any
|
|
240
|
+
* `<*.Fragment>` member expression matches, regardless of the qualifier.
|
|
235
241
|
* @param node The node to check.
|
|
236
242
|
* @param jsxFragmentFactory The configured fragment factory string (ex: "React.Fragment").
|
|
237
243
|
* @returns `true` if the node represents a React Fragment.
|
|
238
244
|
*/
|
|
239
|
-
export declare function isFragmentElement(node: TSESTree.Node, jsxFragmentFactory
|
|
245
|
+
export declare function isFragmentElement(node: TSESTree.Node, jsxFragmentFactory: string): node is TSESTreeJSXElementLike;
|
|
240
246
|
/**
|
|
241
247
|
* Check if the node is a host (intrinsic / DOM) element, that is, a `JSXElement`
|
|
242
248
|
* whose tag name starts with a lowercase letter (ex: `<div>` vs `<MyComponent>`).
|
|
@@ -263,7 +269,7 @@ export declare function getElementFullType(node: TSESTreeJSXElementLike): string
|
|
|
263
269
|
*
|
|
264
270
|
* - `<Foo.Bar.Baz>` -> `"Baz"`
|
|
265
271
|
* - `<div>` -> `"div"`
|
|
266
|
-
* - `<></>` -> `""
|
|
272
|
+
* - `<></>` -> `""`
|
|
267
273
|
* @param node The `JSXElement` or `JSXFragment` node.
|
|
268
274
|
* @returns The last segment of the element type, or `""` for fragments.
|
|
269
275
|
*/
|
|
@@ -314,4 +320,4 @@ export declare function isWhitespaceText(node: TSESTree.JSXChild): boolean;
|
|
|
314
320
|
*/
|
|
315
321
|
export declare function isEmptyStringExpression(node: TSESTree.JSXChild): boolean;
|
|
316
322
|
//#endregion
|
|
317
|
-
export type { ElementTest };
|
|
323
|
+
export type { AttributeValue, ElementTest };
|
package/dist/index.js
CHANGED
|
@@ -884,7 +884,7 @@ function getElementFullType(node) {
|
|
|
884
884
|
*
|
|
885
885
|
* - `<Foo.Bar.Baz>` -> `"Baz"`
|
|
886
886
|
* - `<div>` -> `"div"`
|
|
887
|
-
* - `<></>` -> `""
|
|
887
|
+
* - `<></>` -> `""`
|
|
888
888
|
* @param node The `JSXElement` or `JSXFragment` node.
|
|
889
889
|
* @returns The last segment of the element type, or `""` for fragments.
|
|
890
890
|
*/
|
|
@@ -923,11 +923,17 @@ function isElement(node, test) {
|
|
|
923
923
|
* against the self name (last dot-separated segment) of both the node and the
|
|
924
924
|
* configured factory, so `<React.Fragment>` matches `"React.Fragment"` and
|
|
925
925
|
* `<Fragment>` matches `"Fragment"`.
|
|
926
|
+
*
|
|
927
|
+
* The factory is a required parameter (no implicit `"React.Fragment"` default) so
|
|
928
|
+
* that callers always pass the project-configured pragma — see `getJsxConfig` in
|
|
929
|
+
* `@eslint-react/core` — and cannot silently use the wrong factory under a custom
|
|
930
|
+
* JSX runtime (ex: Preact). Note the self-name comparison is a heuristic: any
|
|
931
|
+
* `<*.Fragment>` member expression matches, regardless of the qualifier.
|
|
926
932
|
* @param node The node to check.
|
|
927
933
|
* @param jsxFragmentFactory The configured fragment factory string (ex: "React.Fragment").
|
|
928
934
|
* @returns `true` if the node represents a React Fragment.
|
|
929
935
|
*/
|
|
930
|
-
function isFragmentElement(node, jsxFragmentFactory
|
|
936
|
+
function isFragmentElement(node, jsxFragmentFactory) {
|
|
931
937
|
if (node.type === AST_NODE_TYPES.JSXFragment) return true;
|
|
932
938
|
if (node.type !== AST_NODE_TYPES.JSXElement) return false;
|
|
933
939
|
const fragment = jsxFragmentFactory.split(".").at(-1) ?? "Fragment";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "5.20.
|
|
3
|
+
"version": "5.20.8",
|
|
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.20.
|
|
33
|
-
"@eslint-react/eslint": "5.20.
|
|
34
|
-
"@eslint-react/shared": "5.20.
|
|
35
|
-
"@eslint-react/var": "5.20.
|
|
32
|
+
"@eslint-react/ast": "5.20.8",
|
|
33
|
+
"@eslint-react/eslint": "5.20.8",
|
|
34
|
+
"@eslint-react/shared": "5.20.8",
|
|
35
|
+
"@eslint-react/var": "5.20.8",
|
|
36
36
|
"@typescript-eslint/types": "^8.70.0",
|
|
37
37
|
"@typescript-eslint/utils": "^8.70.0",
|
|
38
38
|
"ts-pattern": "^5.9.0"
|