eslint-plugin-react-x 5.6.3-next.0 → 5.6.4-next.0
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 +7 -15
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -142,7 +142,7 @@ const rules$6 = {
|
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region package.json
|
|
144
144
|
var name$6 = "eslint-plugin-react-x";
|
|
145
|
-
var version = "5.6.
|
|
145
|
+
var version = "5.6.4-next.0";
|
|
146
146
|
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/utils/create-rule.ts
|
|
@@ -2281,7 +2281,7 @@ function create$31(context) {
|
|
|
2281
2281
|
const callee = Extract.unwrap(n.callee);
|
|
2282
2282
|
return callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === "map";
|
|
2283
2283
|
});
|
|
2284
|
-
const iter = Traverse.findParent(jsxElement, (n) => n === call
|
|
2284
|
+
const iter = Traverse.findParent(jsxElement, Check.isFunction, (n) => n === call);
|
|
2285
2285
|
if (!Check.isFunction(iter)) return;
|
|
2286
2286
|
const arg0 = call?.arguments[0];
|
|
2287
2287
|
if (call == null || arg0 == null) return;
|
|
@@ -2745,7 +2745,7 @@ function getNestedReturnStatements$1(node) {
|
|
|
2745
2745
|
const boundaryNode = Check.isFunction(node) ? node : Traverse.findParent(node, Check.isFunction);
|
|
2746
2746
|
simpleTraverse(node, { enter(node) {
|
|
2747
2747
|
if (node.type !== AST_NODE_TYPES.ReturnStatement) return;
|
|
2748
|
-
if (Traverse.findParent(node, Check.isFunction)
|
|
2748
|
+
if (Traverse.findParent(node, Check.isFunction, (n) => n === boundaryNode) != null) return;
|
|
2749
2749
|
statements.push(node);
|
|
2750
2750
|
} });
|
|
2751
2751
|
return statements;
|
|
@@ -4285,7 +4285,7 @@ function create$6(context) {
|
|
|
4285
4285
|
}
|
|
4286
4286
|
const boundary = Traverse.findParent(node, isCompOrHookFn);
|
|
4287
4287
|
if (boundary == null) continue;
|
|
4288
|
-
if (Traverse.findParent(node, Check.isFunction)
|
|
4288
|
+
if (Traverse.findParent(node, Check.isFunction, (n) => n === boundary) != null) continue;
|
|
4289
4289
|
const refName = resolvedName;
|
|
4290
4290
|
let isLazyInit = isInNullCheckTest(node);
|
|
4291
4291
|
if (!isLazyInit) {
|
|
@@ -4339,7 +4339,7 @@ function create$6(context) {
|
|
|
4339
4339
|
for (const { node } of refPassedToFunctions) {
|
|
4340
4340
|
const boundary = Traverse.findParent(node, isCompOrHookFn);
|
|
4341
4341
|
if (boundary == null) continue;
|
|
4342
|
-
if (Traverse.findParent(node, Check.isFunction)
|
|
4342
|
+
if (Traverse.findParent(node, Check.isFunction, (n) => n === boundary) != null) continue;
|
|
4343
4343
|
context.report({
|
|
4344
4344
|
messageId: "refPassedToFunction",
|
|
4345
4345
|
node
|
|
@@ -7245,14 +7245,6 @@ function create$2(context) {
|
|
|
7245
7245
|
|
|
7246
7246
|
//#endregion
|
|
7247
7247
|
//#region src/rules/use-memo/lib.ts
|
|
7248
|
-
function isInsideNestedFunction(node, boundary) {
|
|
7249
|
-
let current = node.parent;
|
|
7250
|
-
while (current && current !== boundary) {
|
|
7251
|
-
if (Check.isFunction(current)) return true;
|
|
7252
|
-
current = current.parent;
|
|
7253
|
-
}
|
|
7254
|
-
return false;
|
|
7255
|
-
}
|
|
7256
7248
|
function isDeclaredInsideCallback(variable, callback) {
|
|
7257
7249
|
let scope = variable.scope;
|
|
7258
7250
|
while (scope != null) {
|
|
@@ -7271,7 +7263,7 @@ function getNestedReturnStatements(node) {
|
|
|
7271
7263
|
const boundaryNode = Check.isFunction(node) ? node : Traverse.findParent(node, Check.isFunction);
|
|
7272
7264
|
simpleTraverse(node, { enter(node) {
|
|
7273
7265
|
if (node.type !== AST_NODE_TYPES.ReturnStatement) return;
|
|
7274
|
-
if (Traverse.findParent(node, Check.isFunction)
|
|
7266
|
+
if (Traverse.findParent(node, Check.isFunction, (n) => n === boundaryNode) != null) return;
|
|
7275
7267
|
statements.push(node);
|
|
7276
7268
|
} });
|
|
7277
7269
|
return statements;
|
|
@@ -7306,7 +7298,7 @@ function create$1(context) {
|
|
|
7306
7298
|
if (node.type !== AST_NODE_TYPES.AssignmentExpression) return;
|
|
7307
7299
|
const left = Extract.unwrap(node.left);
|
|
7308
7300
|
if (left.type !== AST_NODE_TYPES.Identifier) return;
|
|
7309
|
-
if (
|
|
7301
|
+
if (Traverse.findParent(node, Check.isFunction, (n) => n === callback)) return;
|
|
7310
7302
|
const variable = findVariable(context.sourceCode.getScope(left), left);
|
|
7311
7303
|
if (variable != null && variable.defs.length > 0 && isDeclaredInsideCallback(variable, callback)) return;
|
|
7312
7304
|
violations.push({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.4-next.0",
|
|
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",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"string-ts": "^2.3.1",
|
|
46
46
|
"ts-api-utils": "^2.5.0",
|
|
47
47
|
"ts-pattern": "^5.9.0",
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/eslint": "5.6.
|
|
51
|
-
"@eslint-react/jsx": "5.6.
|
|
52
|
-
"@eslint-react/shared": "5.6.
|
|
53
|
-
"@eslint-react/var": "5.6.
|
|
48
|
+
"@eslint-react/ast": "5.6.4-next.0",
|
|
49
|
+
"@eslint-react/core": "5.6.4-next.0",
|
|
50
|
+
"@eslint-react/eslint": "5.6.4-next.0",
|
|
51
|
+
"@eslint-react/jsx": "5.6.4-next.0",
|
|
52
|
+
"@eslint-react/shared": "5.6.4-next.0",
|
|
53
|
+
"@eslint-react/var": "5.6.4-next.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/react": "^19.2.14",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"tsl": "^1.0.30",
|
|
64
64
|
"tsl-dx": "^0.12.1",
|
|
65
65
|
"typescript": "^6.0.3",
|
|
66
|
-
"@local/
|
|
67
|
-
"@local/
|
|
66
|
+
"@local/eff": "3.0.0-beta.72",
|
|
67
|
+
"@local/configs": "0.0.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"eslint": "^10.2.1",
|