@eslint-react/jsx 5.23.2 → 5.23.4
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.js +3 -6
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Check, Traverse } from "@eslint-react/ast";
|
|
|
2
2
|
import { resolve } from "@eslint-react/var";
|
|
3
3
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
4
4
|
import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
|
|
5
|
+
import { P, match } from "ts-pattern";
|
|
5
6
|
|
|
6
7
|
//#region ../../.pkgs/eff/dist/index.js
|
|
7
8
|
/**
|
|
@@ -908,12 +909,8 @@ function isElement(node, test) {
|
|
|
908
909
|
if (node == null) return false;
|
|
909
910
|
if (node.type !== AST_NODE_TYPES.JSXElement && node.type !== AST_NODE_TYPES.JSXFragment) return false;
|
|
910
911
|
if (test == null) return true;
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
case "string": return elementType === test;
|
|
914
|
-
case "function": return test(elementType, node);
|
|
915
|
-
default: return test.includes(elementType);
|
|
916
|
-
}
|
|
912
|
+
const type = getElementFullType(node);
|
|
913
|
+
return match(test).with(P.string, (t) => type === t).with(P.array(), (t) => t.includes(type)).with(P.instanceOf(Function), (t) => t(type, node)).exhaustive();
|
|
917
914
|
}
|
|
918
915
|
/**
|
|
919
916
|
* Check if the node is a React Fragment element.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.4",
|
|
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,11 +29,12 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eslint-react/ast": "5.23.
|
|
33
|
-
"@eslint-react/eslint": "5.23.
|
|
34
|
-
"@eslint-react/var": "5.23.
|
|
32
|
+
"@eslint-react/ast": "5.23.4",
|
|
33
|
+
"@eslint-react/eslint": "5.23.4",
|
|
34
|
+
"@eslint-react/var": "5.23.4",
|
|
35
35
|
"@typescript-eslint/types": "^8.71.0",
|
|
36
|
-
"@typescript-eslint/utils": "^8.71.0"
|
|
36
|
+
"@typescript-eslint/utils": "^8.71.0",
|
|
37
|
+
"ts-pattern": "^5.9.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@local/configs": "0.0.0",
|