@eslint-react/jsx 1.24.0-next.0 → 1.24.0-next.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.
- package/dist/index.js +6 -6
- package/dist/index.mjs +7 -7
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ function findParentProp(node, test = eff.returnTrue) {
|
|
|
31
31
|
const guard = (node2) => {
|
|
32
32
|
return node2.type === types.AST_NODE_TYPES.JSXAttribute && test(node2);
|
|
33
33
|
};
|
|
34
|
-
return AST3__namespace.
|
|
34
|
+
return AST3__namespace.findParentNode(node, guard);
|
|
35
35
|
}
|
|
36
36
|
function resolveJSXMemberExpressions(object, property) {
|
|
37
37
|
if (object.type === types.AST_NODE_TYPES.JSXMemberExpression) {
|
|
@@ -115,7 +115,7 @@ function findPropInProperties(name, properties, initialScope, seenProps = []) {
|
|
|
115
115
|
variableNode.properties,
|
|
116
116
|
initialScope,
|
|
117
117
|
[...seenProps, prop.argument.name]
|
|
118
|
-
)
|
|
118
|
+
) != null;
|
|
119
119
|
}
|
|
120
120
|
return false;
|
|
121
121
|
}
|
|
@@ -125,7 +125,7 @@ function findPropInProperties(name, properties, initialScope, seenProps = []) {
|
|
|
125
125
|
prop.argument.properties,
|
|
126
126
|
initialScope,
|
|
127
127
|
seenProps
|
|
128
|
-
)
|
|
128
|
+
) != null;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
return false;
|
|
@@ -143,12 +143,12 @@ function findPropInAttributes(name, initialScope, attributes) {
|
|
|
143
143
|
const variable = VAR__namespace.findVariable(attr.argument.name, initialScope);
|
|
144
144
|
const variableNode = VAR__namespace.getVariableNode(variable, 0);
|
|
145
145
|
if (variableNode?.type === types.AST_NODE_TYPES.ObjectExpression) {
|
|
146
|
-
return findPropInProperties(name, variableNode.properties, initialScope)
|
|
146
|
+
return findPropInProperties(name, variableNode.properties, initialScope) != null;
|
|
147
147
|
}
|
|
148
148
|
return false;
|
|
149
149
|
}
|
|
150
150
|
case types.AST_NODE_TYPES.ObjectExpression:
|
|
151
|
-
return findPropInProperties(name, attr.argument.properties, initialScope)
|
|
151
|
+
return findPropInProperties(name, attr.argument.properties, initialScope) != null;
|
|
152
152
|
}
|
|
153
153
|
return false;
|
|
154
154
|
});
|
|
@@ -156,7 +156,7 @@ function findPropInAttributes(name, initialScope, attributes) {
|
|
|
156
156
|
|
|
157
157
|
// src/has-prop.ts
|
|
158
158
|
function hasProp(propName, initialScope, attributes) {
|
|
159
|
-
return
|
|
159
|
+
return findPropInAttributes(propName, initialScope, attributes) != null;
|
|
160
160
|
}
|
|
161
161
|
function hasAnyProp(attributes, propNames, initialScope) {
|
|
162
162
|
return propNames.some((propName) => hasProp(propName, initialScope, attributes));
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as AST3 from '@eslint-react/ast';
|
|
2
|
-
import { returnTrue
|
|
2
|
+
import { returnTrue } from '@eslint-react/eff';
|
|
3
3
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
4
4
|
import * as VAR from '@eslint-react/var';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ function findParentProp(node, test = returnTrue) {
|
|
|
8
8
|
const guard = (node2) => {
|
|
9
9
|
return node2.type === AST_NODE_TYPES.JSXAttribute && test(node2);
|
|
10
10
|
};
|
|
11
|
-
return AST3.
|
|
11
|
+
return AST3.findParentNode(node, guard);
|
|
12
12
|
}
|
|
13
13
|
function resolveJSXMemberExpressions(object, property) {
|
|
14
14
|
if (object.type === AST_NODE_TYPES.JSXMemberExpression) {
|
|
@@ -92,7 +92,7 @@ function findPropInProperties(name, properties, initialScope, seenProps = []) {
|
|
|
92
92
|
variableNode.properties,
|
|
93
93
|
initialScope,
|
|
94
94
|
[...seenProps, prop.argument.name]
|
|
95
|
-
)
|
|
95
|
+
) != null;
|
|
96
96
|
}
|
|
97
97
|
return false;
|
|
98
98
|
}
|
|
@@ -102,7 +102,7 @@ function findPropInProperties(name, properties, initialScope, seenProps = []) {
|
|
|
102
102
|
prop.argument.properties,
|
|
103
103
|
initialScope,
|
|
104
104
|
seenProps
|
|
105
|
-
)
|
|
105
|
+
) != null;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
return false;
|
|
@@ -120,12 +120,12 @@ function findPropInAttributes(name, initialScope, attributes) {
|
|
|
120
120
|
const variable = VAR.findVariable(attr.argument.name, initialScope);
|
|
121
121
|
const variableNode = VAR.getVariableNode(variable, 0);
|
|
122
122
|
if (variableNode?.type === AST_NODE_TYPES.ObjectExpression) {
|
|
123
|
-
return findPropInProperties(name, variableNode.properties, initialScope)
|
|
123
|
+
return findPropInProperties(name, variableNode.properties, initialScope) != null;
|
|
124
124
|
}
|
|
125
125
|
return false;
|
|
126
126
|
}
|
|
127
127
|
case AST_NODE_TYPES.ObjectExpression:
|
|
128
|
-
return findPropInProperties(name, attr.argument.properties, initialScope)
|
|
128
|
+
return findPropInProperties(name, attr.argument.properties, initialScope) != null;
|
|
129
129
|
}
|
|
130
130
|
return false;
|
|
131
131
|
});
|
|
@@ -133,7 +133,7 @@ function findPropInAttributes(name, initialScope, attributes) {
|
|
|
133
133
|
|
|
134
134
|
// src/has-prop.ts
|
|
135
135
|
function hasProp(propName, initialScope, attributes) {
|
|
136
|
-
return
|
|
136
|
+
return findPropInAttributes(propName, initialScope, attributes) != null;
|
|
137
137
|
}
|
|
138
138
|
function hasAnyProp(attributes, propNames, initialScope) {
|
|
139
139
|
return propNames.some((propName) => hasProp(propName, initialScope, attributes));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "1.24.0-next.
|
|
3
|
+
"version": "1.24.0-next.2",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module for static analysis of JSX.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"@typescript-eslint/types": "^8.19.1",
|
|
38
38
|
"@typescript-eslint/utils": "^8.19.1",
|
|
39
39
|
"ts-pattern": "^5.6.0",
|
|
40
|
-
"@eslint-react/ast": "1.24.0-next.
|
|
41
|
-
"@eslint-react/eff": "1.24.0-next.
|
|
42
|
-
"@eslint-react/
|
|
43
|
-
"@eslint-react/
|
|
40
|
+
"@eslint-react/ast": "1.24.0-next.2",
|
|
41
|
+
"@eslint-react/eff": "1.24.0-next.2",
|
|
42
|
+
"@eslint-react/var": "1.24.0-next.2",
|
|
43
|
+
"@eslint-react/types": "1.24.0-next.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"tsup": "^8.3.5",
|