eslint-plugin-react-x 5.30.2 → 5.30.3
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 +14 -20
- package/package.json +9 -9
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.
|
|
133
|
+
var version = "5.30.3";
|
|
134
134
|
// src/utils/create-rule.ts
|
|
135
135
|
function getDocsUrl(ruleName) {
|
|
136
136
|
return `https://eslint-react.xyz/docs/rules/${ruleName}`;
|
|
@@ -1294,12 +1294,7 @@ const KNOWN_MUTATING_HOOKS = /* @__PURE__ */ new Set([
|
|
|
1294
1294
|
"useWorld"
|
|
1295
1295
|
]);
|
|
1296
1296
|
function isNodeWithin(node, ancestor) {
|
|
1297
|
-
|
|
1298
|
-
while (current != null) {
|
|
1299
|
-
if (current === ancestor) return true;
|
|
1300
|
-
current = current.parent;
|
|
1301
|
-
}
|
|
1302
|
-
return false;
|
|
1297
|
+
return node === ancestor || Traverse.hasParent(node, (n) => n === ancestor);
|
|
1303
1298
|
}
|
|
1304
1299
|
function isRefLikeName$2(name) {
|
|
1305
1300
|
return name === "ref" || name.endsWith("Ref");
|
|
@@ -2830,13 +2825,8 @@ var no_missing_key_default = createRule({
|
|
|
2830
2825
|
function create$24(context) {
|
|
2831
2826
|
let childrenToArrayDepth = 0;
|
|
2832
2827
|
function visitItemExpression(node) {
|
|
2828
|
+
if (Check.isTypeOrChainExpression(node)) return visitItemExpression(node.expression);
|
|
2833
2829
|
switch (node.type) {
|
|
2834
|
-
case AST_NODE_TYPES.ChainExpression:
|
|
2835
|
-
case AST_NODE_TYPES.TSAsExpression:
|
|
2836
|
-
case AST_NODE_TYPES.TSTypeAssertion:
|
|
2837
|
-
case AST_NODE_TYPES.TSNonNullExpression:
|
|
2838
|
-
case AST_NODE_TYPES.TSSatisfiesExpression:
|
|
2839
|
-
case AST_NODE_TYPES.TSInstantiationExpression: return visitItemExpression(node.expression);
|
|
2840
2830
|
case AST_NODE_TYPES.JSXElement:
|
|
2841
2831
|
if (hasAttribute(node, "key")) return [];
|
|
2842
2832
|
if (node.openingElement.attributes.some((a) => a.type === AST_NODE_TYPES.JSXSpreadAttribute)) return [];
|
|
@@ -3487,7 +3477,7 @@ function isExportedClass(node) {
|
|
|
3487
3477
|
function isPublicMethod(member) {
|
|
3488
3478
|
switch (member.type) {
|
|
3489
3479
|
case AST_NODE_TYPES.MethodDefinition: return member.accessibility == null || member.accessibility === "public";
|
|
3490
|
-
case AST_NODE_TYPES.PropertyDefinition: return (member.accessibility == null || member.accessibility === "public") &&
|
|
3480
|
+
case AST_NODE_TYPES.PropertyDefinition: return (member.accessibility == null || member.accessibility === "public") && member.value != null && Check.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(member.value);
|
|
3491
3481
|
default: return false;
|
|
3492
3482
|
}
|
|
3493
3483
|
}
|
|
@@ -4330,7 +4320,7 @@ const SYNC_ARRAY_CALLBACKS = /* @__PURE__ */ new Set([
|
|
|
4330
4320
|
"sort"
|
|
4331
4321
|
]);
|
|
4332
4322
|
function isFunctionExpressionLike(node) {
|
|
4333
|
-
return
|
|
4323
|
+
return Check.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(node);
|
|
4334
4324
|
}
|
|
4335
4325
|
function isRefLikeName$1(name) {
|
|
4336
4326
|
return name === "ref" || name.endsWith("Ref");
|
|
@@ -4648,9 +4638,10 @@ function inferRefViolations(accesses, boundaries, reachability, resolver) {
|
|
|
4648
4638
|
return violations;
|
|
4649
4639
|
}
|
|
4650
4640
|
function getPassSiteCalleeName(node) {
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
if (
|
|
4641
|
+
if (node.type !== AST_NODE_TYPES.TaggedTemplateExpression) return Extract.getCalleeName(node);
|
|
4642
|
+
const tag = Extract.unwrap(node.tag);
|
|
4643
|
+
if (Check.isIdentifier(tag)) return tag.name;
|
|
4644
|
+
if (tag.type === AST_NODE_TYPES.MemberExpression && !tag.computed && Check.isIdentifier(tag.property)) return tag.property.name;
|
|
4654
4645
|
return null;
|
|
4655
4646
|
}
|
|
4656
4647
|
function isMergeRefsCallee(callee, calleeName, position, resolver) {
|
|
@@ -6608,8 +6599,11 @@ function createSetStateResolver$1(context, facts = EMPTY_FACTS) {
|
|
|
6608
6599
|
}));
|
|
6609
6600
|
function isSetStateId(id) {
|
|
6610
6601
|
const initNode = resolveOrigin(context, id);
|
|
6611
|
-
if (initNode
|
|
6612
|
-
const
|
|
6602
|
+
if (initNode == null) return false;
|
|
6603
|
+
const init = Extract.unwrap(initNode);
|
|
6604
|
+
if (init.type !== AST_NODE_TYPES.CallExpression || !isUseStateCall(init)) return false;
|
|
6605
|
+
let initNodeParent = init.parent;
|
|
6606
|
+
while (Check.isTypeOrChainExpression(initNodeParent)) initNodeParent = initNodeParent.parent;
|
|
6613
6607
|
if (!hasProperty(initNodeParent, "id")) return false;
|
|
6614
6608
|
if (initNodeParent.id?.type !== AST_NODE_TYPES.ArrayPattern) return false;
|
|
6615
6609
|
return initNodeParent.id.elements.findIndex((e) => e != null && Check.isIdentifier(e, id.name)) === 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.30.
|
|
3
|
+
"version": "5.30.3",
|
|
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.
|
|
40
|
-
"@eslint-react/core": "5.30.
|
|
41
|
-
"@eslint-react/eslint": "5.30.
|
|
42
|
-
"@eslint-react/jsx": "5.30.
|
|
43
|
-
"@eslint-react/shared": "5.30.
|
|
44
|
-
"@eslint-react/var": "5.30.
|
|
39
|
+
"@eslint-react/ast": "5.30.3",
|
|
40
|
+
"@eslint-react/core": "5.30.3",
|
|
41
|
+
"@eslint-react/eslint": "5.30.3",
|
|
42
|
+
"@eslint-react/jsx": "5.30.3",
|
|
43
|
+
"@eslint-react/shared": "5.30.3",
|
|
44
|
+
"@eslint-react/var": "5.30.3",
|
|
45
45
|
"@typescript-eslint/scope-manager": "^8.72.2",
|
|
46
46
|
"@typescript-eslint/types": "^8.72.2",
|
|
47
47
|
"@typescript-eslint/utils": "^8.72.2",
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"@local/eff": "0.0.0",
|
|
56
56
|
"@local/testkit": "0.0.0",
|
|
57
57
|
"@rbxts/react": "17.3.7-ts.2",
|
|
58
|
-
"@tsconfig/node20": "^20.1.
|
|
58
|
+
"@tsconfig/node20": "^20.1.11",
|
|
59
59
|
"@types/node": "^20.19.43",
|
|
60
60
|
"@types/react": "^19.3.0",
|
|
61
61
|
"@types/react-dom": "^19.3.0",
|
|
62
62
|
"dedent": "^1.7.2",
|
|
63
|
-
"eslint": "^10.
|
|
63
|
+
"eslint": "^10.15.0",
|
|
64
64
|
"react": "^19.3.1",
|
|
65
65
|
"react-dom": "^19.3.1",
|
|
66
66
|
"tsdown": "^0.23.7",
|