eslint-plugin-react-x 5.30.0-rc.0 → 5.30.0-rc.1
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 +20 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -130,7 +130,7 @@ const rules$6 = {
|
|
|
130
130
|
};
|
|
131
131
|
// package.json
|
|
132
132
|
var name$6 = "eslint-plugin-react-x";
|
|
133
|
-
var version = "5.30.0-rc.
|
|
133
|
+
var version = "5.30.0-rc.1";
|
|
134
134
|
// src/utils/create-rule.ts
|
|
135
135
|
function getDocsUrl(ruleName) {
|
|
136
136
|
return `https://eslint-react.xyz/docs/rules/${ruleName}`;
|
|
@@ -7159,8 +7159,27 @@ function createRenderBoundaryChecker(componentNodes) {
|
|
|
7159
7159
|
return (node) => Traverse.hasParent(node, (n) => Check.isFunctionOrClass(n) && components.has(n));
|
|
7160
7160
|
}
|
|
7161
7161
|
// src/rules/static-components/origins.ts
|
|
7162
|
+
function getMemoizedValueExpressions(context, call) {
|
|
7163
|
+
const [factory] = call.arguments;
|
|
7164
|
+
if (factory == null || factory.type === AST_NODE_TYPES.SpreadElement) return null;
|
|
7165
|
+
if (core.isUseCallbackCall(context, call)) return [factory];
|
|
7166
|
+
if (!core.isUseMemoCall(context, call)) return null;
|
|
7167
|
+
const callback = Extract.unwrap(factory);
|
|
7168
|
+
if (!Check.isFunction(callback) || callback.async || callback.generator) return null;
|
|
7169
|
+
return Collect.getReturnExpressions(callback);
|
|
7170
|
+
}
|
|
7162
7171
|
function findDynamicCreationSite(context, node, isInsideRender, seen) {
|
|
7163
7172
|
const expr = Extract.unwrap(node);
|
|
7173
|
+
if (expr.type === AST_NODE_TYPES.CallExpression) {
|
|
7174
|
+
const memoized = getMemoizedValueExpressions(context, expr);
|
|
7175
|
+
if (memoized != null) {
|
|
7176
|
+
for (const value of memoized) {
|
|
7177
|
+
const source = findDynamicCreationSite(context, value, isInsideRender, seen);
|
|
7178
|
+
if (source != null) return source;
|
|
7179
|
+
}
|
|
7180
|
+
return null;
|
|
7181
|
+
}
|
|
7182
|
+
}
|
|
7164
7183
|
if (KNOWN_DYNAMIC_EXPRESSION_TYPES.has(expr.type)) return expr;
|
|
7165
7184
|
switch (expr.type) {
|
|
7166
7185
|
case AST_NODE_TYPES.ConditionalExpression: return findDynamicCreationSite(context, expr.consequent, isInsideRender, seen) ?? findDynamicCreationSite(context, expr.alternate, isInsideRender, seen);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.30.0-rc.
|
|
3
|
+
"version": "5.30.0-rc.1",
|
|
4
4
|
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@eslint-react/ast": "5.30.0-rc.
|
|
40
|
-
"@eslint-react/core": "5.30.0-rc.
|
|
41
|
-
"@eslint-react/eslint": "5.30.0-rc.
|
|
42
|
-
"@eslint-react/jsx": "5.30.0-rc.
|
|
43
|
-
"@eslint-react/shared": "5.30.0-rc.
|
|
44
|
-
"@eslint-react/var": "5.30.0-rc.
|
|
39
|
+
"@eslint-react/ast": "5.30.0-rc.1",
|
|
40
|
+
"@eslint-react/core": "5.30.0-rc.1",
|
|
41
|
+
"@eslint-react/eslint": "5.30.0-rc.1",
|
|
42
|
+
"@eslint-react/jsx": "5.30.0-rc.1",
|
|
43
|
+
"@eslint-react/shared": "5.30.0-rc.1",
|
|
44
|
+
"@eslint-react/var": "5.30.0-rc.1",
|
|
45
45
|
"@typescript-eslint/scope-manager": "^8.72.1",
|
|
46
46
|
"@typescript-eslint/types": "^8.72.1",
|
|
47
47
|
"@typescript-eslint/utils": "^8.72.1",
|