@eslint-react/core 2.7.4-next.5 → 2.7.4-next.7
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 +48 -48
- package/dist/index.js +12 -12
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -86,28 +86,28 @@ type ComponentDetectionHint = bigint;
|
|
|
86
86
|
*/
|
|
87
87
|
declare const ComponentDetectionHint: {
|
|
88
88
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
* Skip function component defined on object method
|
|
90
|
+
*/
|
|
91
91
|
readonly SkipObjectMethod: bigint;
|
|
92
92
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
* Skip function component defined on class method
|
|
94
|
+
*/
|
|
95
95
|
readonly SkipClassMethod: bigint;
|
|
96
96
|
/**
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
* Skip function component defined on class property
|
|
98
|
+
*/
|
|
99
99
|
readonly SkipClassProperty: bigint;
|
|
100
100
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
* Skip function component defined in array pattern
|
|
102
|
+
*/
|
|
103
103
|
readonly SkipArrayPattern: bigint;
|
|
104
104
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
* Skip function component defined in array expression
|
|
106
|
+
*/
|
|
107
107
|
readonly SkipArrayExpression: bigint;
|
|
108
108
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
* Skip function component defined as array map callback
|
|
110
|
+
*/
|
|
111
111
|
readonly SkipArrayMapCallback: bigint;
|
|
112
112
|
readonly None: 0n;
|
|
113
113
|
readonly SkipUndefined: bigint;
|
|
@@ -170,48 +170,48 @@ declare const ComponentFlag: {
|
|
|
170
170
|
*/
|
|
171
171
|
interface FunctionComponent extends SemanticNode {
|
|
172
172
|
/**
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
* The identifier or identifier sequence of the component
|
|
174
|
+
*/
|
|
175
175
|
id: unit | AST.FunctionID;
|
|
176
176
|
/**
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
* The kind of component
|
|
178
|
+
*/
|
|
179
179
|
kind: "function";
|
|
180
180
|
/**
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
* The AST node of the function
|
|
182
|
+
*/
|
|
183
183
|
node: AST.TSESTreeFunction;
|
|
184
184
|
/**
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
* Flags describing the component's characteristics
|
|
186
|
+
*/
|
|
187
187
|
flag: ComponentFlag;
|
|
188
188
|
/**
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
* Hint for how the component was detected
|
|
190
|
+
*/
|
|
191
191
|
hint: ComponentDetectionHint;
|
|
192
192
|
/**
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
* List of expressions returned by the component
|
|
194
|
+
*/
|
|
195
195
|
rets: TSESTree.ReturnStatement["argument"][];
|
|
196
196
|
/**
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
* The initialization path of the function
|
|
198
|
+
*/
|
|
199
199
|
initPath: unit | AST.FunctionInitPath;
|
|
200
200
|
/**
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
* Indicates if the component is inside an export default declaration
|
|
202
|
+
*/
|
|
203
203
|
isExportDefault: boolean;
|
|
204
204
|
/**
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
* Indicates if the component is itself an export default declaration
|
|
206
|
+
*/
|
|
207
207
|
isExportDefaultDeclaration: boolean;
|
|
208
208
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
* List of hook calls within the component
|
|
210
|
+
*/
|
|
211
211
|
hookCalls: TSESTree.CallExpression[];
|
|
212
212
|
/**
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
* The display name of the component
|
|
214
|
+
*/
|
|
215
215
|
displayName: unit | TSESTree.Expression;
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
@@ -219,32 +219,32 @@ interface FunctionComponent extends SemanticNode {
|
|
|
219
219
|
*/
|
|
220
220
|
interface ClassComponent extends SemanticNode {
|
|
221
221
|
/**
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
* The identifier of the component
|
|
223
|
+
*/
|
|
224
224
|
id: unit | TSESTree.BindingName;
|
|
225
225
|
/**
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
* The kind of component
|
|
227
|
+
*/
|
|
228
228
|
kind: "class";
|
|
229
229
|
/**
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
* The AST node of the class
|
|
231
|
+
*/
|
|
232
232
|
node: AST.TSESTreeClass;
|
|
233
233
|
/**
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
* Flags describing the component's characteristics
|
|
235
|
+
*/
|
|
236
236
|
flag: ComponentFlag;
|
|
237
237
|
/**
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
* Hint for how the component was detected
|
|
239
|
+
*/
|
|
240
240
|
hint: ComponentDetectionHint;
|
|
241
241
|
/**
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
* List of methods and properties in the class
|
|
243
|
+
*/
|
|
244
244
|
methods: AST.TSESTreeMethodOrProperty[];
|
|
245
245
|
/**
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
* The display name of the component
|
|
247
|
+
*/
|
|
248
248
|
displayName: unit | TSESTree.Expression;
|
|
249
249
|
}
|
|
250
250
|
/**
|
package/dist/index.js
CHANGED
|
@@ -576,16 +576,16 @@ function isJsxLike(code, node, hint = DEFAULT_JSX_DETECTION_HINT) {
|
|
|
576
576
|
if (hint & JsxDetectionHint.StrictLogical) return isJsxLike(code, node.left, hint) && isJsxLike(code, node.right, hint);
|
|
577
577
|
return isJsxLike(code, node.left, hint) || isJsxLike(code, node.right, hint);
|
|
578
578
|
case AST_NODE_TYPES.ConditionalExpression: {
|
|
579
|
-
function leftHasJSX(node
|
|
580
|
-
if (Array.isArray(node
|
|
581
|
-
if (node
|
|
582
|
-
if (hint & JsxDetectionHint.StrictArray) return node
|
|
583
|
-
return node
|
|
579
|
+
function leftHasJSX(node) {
|
|
580
|
+
if (Array.isArray(node.consequent)) {
|
|
581
|
+
if (node.consequent.length === 0) return !(hint & JsxDetectionHint.SkipEmptyArray);
|
|
582
|
+
if (hint & JsxDetectionHint.StrictArray) return node.consequent.every((n) => isJsxLike(code, n, hint));
|
|
583
|
+
return node.consequent.some((n) => isJsxLike(code, n, hint));
|
|
584
584
|
}
|
|
585
|
-
return isJsxLike(code, node
|
|
585
|
+
return isJsxLike(code, node.consequent, hint);
|
|
586
586
|
}
|
|
587
|
-
function rightHasJSX(node
|
|
588
|
-
return isJsxLike(code, node
|
|
587
|
+
function rightHasJSX(node) {
|
|
588
|
+
return isJsxLike(code, node.alternate, hint);
|
|
589
589
|
}
|
|
590
590
|
if (hint & JsxDetectionHint.StrictConditional) return leftHasJSX(node) && rightHasJSX(node);
|
|
591
591
|
return leftHasJSX(node) || rightHasJSX(node);
|
|
@@ -664,8 +664,8 @@ function isJsxFragmentElement(context, node, jsxConfig) {
|
|
|
664
664
|
* @returns The first matching JSX attribute node found when traversing upwards, or undefined
|
|
665
665
|
*/
|
|
666
666
|
function findParentJsxAttribute(node, test = constTrue) {
|
|
667
|
-
const guard = (node
|
|
668
|
-
return node
|
|
667
|
+
const guard = (node) => {
|
|
668
|
+
return node.type === AST_NODE_TYPES.JSXAttribute && test(node);
|
|
669
669
|
};
|
|
670
670
|
return AST.findParentNode(node, guard);
|
|
671
671
|
}
|
|
@@ -1215,8 +1215,8 @@ function isRenderPropLoose(context, node) {
|
|
|
1215
1215
|
* @returns `true` if component is declared inside a render property, `false` if not
|
|
1216
1216
|
*/
|
|
1217
1217
|
function isDirectValueOfRenderPropertyLoose(node) {
|
|
1218
|
-
const matching = (node
|
|
1219
|
-
return node
|
|
1218
|
+
const matching = (node) => {
|
|
1219
|
+
return node.type === AST_NODE_TYPES.Property && node.key.type === AST_NODE_TYPES.Identifier && node.key.name.startsWith("render");
|
|
1220
1220
|
};
|
|
1221
1221
|
return matching(node) || node.parent != null && matching(node.parent);
|
|
1222
1222
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "2.7.4-next.
|
|
3
|
+
"version": "2.7.4-next.7",
|
|
4
4
|
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"@typescript-eslint/utils": "^8.53.1",
|
|
36
36
|
"birecord": "^0.1.1",
|
|
37
37
|
"ts-pattern": "^5.9.0",
|
|
38
|
-
"@eslint-react/ast": "2.7.4-next.
|
|
39
|
-
"@eslint-react/
|
|
40
|
-
"@eslint-react/
|
|
41
|
-
"@eslint-react/var": "2.7.4-next.
|
|
38
|
+
"@eslint-react/ast": "2.7.4-next.7",
|
|
39
|
+
"@eslint-react/shared": "2.7.4-next.7",
|
|
40
|
+
"@eslint-react/eff": "2.7.4-next.7",
|
|
41
|
+
"@eslint-react/var": "2.7.4-next.7"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"tsdown": "^0.20.
|
|
44
|
+
"tsdown": "^0.20.1",
|
|
45
45
|
"@local/configs": "0.0.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|