eslint-plugin-react-x 5.24.10 → 5.26.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 +12 -12
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -135,7 +135,7 @@ const rules$6 = {
|
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region package.json
|
|
137
137
|
var name$6 = "eslint-plugin-react-x";
|
|
138
|
-
var version = "5.
|
|
138
|
+
var version = "5.26.0";
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/utils/create-rule.ts
|
|
141
141
|
function getDocsUrl(ruleName) {
|
|
@@ -1372,7 +1372,7 @@ function isInitializedFromUseRef(context, node) {
|
|
|
1372
1372
|
function isKnownNonMutatingMethodCall(context, node) {
|
|
1373
1373
|
const callee = Extract.unwrap(node.callee);
|
|
1374
1374
|
return Check.isExpression(callee) && isInitializedFromCall(context, callee, (init) => {
|
|
1375
|
-
return KNOWN_MUTATING_HOOKS.
|
|
1375
|
+
return [...KNOWN_MUTATING_HOOKS].some((hook) => core.isAPICall(hook)(context, init));
|
|
1376
1376
|
});
|
|
1377
1377
|
}
|
|
1378
1378
|
function isRefLikeChain(context, node) {
|
|
@@ -2236,7 +2236,7 @@ function create$34(context) {
|
|
|
2236
2236
|
const hooks = hc.api.getAllHooks(node);
|
|
2237
2237
|
const funcs = [...comps, ...hooks];
|
|
2238
2238
|
for (const call of facts) {
|
|
2239
|
-
if (Traverse.
|
|
2239
|
+
if (!Traverse.hasParent(call, (n) => funcs.some((f) => f.node === n))) continue;
|
|
2240
2240
|
context.report({
|
|
2241
2241
|
messageId: "default",
|
|
2242
2242
|
node: call
|
|
@@ -2701,7 +2701,7 @@ function getNestedReturnStatements$1(node) {
|
|
|
2701
2701
|
const boundary = Check.isFunction(node) ? node : Traverse.findParent(node, Check.isFunction);
|
|
2702
2702
|
simpleTraverse(node, { enter(node) {
|
|
2703
2703
|
if (node.type !== AST_NODE_TYPES.ReturnStatement) return;
|
|
2704
|
-
if (Traverse.
|
|
2704
|
+
if (Traverse.hasParent(node, Check.isFunction, (n) => n === boundary)) return;
|
|
2705
2705
|
statements.push(node);
|
|
2706
2706
|
} });
|
|
2707
2707
|
return statements;
|
|
@@ -2819,7 +2819,7 @@ function create$23(context) {
|
|
|
2819
2819
|
return {
|
|
2820
2820
|
CallExpression(node) {
|
|
2821
2821
|
if (!core.isCaptureOwnerStackCall(context, node)) return;
|
|
2822
|
-
if (Traverse.
|
|
2822
|
+
if (!Traverse.hasParent(node, (n) => isDevelopmentOnlyCheck(context, n))) context.report({
|
|
2823
2823
|
messageId: "missing-development-only-check",
|
|
2824
2824
|
node
|
|
2825
2825
|
});
|
|
@@ -2905,7 +2905,7 @@ function isInsideJSXAttributeValue(node) {
|
|
|
2905
2905
|
return node.parent.type === AST_NODE_TYPES.JSXAttribute || findParentAttribute(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
2906
2906
|
}
|
|
2907
2907
|
function isInsideRenderMethod(node) {
|
|
2908
|
-
return Traverse.
|
|
2908
|
+
return Traverse.hasParent(node, (n) => core.isRenderMethodLike(n) && core.isClassComponent(n.parent.parent));
|
|
2909
2909
|
}
|
|
2910
2910
|
var no_nested_component_definitions_default = createRule({
|
|
2911
2911
|
meta: {
|
|
@@ -3002,7 +3002,7 @@ function create$21(context) {
|
|
|
3002
3002
|
...hc.api.getAllHooks(program),
|
|
3003
3003
|
...cc.api.getAllComponents(program)
|
|
3004
3004
|
];
|
|
3005
|
-
for (const lazy of lazyCalls) if (Traverse.
|
|
3005
|
+
for (const lazy of lazyCalls) if (Traverse.hasParent(lazy, (n) => significantParents.some((p) => p.node === n))) context.report({
|
|
3006
3006
|
messageId: "default",
|
|
3007
3007
|
node: lazy
|
|
3008
3008
|
});
|
|
@@ -6967,7 +6967,7 @@ const KNOWN_DYNAMIC_EXPRESSION_TYPES = /* @__PURE__ */ new Set([
|
|
|
6967
6967
|
]);
|
|
6968
6968
|
function createRenderBoundaryChecker(componentNodes) {
|
|
6969
6969
|
const components = new Set(componentNodes);
|
|
6970
|
-
return (node) => Traverse.
|
|
6970
|
+
return (node) => Traverse.hasParent(node, (n) => (Check.isFunction(n) || Check.isClass(n)) && components.has(n));
|
|
6971
6971
|
}
|
|
6972
6972
|
//#endregion
|
|
6973
6973
|
//#region src/rules/static-components/origins.ts
|
|
@@ -7167,7 +7167,7 @@ function getNestedReturnStatements(node) {
|
|
|
7167
7167
|
const boundary = Check.isFunction(node) ? node : Traverse.findParent(node, Check.isFunction);
|
|
7168
7168
|
simpleTraverse(node, { enter(node) {
|
|
7169
7169
|
if (node.type !== AST_NODE_TYPES.ReturnStatement) return;
|
|
7170
|
-
if (Traverse.
|
|
7170
|
+
if (Traverse.hasParent(node, Check.isFunction, (n) => n === boundary)) return;
|
|
7171
7171
|
statements.push(node);
|
|
7172
7172
|
} });
|
|
7173
7173
|
return statements;
|
|
@@ -7180,7 +7180,7 @@ function createFactCollector(isUseMemoCall) {
|
|
|
7180
7180
|
const writes = [];
|
|
7181
7181
|
function pushWrite(node, target) {
|
|
7182
7182
|
if (!Check.isIdentifier(target)) return;
|
|
7183
|
-
if (Traverse.
|
|
7183
|
+
if (Traverse.hasParent(node, Check.isFunction, (n) => n === callback)) return;
|
|
7184
7184
|
writes.push({
|
|
7185
7185
|
node,
|
|
7186
7186
|
target
|
|
@@ -7431,7 +7431,7 @@ function create(context) {
|
|
|
7431
7431
|
for (const expr of getNestedNewExpressions(useStateInput)) {
|
|
7432
7432
|
if (!hasProperty(expr.callee, "name")) continue;
|
|
7433
7433
|
if (LAZY_INIT_ALLOW_LIST.includes(expr.callee.name)) continue;
|
|
7434
|
-
if (Traverse.
|
|
7434
|
+
if (Traverse.hasParent(expr, core.isUseCall(context))) continue;
|
|
7435
7435
|
context.report({
|
|
7436
7436
|
messageId: "invalid-initialization",
|
|
7437
7437
|
node: expr
|
|
@@ -7441,7 +7441,7 @@ function create(context) {
|
|
|
7441
7441
|
if (!hasProperty(expr.callee, "name")) continue;
|
|
7442
7442
|
if (core.isHookName(expr.callee.name)) continue;
|
|
7443
7443
|
if (LAZY_INIT_ALLOW_LIST.includes(expr.callee.name)) continue;
|
|
7444
|
-
if (Traverse.
|
|
7444
|
+
if (Traverse.hasParent(expr, core.isUseCall(context))) continue;
|
|
7445
7445
|
context.report({
|
|
7446
7446
|
messageId: "invalid-initialization",
|
|
7447
7447
|
node: expr
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.26.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",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@eslint-react/ast": "5.
|
|
40
|
-
"@eslint-react/core": "5.
|
|
41
|
-
"@eslint-react/eslint": "5.
|
|
42
|
-
"@eslint-react/jsx": "5.
|
|
43
|
-
"@eslint-react/shared": "5.
|
|
44
|
-
"@eslint-react/var": "5.
|
|
39
|
+
"@eslint-react/ast": "5.26.0",
|
|
40
|
+
"@eslint-react/core": "5.26.0",
|
|
41
|
+
"@eslint-react/eslint": "5.26.0",
|
|
42
|
+
"@eslint-react/jsx": "5.26.0",
|
|
43
|
+
"@eslint-react/shared": "5.26.0",
|
|
44
|
+
"@eslint-react/var": "5.26.0",
|
|
45
45
|
"@typescript-eslint/scope-manager": "^8.71.1",
|
|
46
46
|
"@typescript-eslint/types": "^8.71.1",
|
|
47
47
|
"@typescript-eslint/typescript-estree": "^8.71.1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"eslint": "^10.12.0",
|
|
63
63
|
"react": "^19.3.0",
|
|
64
64
|
"react-dom": "^19.3.0",
|
|
65
|
-
"tsdown": "^0.23.
|
|
65
|
+
"tsdown": "^0.23.1",
|
|
66
66
|
"tsl": "^1.0.30",
|
|
67
67
|
"tsl-dx": "^0.14.0",
|
|
68
68
|
"typescript": "6.0.3"
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|
|
80
|
-
"node": ">=
|
|
80
|
+
"node": ">=20.19.0"
|
|
81
81
|
},
|
|
82
82
|
"inlinedDependencies": {
|
|
83
83
|
"@local/eff": "workspace:*"
|