eslint-plugin-react-x 1.23.2-next.0 → 1.23.2-next.1
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 +11 -5
- package/dist/index.mjs +11 -5
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
|
42
42
|
|
|
43
43
|
// package.json
|
|
44
44
|
var name = "eslint-plugin-react-x";
|
|
45
|
-
var version = "1.23.2-next.
|
|
45
|
+
var version = "1.23.2-next.1";
|
|
46
46
|
var createRule = shared.createRuleForPlugin("x");
|
|
47
47
|
|
|
48
48
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -2562,7 +2562,10 @@ function checkAndReport(node, context, allowExpressions) {
|
|
|
2562
2562
|
const initialScope = context.sourceCode.getScope(node);
|
|
2563
2563
|
if (JSX7__namespace.isKeyedElement(node, initialScope)) return;
|
|
2564
2564
|
if (JSX7__namespace.isBuiltInElement(node.parent)) context.report({ messageId: "noUselessFragmentInBuiltIn", node });
|
|
2565
|
-
if (node.children.length === 0)
|
|
2565
|
+
if (node.children.length === 0) {
|
|
2566
|
+
context.report({ messageId: "noUselessFragment", node });
|
|
2567
|
+
return;
|
|
2568
|
+
}
|
|
2566
2569
|
const isChildElement = AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXElement, types.AST_NODE_TYPES.JSXFragment])(node.parent);
|
|
2567
2570
|
switch (true) {
|
|
2568
2571
|
// <Foo content={<>ee eeee eeee ...</>} />
|
|
@@ -2571,10 +2574,12 @@ function checkAndReport(node, context, allowExpressions) {
|
|
|
2571
2574
|
}
|
|
2572
2575
|
// <Foo><>hello, world</></Foo>
|
|
2573
2576
|
case (!allowExpressions && isChildElement): {
|
|
2574
|
-
|
|
2577
|
+
context.report({ messageId: "noUselessFragment", node });
|
|
2578
|
+
return;
|
|
2575
2579
|
}
|
|
2576
2580
|
case (!allowExpressions && !isChildElement && node.children.length === 1): {
|
|
2577
|
-
|
|
2581
|
+
context.report({ messageId: "noUselessFragment", node });
|
|
2582
|
+
return;
|
|
2578
2583
|
}
|
|
2579
2584
|
}
|
|
2580
2585
|
const nonPaddingChildren = node.children.filter((child) => !JSX7__namespace.isPaddingSpaces(child));
|
|
@@ -2582,7 +2587,8 @@ function checkAndReport(node, context, allowExpressions) {
|
|
|
2582
2587
|
switch (true) {
|
|
2583
2588
|
case nonPaddingChildren.length === 0:
|
|
2584
2589
|
case (nonPaddingChildren.length === 1 && firstNonPaddingChild?.type !== types.AST_NODE_TYPES.JSXExpressionContainer): {
|
|
2585
|
-
|
|
2590
|
+
context.report({ messageId: "noUselessFragment", node });
|
|
2591
|
+
return;
|
|
2586
2592
|
}
|
|
2587
2593
|
}
|
|
2588
2594
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReado
|
|
|
15
15
|
|
|
16
16
|
// package.json
|
|
17
17
|
var name = "eslint-plugin-react-x";
|
|
18
|
-
var version = "1.23.2-next.
|
|
18
|
+
var version = "1.23.2-next.1";
|
|
19
19
|
var createRule = createRuleForPlugin("x");
|
|
20
20
|
|
|
21
21
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -2535,7 +2535,10 @@ function checkAndReport(node, context, allowExpressions) {
|
|
|
2535
2535
|
const initialScope = context.sourceCode.getScope(node);
|
|
2536
2536
|
if (JSX7.isKeyedElement(node, initialScope)) return;
|
|
2537
2537
|
if (JSX7.isBuiltInElement(node.parent)) context.report({ messageId: "noUselessFragmentInBuiltIn", node });
|
|
2538
|
-
if (node.children.length === 0)
|
|
2538
|
+
if (node.children.length === 0) {
|
|
2539
|
+
context.report({ messageId: "noUselessFragment", node });
|
|
2540
|
+
return;
|
|
2541
|
+
}
|
|
2539
2542
|
const isChildElement = AST11.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent);
|
|
2540
2543
|
switch (true) {
|
|
2541
2544
|
// <Foo content={<>ee eeee eeee ...</>} />
|
|
@@ -2544,10 +2547,12 @@ function checkAndReport(node, context, allowExpressions) {
|
|
|
2544
2547
|
}
|
|
2545
2548
|
// <Foo><>hello, world</></Foo>
|
|
2546
2549
|
case (!allowExpressions && isChildElement): {
|
|
2547
|
-
|
|
2550
|
+
context.report({ messageId: "noUselessFragment", node });
|
|
2551
|
+
return;
|
|
2548
2552
|
}
|
|
2549
2553
|
case (!allowExpressions && !isChildElement && node.children.length === 1): {
|
|
2550
|
-
|
|
2554
|
+
context.report({ messageId: "noUselessFragment", node });
|
|
2555
|
+
return;
|
|
2551
2556
|
}
|
|
2552
2557
|
}
|
|
2553
2558
|
const nonPaddingChildren = node.children.filter((child) => !JSX7.isPaddingSpaces(child));
|
|
@@ -2555,7 +2560,8 @@ function checkAndReport(node, context, allowExpressions) {
|
|
|
2555
2560
|
switch (true) {
|
|
2556
2561
|
case nonPaddingChildren.length === 0:
|
|
2557
2562
|
case (nonPaddingChildren.length === 1 && firstNonPaddingChild?.type !== AST_NODE_TYPES.JSXExpressionContainer): {
|
|
2558
|
-
|
|
2563
|
+
context.report({ messageId: "noUselessFragment", node });
|
|
2564
|
+
return;
|
|
2559
2565
|
}
|
|
2560
2566
|
}
|
|
2561
2567
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.23.2-next.
|
|
3
|
+
"version": "1.23.2-next.1",
|
|
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",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"string-ts": "^2.2.0",
|
|
50
50
|
"ts-api-utils": "^2.0.0",
|
|
51
51
|
"ts-pattern": "^5.6.0",
|
|
52
|
-
"@eslint-react/ast": "1.23.2-next.
|
|
53
|
-
"@eslint-react/core": "1.23.2-next.
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/types": "1.23.2-next.
|
|
58
|
-
"@eslint-react/var": "1.23.2-next.
|
|
52
|
+
"@eslint-react/ast": "1.23.2-next.1",
|
|
53
|
+
"@eslint-react/core": "1.23.2-next.1",
|
|
54
|
+
"@eslint-react/eff": "1.23.2-next.1",
|
|
55
|
+
"@eslint-react/jsx": "1.23.2-next.1",
|
|
56
|
+
"@eslint-react/shared": "1.23.2-next.1",
|
|
57
|
+
"@eslint-react/types": "1.23.2-next.1",
|
|
58
|
+
"@eslint-react/var": "1.23.2-next.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.0.2",
|