eslint-plugin-react-x 1.48.1 → 1.48.2-beta.2
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 -13
- package/dist/index.mjs +12 -13
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -141,7 +141,7 @@ var settings3 = {
|
|
|
141
141
|
|
|
142
142
|
// package.json
|
|
143
143
|
var name4 = "eslint-plugin-react-x";
|
|
144
|
-
var version = "1.48.
|
|
144
|
+
var version = "1.48.2-beta.2";
|
|
145
145
|
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
|
|
146
146
|
|
|
147
147
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1390,7 +1390,7 @@ function create26(context) {
|
|
|
1390
1390
|
if (!AST8__namespace.isFunction(iter)) return;
|
|
1391
1391
|
const arg0 = call?.arguments[0];
|
|
1392
1392
|
if (call == null || arg0 == null) return;
|
|
1393
|
-
if (AST8__namespace.
|
|
1393
|
+
if (AST8__namespace.getJSExpression(arg0) !== iter) {
|
|
1394
1394
|
return;
|
|
1395
1395
|
}
|
|
1396
1396
|
keyedEntries.set(call, {
|
|
@@ -1453,7 +1453,7 @@ function create27(context) {
|
|
|
1453
1453
|
if (!ER25__namespace.isForwardRefCall(context, node)) {
|
|
1454
1454
|
return;
|
|
1455
1455
|
}
|
|
1456
|
-
const id = AST8__namespace.
|
|
1456
|
+
const id = AST8__namespace.getFunctionId(node);
|
|
1457
1457
|
context.report({
|
|
1458
1458
|
messageId: "noForwardRef",
|
|
1459
1459
|
node: id ?? node,
|
|
@@ -1756,14 +1756,14 @@ function create30(context) {
|
|
|
1756
1756
|
const components = ctx.getAllComponents(program);
|
|
1757
1757
|
for (const { node, displayName, flag } of components.values()) {
|
|
1758
1758
|
const isMemoOrForwardRef = (flag & (ER25__namespace.ComponentFlag.ForwardRef | ER25__namespace.ComponentFlag.Memo)) > 0n;
|
|
1759
|
-
if (AST8__namespace.
|
|
1759
|
+
if (AST8__namespace.getFunctionId(node) != null) {
|
|
1760
1760
|
continue;
|
|
1761
1761
|
}
|
|
1762
1762
|
if (!isMemoOrForwardRef) {
|
|
1763
1763
|
continue;
|
|
1764
1764
|
}
|
|
1765
1765
|
if (displayName == null) {
|
|
1766
|
-
const id = AST8__namespace.
|
|
1766
|
+
const id = AST8__namespace.getFunctionId(node);
|
|
1767
1767
|
context.report({
|
|
1768
1768
|
messageId: "noMissingComponentDisplayName",
|
|
1769
1769
|
node: id ?? node
|
|
@@ -1912,7 +1912,6 @@ function create32(context) {
|
|
|
1912
1912
|
}
|
|
1913
1913
|
const initialScope = context.sourceCode.getScope(node);
|
|
1914
1914
|
for (const element of elements) {
|
|
1915
|
-
if (element?.type !== types.AST_NODE_TYPES.JSXElement) continue;
|
|
1916
1915
|
if (!ER25__namespace.hasAttribute(context, "key", element.openingElement.attributes, initialScope)) {
|
|
1917
1916
|
report.send({
|
|
1918
1917
|
messageId: "missingKey",
|
|
@@ -2637,7 +2636,7 @@ function create45(context) {
|
|
|
2637
2636
|
if (value?.type !== types.AST_NODE_TYPES.JSXExpressionContainer) return;
|
|
2638
2637
|
const valueExpression = value.expression;
|
|
2639
2638
|
const initialScope = context.sourceCode.getScope(valueExpression);
|
|
2640
|
-
const construction = VAR2__namespace.
|
|
2639
|
+
const construction = VAR2__namespace.getConstruction(valueExpression, initialScope);
|
|
2641
2640
|
if (construction == null) return;
|
|
2642
2641
|
if (ER25__namespace.isReactHookCall(construction.node)) {
|
|
2643
2642
|
return;
|
|
@@ -2654,7 +2653,7 @@ function create45(context) {
|
|
|
2654
2653
|
messageId: "unstableContextValue",
|
|
2655
2654
|
node: constructionNode,
|
|
2656
2655
|
data: {
|
|
2657
|
-
type: AST8__namespace.
|
|
2656
|
+
type: AST8__namespace.toDelimiterCaseType(constructionNode),
|
|
2658
2657
|
suggestion
|
|
2659
2658
|
}
|
|
2660
2659
|
});
|
|
@@ -2711,7 +2710,7 @@ function create46(context) {
|
|
|
2711
2710
|
const { value } = prop;
|
|
2712
2711
|
const { right } = value;
|
|
2713
2712
|
const initialScope = context.sourceCode.getScope(value);
|
|
2714
|
-
const construction = VAR2__namespace.
|
|
2713
|
+
const construction = VAR2__namespace.getConstruction(
|
|
2715
2714
|
value,
|
|
2716
2715
|
initialScope,
|
|
2717
2716
|
VAR2__namespace.ConstructionDetectionHint.StrictCallExpression
|
|
@@ -2722,7 +2721,7 @@ function create46(context) {
|
|
|
2722
2721
|
if (ER25__namespace.isReactHookCall(construction.node)) {
|
|
2723
2722
|
continue;
|
|
2724
2723
|
}
|
|
2725
|
-
const forbiddenType = AST8__namespace.
|
|
2724
|
+
const forbiddenType = AST8__namespace.toDelimiterCaseType(right);
|
|
2726
2725
|
context.report({
|
|
2727
2726
|
messageId: "noUnstableDefaultProps",
|
|
2728
2727
|
node: right,
|
|
@@ -2800,7 +2799,7 @@ function create47(context) {
|
|
|
2800
2799
|
if (currentClass == null || !ER25__namespace.isClassComponent(currentClass)) {
|
|
2801
2800
|
return;
|
|
2802
2801
|
}
|
|
2803
|
-
const className = AST8__namespace.
|
|
2802
|
+
const className = AST8__namespace.getClassId(currentClass)?.name;
|
|
2804
2803
|
const defs = propertyDefs.get(currentClass);
|
|
2805
2804
|
const usages = propertyUsages.get(currentClass);
|
|
2806
2805
|
if (defs == null) {
|
|
@@ -2926,7 +2925,7 @@ function create48(context) {
|
|
|
2926
2925
|
if (currentClass == null || !ER25__namespace.isClassComponent(currentClass)) {
|
|
2927
2926
|
return;
|
|
2928
2927
|
}
|
|
2929
|
-
const className = AST8__namespace.
|
|
2928
|
+
const className = AST8__namespace.getClassId(currentClass)?.name;
|
|
2930
2929
|
const { node: defNode, isUsed = false } = stateDefs.get(currentClass) ?? {};
|
|
2931
2930
|
if (defNode == null || isUsed) {
|
|
2932
2931
|
return;
|
|
@@ -3380,7 +3379,7 @@ function create52(context) {
|
|
|
3380
3379
|
if (!AST8__namespace.isFunction(block)) {
|
|
3381
3380
|
return false;
|
|
3382
3381
|
}
|
|
3383
|
-
const id = AST8__namespace.
|
|
3382
|
+
const id = AST8__namespace.getFunctionId(block);
|
|
3384
3383
|
return id != null && ER25__namespace.isComponentNameLoose(id.name) && components.some((component) => component.node === block);
|
|
3385
3384
|
}
|
|
3386
3385
|
for (const [initialScope, memberExpression] of memberExpressionWithNames) {
|
package/dist/index.mjs
CHANGED
|
@@ -114,7 +114,7 @@ var settings3 = {
|
|
|
114
114
|
|
|
115
115
|
// package.json
|
|
116
116
|
var name4 = "eslint-plugin-react-x";
|
|
117
|
-
var version = "1.48.
|
|
117
|
+
var version = "1.48.2-beta.2";
|
|
118
118
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
|
|
119
119
|
|
|
120
120
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1363,7 +1363,7 @@ function create26(context) {
|
|
|
1363
1363
|
if (!AST8.isFunction(iter)) return;
|
|
1364
1364
|
const arg0 = call?.arguments[0];
|
|
1365
1365
|
if (call == null || arg0 == null) return;
|
|
1366
|
-
if (AST8.
|
|
1366
|
+
if (AST8.getJSExpression(arg0) !== iter) {
|
|
1367
1367
|
return;
|
|
1368
1368
|
}
|
|
1369
1369
|
keyedEntries.set(call, {
|
|
@@ -1426,7 +1426,7 @@ function create27(context) {
|
|
|
1426
1426
|
if (!ER25.isForwardRefCall(context, node)) {
|
|
1427
1427
|
return;
|
|
1428
1428
|
}
|
|
1429
|
-
const id = AST8.
|
|
1429
|
+
const id = AST8.getFunctionId(node);
|
|
1430
1430
|
context.report({
|
|
1431
1431
|
messageId: "noForwardRef",
|
|
1432
1432
|
node: id ?? node,
|
|
@@ -1729,14 +1729,14 @@ function create30(context) {
|
|
|
1729
1729
|
const components = ctx.getAllComponents(program);
|
|
1730
1730
|
for (const { node, displayName, flag } of components.values()) {
|
|
1731
1731
|
const isMemoOrForwardRef = (flag & (ER25.ComponentFlag.ForwardRef | ER25.ComponentFlag.Memo)) > 0n;
|
|
1732
|
-
if (AST8.
|
|
1732
|
+
if (AST8.getFunctionId(node) != null) {
|
|
1733
1733
|
continue;
|
|
1734
1734
|
}
|
|
1735
1735
|
if (!isMemoOrForwardRef) {
|
|
1736
1736
|
continue;
|
|
1737
1737
|
}
|
|
1738
1738
|
if (displayName == null) {
|
|
1739
|
-
const id = AST8.
|
|
1739
|
+
const id = AST8.getFunctionId(node);
|
|
1740
1740
|
context.report({
|
|
1741
1741
|
messageId: "noMissingComponentDisplayName",
|
|
1742
1742
|
node: id ?? node
|
|
@@ -1885,7 +1885,6 @@ function create32(context) {
|
|
|
1885
1885
|
}
|
|
1886
1886
|
const initialScope = context.sourceCode.getScope(node);
|
|
1887
1887
|
for (const element of elements) {
|
|
1888
|
-
if (element?.type !== AST_NODE_TYPES.JSXElement) continue;
|
|
1889
1888
|
if (!ER25.hasAttribute(context, "key", element.openingElement.attributes, initialScope)) {
|
|
1890
1889
|
report.send({
|
|
1891
1890
|
messageId: "missingKey",
|
|
@@ -2610,7 +2609,7 @@ function create45(context) {
|
|
|
2610
2609
|
if (value?.type !== AST_NODE_TYPES.JSXExpressionContainer) return;
|
|
2611
2610
|
const valueExpression = value.expression;
|
|
2612
2611
|
const initialScope = context.sourceCode.getScope(valueExpression);
|
|
2613
|
-
const construction = VAR2.
|
|
2612
|
+
const construction = VAR2.getConstruction(valueExpression, initialScope);
|
|
2614
2613
|
if (construction == null) return;
|
|
2615
2614
|
if (ER25.isReactHookCall(construction.node)) {
|
|
2616
2615
|
return;
|
|
@@ -2627,7 +2626,7 @@ function create45(context) {
|
|
|
2627
2626
|
messageId: "unstableContextValue",
|
|
2628
2627
|
node: constructionNode,
|
|
2629
2628
|
data: {
|
|
2630
|
-
type: AST8.
|
|
2629
|
+
type: AST8.toDelimiterCaseType(constructionNode),
|
|
2631
2630
|
suggestion
|
|
2632
2631
|
}
|
|
2633
2632
|
});
|
|
@@ -2684,7 +2683,7 @@ function create46(context) {
|
|
|
2684
2683
|
const { value } = prop;
|
|
2685
2684
|
const { right } = value;
|
|
2686
2685
|
const initialScope = context.sourceCode.getScope(value);
|
|
2687
|
-
const construction = VAR2.
|
|
2686
|
+
const construction = VAR2.getConstruction(
|
|
2688
2687
|
value,
|
|
2689
2688
|
initialScope,
|
|
2690
2689
|
VAR2.ConstructionDetectionHint.StrictCallExpression
|
|
@@ -2695,7 +2694,7 @@ function create46(context) {
|
|
|
2695
2694
|
if (ER25.isReactHookCall(construction.node)) {
|
|
2696
2695
|
continue;
|
|
2697
2696
|
}
|
|
2698
|
-
const forbiddenType = AST8.
|
|
2697
|
+
const forbiddenType = AST8.toDelimiterCaseType(right);
|
|
2699
2698
|
context.report({
|
|
2700
2699
|
messageId: "noUnstableDefaultProps",
|
|
2701
2700
|
node: right,
|
|
@@ -2773,7 +2772,7 @@ function create47(context) {
|
|
|
2773
2772
|
if (currentClass == null || !ER25.isClassComponent(currentClass)) {
|
|
2774
2773
|
return;
|
|
2775
2774
|
}
|
|
2776
|
-
const className = AST8.
|
|
2775
|
+
const className = AST8.getClassId(currentClass)?.name;
|
|
2777
2776
|
const defs = propertyDefs.get(currentClass);
|
|
2778
2777
|
const usages = propertyUsages.get(currentClass);
|
|
2779
2778
|
if (defs == null) {
|
|
@@ -2899,7 +2898,7 @@ function create48(context) {
|
|
|
2899
2898
|
if (currentClass == null || !ER25.isClassComponent(currentClass)) {
|
|
2900
2899
|
return;
|
|
2901
2900
|
}
|
|
2902
|
-
const className = AST8.
|
|
2901
|
+
const className = AST8.getClassId(currentClass)?.name;
|
|
2903
2902
|
const { node: defNode, isUsed = false } = stateDefs.get(currentClass) ?? {};
|
|
2904
2903
|
if (defNode == null || isUsed) {
|
|
2905
2904
|
return;
|
|
@@ -3353,7 +3352,7 @@ function create52(context) {
|
|
|
3353
3352
|
if (!AST8.isFunction(block)) {
|
|
3354
3353
|
return false;
|
|
3355
3354
|
}
|
|
3356
|
-
const id = AST8.
|
|
3355
|
+
const id = AST8.getFunctionId(block);
|
|
3357
3356
|
return id != null && ER25.isComponentNameLoose(id.name) && components.some((component) => component.node === block);
|
|
3358
3357
|
}
|
|
3359
3358
|
for (const [initialScope, memberExpression] of memberExpressionWithNames) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.48.
|
|
3
|
+
"version": "1.48.2-beta.2",
|
|
4
4
|
"description": "A set of composable ESLint rules for for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"is-immutable-type": "^5.0.1",
|
|
51
51
|
"string-ts": "^2.2.1",
|
|
52
52
|
"ts-pattern": "^5.7.0",
|
|
53
|
-
"@eslint-react/ast": "1.48.
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
53
|
+
"@eslint-react/ast": "1.48.2-beta.2",
|
|
54
|
+
"@eslint-react/shared": "1.48.2-beta.2",
|
|
55
|
+
"@eslint-react/core": "1.48.2-beta.2",
|
|
56
|
+
"@eslint-react/kit": "1.48.2-beta.2",
|
|
57
|
+
"@eslint-react/var": "1.48.2-beta.2",
|
|
58
|
+
"@eslint-react/eff": "1.48.2-beta.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.1.2",
|