eslint-plugin-react-x 5.14.6 → 5.14.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.js +12 -6
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -144,7 +144,7 @@ const rules$6 = {
|
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region package.json
|
|
146
146
|
var name$6 = "eslint-plugin-react-x";
|
|
147
|
-
var version = "5.14.
|
|
147
|
+
var version = "5.14.7";
|
|
148
148
|
|
|
149
149
|
//#endregion
|
|
150
150
|
//#region src/utils/create-rule.ts
|
|
@@ -1344,7 +1344,14 @@ const MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
|
1344
1344
|
"splice",
|
|
1345
1345
|
"unshift"
|
|
1346
1346
|
]);
|
|
1347
|
-
|
|
1347
|
+
/**
|
|
1348
|
+
* Known navigation hooks.
|
|
1349
|
+
*/
|
|
1350
|
+
const NAVIGATION_HOOKS = /* @__PURE__ */ new Set([
|
|
1351
|
+
"useNavigate",
|
|
1352
|
+
"useNavigation",
|
|
1353
|
+
"useRouter"
|
|
1354
|
+
]);
|
|
1348
1355
|
function resolveToFunctionNode(context, node, seen = /* @__PURE__ */ new Set()) {
|
|
1349
1356
|
const expr = Extract.unwrap(node);
|
|
1350
1357
|
if (Check.isFunction(expr)) return expr;
|
|
@@ -1386,12 +1393,11 @@ function isInitializedFromCall(context, node, isCall) {
|
|
|
1386
1393
|
function isInitializedFromUseRef(context, node) {
|
|
1387
1394
|
return isInitializedFromCall(context, node, (init) => core.isUseRefCall(context, init));
|
|
1388
1395
|
}
|
|
1389
|
-
function isInitializedFromUseRouter(context, node) {
|
|
1390
|
-
return isInitializedFromCall(context, node, (init) => isUseRouterCall(context, init));
|
|
1391
|
-
}
|
|
1392
1396
|
function isKnownNonMutatingMethodCall(context, node) {
|
|
1393
1397
|
const callee = Extract.unwrap(node.callee);
|
|
1394
|
-
return Check.isExpression(callee) &&
|
|
1398
|
+
return Check.isExpression(callee) && isInitializedFromCall(context, callee, (init) => {
|
|
1399
|
+
return NAVIGATION_HOOKS.values().some((hook) => core.isAPICall(hook)(context, init));
|
|
1400
|
+
});
|
|
1395
1401
|
}
|
|
1396
1402
|
function isRefLikeChain(context, node) {
|
|
1397
1403
|
return hasRefLikeNameInChain(node) || isInitializedFromUseRef(context, node);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.14.
|
|
3
|
+
"version": "5.14.7",
|
|
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/ast": "5.14.
|
|
49
|
-
"@eslint-react/core": "5.14.
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
48
|
+
"@eslint-react/ast": "5.14.7",
|
|
49
|
+
"@eslint-react/core": "5.14.7",
|
|
50
|
+
"@eslint-react/eslint": "5.14.7",
|
|
51
|
+
"@eslint-react/jsx": "5.14.7",
|
|
52
|
+
"@eslint-react/var": "5.14.7",
|
|
53
|
+
"@eslint-react/shared": "5.14.7"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/react": "^19.2.17",
|