@eslint-react/jsx 5.30.0-beta.15 → 5.30.0-beta.17
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 +2 -2
- package/dist/index.js +7 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -395,8 +395,8 @@ export declare function findCreateElementProp(context: RuleContext, call: Create
|
|
|
395
395
|
/**
|
|
396
396
|
* Check if the node itself is passed as a children argument (the third argument
|
|
397
397
|
* or later) of a `createElement` call. Contiguous TypeScript type-expression
|
|
398
|
-
* ancestors are skipped, and the node is unwrapped before
|
|
399
|
-
* expressions nested inside an argument are not considered.
|
|
398
|
+
* and chain-expression ancestors are skipped, and the node is unwrapped before
|
|
399
|
+
* the comparison; expressions nested inside an argument are not considered.
|
|
400
400
|
* @param context The ESLint rule context.
|
|
401
401
|
* @param node The node to check; nullish values return `false`.
|
|
402
402
|
* @returns `true` if the node is a direct children argument of a `createElement` call.
|
package/dist/index.js
CHANGED
|
@@ -267,8 +267,13 @@ function parseCreateElementCall(context, node) {
|
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
function getStaticPropertyName(context, property) {
|
|
270
|
-
if (!property.computed) return Extract.getPropertyName(property, "max");
|
|
271
270
|
const key = Extract.unwrap(property.key);
|
|
271
|
+
if (!property.computed) {
|
|
272
|
+
if (Check.isIdentifier(key)) return key.name;
|
|
273
|
+
if (key.type === AST_NODE_TYPES.Literal && typeof key.value === "string") return key.value;
|
|
274
|
+
if (key.type === AST_NODE_TYPES.TemplateLiteral && key.expressions.length === 0) return key.quasis[0]?.value.cooked ?? key.quasis[0]?.value.raw ?? null;
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
272
277
|
const staticValue = getStaticValue(key, context.sourceCode.getScope(key));
|
|
273
278
|
return typeof staticValue?.value === "string" ? staticValue.value : null;
|
|
274
279
|
}
|
|
@@ -284,7 +289,7 @@ function findCreateElementProp(context, call, name) {
|
|
|
284
289
|
function isCreateElementChildrenArgument(context, node) {
|
|
285
290
|
if (node == null) return false;
|
|
286
291
|
let parent = node.parent;
|
|
287
|
-
while (Check.
|
|
292
|
+
while (Check.isTypeOrChainExpression(parent)) parent = parent.parent;
|
|
288
293
|
const target = Extract.unwrap(node);
|
|
289
294
|
return parent?.type === AST_NODE_TYPES.CallExpression && isCreateElementCall(context, parent) && parent.arguments.slice(2).some((arg) => Extract.unwrap(arg) === target);
|
|
290
295
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "5.30.0-beta.
|
|
3
|
+
"version": "5.30.0-beta.17",
|
|
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,8 +29,8 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eslint-react/ast": "5.30.0-beta.
|
|
33
|
-
"@eslint-react/eslint": "5.30.0-beta.
|
|
32
|
+
"@eslint-react/ast": "5.30.0-beta.17",
|
|
33
|
+
"@eslint-react/eslint": "5.30.0-beta.17",
|
|
34
34
|
"@typescript-eslint/types": "^8.72.1",
|
|
35
35
|
"@typescript-eslint/utils": "^8.72.1"
|
|
36
36
|
},
|