eslint-plugin-react-x 1.28.1-next.6 → 1.29.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 +32 -26
- package/dist/index.mjs +31 -25
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var shared = require('@eslint-react/shared');
|
|
4
|
-
var
|
|
4
|
+
var JSX8 = require('@eslint-react/jsx');
|
|
5
5
|
var AST11 = require('@eslint-react/ast');
|
|
6
6
|
var core = require('@eslint-react/core');
|
|
7
7
|
var eff = require('@eslint-react/eff');
|
|
@@ -35,7 +35,7 @@ function _interopNamespace(e) {
|
|
|
35
35
|
return Object.freeze(n);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var JSX8__namespace = /*#__PURE__*/_interopNamespace(JSX8);
|
|
39
39
|
var AST11__namespace = /*#__PURE__*/_interopNamespace(AST11);
|
|
40
40
|
var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
|
|
41
41
|
var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
@@ -137,7 +137,7 @@ var settings3 = {
|
|
|
137
137
|
|
|
138
138
|
// package.json
|
|
139
139
|
var name4 = "eslint-plugin-react-x";
|
|
140
|
-
var version = "1.
|
|
140
|
+
var version = "1.29.0";
|
|
141
141
|
var createRule = shared.createRuleForPlugin("x");
|
|
142
142
|
|
|
143
143
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -167,7 +167,7 @@ var avoid_shorthand_boolean_default = createRule({
|
|
|
167
167
|
messageId: "avoidShorthandBoolean",
|
|
168
168
|
node,
|
|
169
169
|
data: {
|
|
170
|
-
propName:
|
|
170
|
+
propName: JSX8__namespace.getAttributeName(node)
|
|
171
171
|
},
|
|
172
172
|
fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
|
|
173
173
|
});
|
|
@@ -720,7 +720,7 @@ var no_children_prop_default = createRule({
|
|
|
720
720
|
create(context) {
|
|
721
721
|
return {
|
|
722
722
|
JSXElement(node) {
|
|
723
|
-
const attribute =
|
|
723
|
+
const attribute = JSX8__namespace.getAttribute(
|
|
724
724
|
"children",
|
|
725
725
|
node.openingElement.attributes,
|
|
726
726
|
context.sourceCode.getScope(node)
|
|
@@ -1119,7 +1119,7 @@ var no_context_provider_default = createRule({
|
|
|
1119
1119
|
}
|
|
1120
1120
|
return {
|
|
1121
1121
|
JSXElement(node) {
|
|
1122
|
-
const [name5, ...rest] =
|
|
1122
|
+
const [name5, ...rest] = JSX8__namespace.getElementName(node).split(".").reverse();
|
|
1123
1123
|
if (name5 !== "Provider") return;
|
|
1124
1124
|
const contextName = rest.reverse().join(".");
|
|
1125
1125
|
context.report({
|
|
@@ -1548,7 +1548,7 @@ var no_implicit_key_default = createRule({
|
|
|
1548
1548
|
return {
|
|
1549
1549
|
JSXOpeningElement(node) {
|
|
1550
1550
|
const initialScope = context.sourceCode.getScope(node);
|
|
1551
|
-
const keyPropFound =
|
|
1551
|
+
const keyPropFound = JSX8__namespace.getAttribute("key", node.attributes, initialScope);
|
|
1552
1552
|
const keyPropOnElement = node.attributes.some(
|
|
1553
1553
|
(n) => n.type === types.AST_NODE_TYPES.JSXAttribute && n.name.type === types.AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
|
|
1554
1554
|
);
|
|
@@ -1858,7 +1858,7 @@ var no_missing_key_default = createRule({
|
|
|
1858
1858
|
switch (node.type) {
|
|
1859
1859
|
case types.AST_NODE_TYPES.JSXElement: {
|
|
1860
1860
|
const initialScope = context.sourceCode.getScope(node);
|
|
1861
|
-
if (!
|
|
1861
|
+
if (!JSX8__namespace.hasAttribute("key", node.openingElement.attributes, initialScope)) {
|
|
1862
1862
|
return {
|
|
1863
1863
|
messageId: "missingKey",
|
|
1864
1864
|
node
|
|
@@ -1919,7 +1919,7 @@ var no_missing_key_default = createRule({
|
|
|
1919
1919
|
}
|
|
1920
1920
|
const initialScope = context.sourceCode.getScope(node);
|
|
1921
1921
|
for (const element of elements) {
|
|
1922
|
-
if (!
|
|
1922
|
+
if (!JSX8__namespace.hasAttribute("key", element.openingElement.attributes, initialScope)) {
|
|
1923
1923
|
context.report({
|
|
1924
1924
|
messageId: "missingKey",
|
|
1925
1925
|
node: element
|
|
@@ -2021,7 +2021,7 @@ var no_nested_components_default = createRule({
|
|
|
2021
2021
|
continue;
|
|
2022
2022
|
}
|
|
2023
2023
|
const isInsideProperty = component.parent.type === types.AST_NODE_TYPES.Property;
|
|
2024
|
-
const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute ||
|
|
2024
|
+
const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX8__namespace.findParentAttribute(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
2025
2025
|
if (isInsideJSXPropValue) {
|
|
2026
2026
|
if (!core.isDeclaredInRenderPropLoose(component)) {
|
|
2027
2027
|
context.report({
|
|
@@ -2530,18 +2530,17 @@ var no_unstable_context_value_default = createRule({
|
|
|
2530
2530
|
},
|
|
2531
2531
|
name: RULE_NAME41,
|
|
2532
2532
|
create(context) {
|
|
2533
|
+
const { version: version2 } = shared.getSettingsFromContext(context);
|
|
2534
|
+
const isReact18OrBelow = compareVersions.compare(version2, "19.0.0", "<");
|
|
2533
2535
|
const { ctx, listeners } = core.useComponentCollector(context);
|
|
2534
2536
|
const constructions = /* @__PURE__ */ new Map();
|
|
2535
2537
|
return {
|
|
2536
2538
|
...listeners,
|
|
2537
2539
|
JSXOpeningElement(node) {
|
|
2538
|
-
const
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
if (openingElementName.property.name !== "Provider") {
|
|
2543
|
-
return;
|
|
2544
|
-
}
|
|
2540
|
+
const fullName = JSX8__namespace.getElementName(node.parent);
|
|
2541
|
+
const selfName = fullName.split(".").at(-1);
|
|
2542
|
+
if (selfName == null) return;
|
|
2543
|
+
if (!isContextName(selfName, isReact18OrBelow)) return;
|
|
2545
2544
|
const functionEntry = ctx.getCurrentEntry();
|
|
2546
2545
|
if (functionEntry == null) return;
|
|
2547
2546
|
const attribute = node.attributes.find(
|
|
@@ -2580,6 +2579,13 @@ var no_unstable_context_value_default = createRule({
|
|
|
2580
2579
|
},
|
|
2581
2580
|
defaultOptions: []
|
|
2582
2581
|
});
|
|
2582
|
+
function isContextName(name5, isReact18OrBelow) {
|
|
2583
|
+
if (name5 === "Provider") return true;
|
|
2584
|
+
if (!isReact18OrBelow) {
|
|
2585
|
+
return name5.endsWith("Context") || name5.endsWith("CONTEXT");
|
|
2586
|
+
}
|
|
2587
|
+
return false;
|
|
2588
|
+
}
|
|
2583
2589
|
var RULE_NAME42 = "no-unstable-default-props";
|
|
2584
2590
|
var RULE_FEATURES42 = [
|
|
2585
2591
|
"CHK"
|
|
@@ -3111,12 +3117,12 @@ function checkAndReport(context, node, allowExpressions) {
|
|
|
3111
3117
|
return null;
|
|
3112
3118
|
}
|
|
3113
3119
|
if (node.children.some(
|
|
3114
|
-
(child) =>
|
|
3120
|
+
(child) => JSX8__namespace.isLiteral(child) && !JSX8__namespace.isWhiteSpace(child) || AST11__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer)(child)
|
|
3115
3121
|
)) {
|
|
3116
3122
|
return null;
|
|
3117
3123
|
}
|
|
3118
3124
|
}
|
|
3119
|
-
if (
|
|
3125
|
+
if (JSX8__namespace.isUserDefinedElement(node.parent)) {
|
|
3120
3126
|
return null;
|
|
3121
3127
|
}
|
|
3122
3128
|
const opener = node.type === types.AST_NODE_TYPES.JSXFragment ? node.openingFragment : node.openingElement;
|
|
@@ -3125,10 +3131,10 @@ function checkAndReport(context, node, allowExpressions) {
|
|
|
3125
3131
|
return fixer.replaceText(node, trimLikeReact(childrenText));
|
|
3126
3132
|
}
|
|
3127
3133
|
const initialScope = context.sourceCode.getScope(node);
|
|
3128
|
-
if (
|
|
3134
|
+
if (JSX8__namespace.isKeyedElement(node, initialScope)) {
|
|
3129
3135
|
return;
|
|
3130
3136
|
}
|
|
3131
|
-
if (
|
|
3137
|
+
if (JSX8__namespace.isBuiltInElement(node.parent)) {
|
|
3132
3138
|
context.report({
|
|
3133
3139
|
messageId: "uselessFragment",
|
|
3134
3140
|
node,
|
|
@@ -3152,7 +3158,7 @@ function checkAndReport(context, node, allowExpressions) {
|
|
|
3152
3158
|
const isChildElement = AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXElement, types.AST_NODE_TYPES.JSXFragment])(node.parent);
|
|
3153
3159
|
switch (true) {
|
|
3154
3160
|
// <Foo content={<>ee eeee eeee ...</>} />
|
|
3155
|
-
case (allowExpressions && !isChildElement && node.children.length === 1 &&
|
|
3161
|
+
case (allowExpressions && !isChildElement && node.children.length === 1 && JSX8__namespace.isLiteral(node.children.at(0))): {
|
|
3156
3162
|
return;
|
|
3157
3163
|
}
|
|
3158
3164
|
// <Foo><>hello, world</></Foo>
|
|
@@ -3179,7 +3185,7 @@ function checkAndReport(context, node, allowExpressions) {
|
|
|
3179
3185
|
return;
|
|
3180
3186
|
}
|
|
3181
3187
|
}
|
|
3182
|
-
const nonPaddingChildren = node.children.filter((child) => !
|
|
3188
|
+
const nonPaddingChildren = node.children.filter((child) => !JSX8__namespace.isPaddingSpaces(child));
|
|
3183
3189
|
const firstNonPaddingChild = nonPaddingChildren.at(0);
|
|
3184
3190
|
switch (true) {
|
|
3185
3191
|
case nonPaddingChildren.length === 0:
|
|
@@ -3224,7 +3230,7 @@ var no_useless_fragment_default = createRule({
|
|
|
3224
3230
|
const { allowExpressions = true } = option;
|
|
3225
3231
|
return {
|
|
3226
3232
|
JSXElement(node) {
|
|
3227
|
-
if (!
|
|
3233
|
+
if (!JSX8__namespace.isFragmentElement(node)) return;
|
|
3228
3234
|
checkAndReport(context, node, allowExpressions);
|
|
3229
3235
|
},
|
|
3230
3236
|
JSXFragment(node) {
|
|
@@ -3442,7 +3448,7 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
3442
3448
|
return {
|
|
3443
3449
|
JSXAttribute(node) {
|
|
3444
3450
|
const { value } = node;
|
|
3445
|
-
const propName =
|
|
3451
|
+
const propName = JSX8__namespace.getAttributeName(node);
|
|
3446
3452
|
const hasValueTrue = value?.type === types.AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === types.AST_NODE_TYPES.Literal && value.expression.value === true;
|
|
3447
3453
|
if (!hasValueTrue) {
|
|
3448
3454
|
return;
|
|
@@ -3482,7 +3488,7 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
3482
3488
|
create(context) {
|
|
3483
3489
|
return {
|
|
3484
3490
|
JSXElement(node) {
|
|
3485
|
-
if (!
|
|
3491
|
+
if (!JSX8__namespace.isFragmentElement(node)) return;
|
|
3486
3492
|
const hasAttributes = node.openingElement.attributes.length > 0;
|
|
3487
3493
|
if (hasAttributes) {
|
|
3488
3494
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRuleForPlugin, getSettingsFromContext, unsafeDecodeSettings, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
|
|
2
|
-
import * as
|
|
2
|
+
import * as JSX8 from '@eslint-react/jsx';
|
|
3
3
|
import * as AST11 from '@eslint-react/ast';
|
|
4
4
|
import { isForwardRefCall, isClassComponent, isThisSetState, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isComponentDidCatch, isGetDerivedStateFromError, isCloneElementCall, isCreateRefCall, isComponentName, useComponentCollector, DEFAULT_COMPONENT_HINT, ERComponentFlag, getInstanceId, isInstanceIdEqual, DISPLAY_NAME_ASSIGNMENT_SELECTOR, isCreateContextCall, isChildrenToArrayCall, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideRenderMethod, isCreateElementCall, isReactHookCall, isReactHookCallWithNameAlias, isGetDerivedStateFromProps, isInitializedFromReact } from '@eslint-react/core';
|
|
5
5
|
import { _, getOrUpdate, constTrue, constFalse, identity } from '@eslint-react/eff';
|
|
@@ -110,7 +110,7 @@ var settings3 = {
|
|
|
110
110
|
|
|
111
111
|
// package.json
|
|
112
112
|
var name4 = "eslint-plugin-react-x";
|
|
113
|
-
var version = "1.
|
|
113
|
+
var version = "1.29.0";
|
|
114
114
|
var createRule = createRuleForPlugin("x");
|
|
115
115
|
|
|
116
116
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -140,7 +140,7 @@ var avoid_shorthand_boolean_default = createRule({
|
|
|
140
140
|
messageId: "avoidShorthandBoolean",
|
|
141
141
|
node,
|
|
142
142
|
data: {
|
|
143
|
-
propName:
|
|
143
|
+
propName: JSX8.getAttributeName(node)
|
|
144
144
|
},
|
|
145
145
|
fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
|
|
146
146
|
});
|
|
@@ -693,7 +693,7 @@ var no_children_prop_default = createRule({
|
|
|
693
693
|
create(context) {
|
|
694
694
|
return {
|
|
695
695
|
JSXElement(node) {
|
|
696
|
-
const attribute =
|
|
696
|
+
const attribute = JSX8.getAttribute(
|
|
697
697
|
"children",
|
|
698
698
|
node.openingElement.attributes,
|
|
699
699
|
context.sourceCode.getScope(node)
|
|
@@ -1092,7 +1092,7 @@ var no_context_provider_default = createRule({
|
|
|
1092
1092
|
}
|
|
1093
1093
|
return {
|
|
1094
1094
|
JSXElement(node) {
|
|
1095
|
-
const [name5, ...rest] =
|
|
1095
|
+
const [name5, ...rest] = JSX8.getElementName(node).split(".").reverse();
|
|
1096
1096
|
if (name5 !== "Provider") return;
|
|
1097
1097
|
const contextName = rest.reverse().join(".");
|
|
1098
1098
|
context.report({
|
|
@@ -1521,7 +1521,7 @@ var no_implicit_key_default = createRule({
|
|
|
1521
1521
|
return {
|
|
1522
1522
|
JSXOpeningElement(node) {
|
|
1523
1523
|
const initialScope = context.sourceCode.getScope(node);
|
|
1524
|
-
const keyPropFound =
|
|
1524
|
+
const keyPropFound = JSX8.getAttribute("key", node.attributes, initialScope);
|
|
1525
1525
|
const keyPropOnElement = node.attributes.some(
|
|
1526
1526
|
(n) => n.type === AST_NODE_TYPES.JSXAttribute && n.name.type === AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
|
|
1527
1527
|
);
|
|
@@ -1831,7 +1831,7 @@ var no_missing_key_default = createRule({
|
|
|
1831
1831
|
switch (node.type) {
|
|
1832
1832
|
case AST_NODE_TYPES.JSXElement: {
|
|
1833
1833
|
const initialScope = context.sourceCode.getScope(node);
|
|
1834
|
-
if (!
|
|
1834
|
+
if (!JSX8.hasAttribute("key", node.openingElement.attributes, initialScope)) {
|
|
1835
1835
|
return {
|
|
1836
1836
|
messageId: "missingKey",
|
|
1837
1837
|
node
|
|
@@ -1892,7 +1892,7 @@ var no_missing_key_default = createRule({
|
|
|
1892
1892
|
}
|
|
1893
1893
|
const initialScope = context.sourceCode.getScope(node);
|
|
1894
1894
|
for (const element of elements) {
|
|
1895
|
-
if (!
|
|
1895
|
+
if (!JSX8.hasAttribute("key", element.openingElement.attributes, initialScope)) {
|
|
1896
1896
|
context.report({
|
|
1897
1897
|
messageId: "missingKey",
|
|
1898
1898
|
node: element
|
|
@@ -1994,7 +1994,7 @@ var no_nested_components_default = createRule({
|
|
|
1994
1994
|
continue;
|
|
1995
1995
|
}
|
|
1996
1996
|
const isInsideProperty = component.parent.type === AST_NODE_TYPES.Property;
|
|
1997
|
-
const isInsideJSXPropValue = component.parent.type === AST_NODE_TYPES.JSXAttribute ||
|
|
1997
|
+
const isInsideJSXPropValue = component.parent.type === AST_NODE_TYPES.JSXAttribute || JSX8.findParentAttribute(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
1998
1998
|
if (isInsideJSXPropValue) {
|
|
1999
1999
|
if (!isDeclaredInRenderPropLoose(component)) {
|
|
2000
2000
|
context.report({
|
|
@@ -2503,18 +2503,17 @@ var no_unstable_context_value_default = createRule({
|
|
|
2503
2503
|
},
|
|
2504
2504
|
name: RULE_NAME41,
|
|
2505
2505
|
create(context) {
|
|
2506
|
+
const { version: version2 } = getSettingsFromContext(context);
|
|
2507
|
+
const isReact18OrBelow = compare(version2, "19.0.0", "<");
|
|
2506
2508
|
const { ctx, listeners } = useComponentCollector(context);
|
|
2507
2509
|
const constructions = /* @__PURE__ */ new Map();
|
|
2508
2510
|
return {
|
|
2509
2511
|
...listeners,
|
|
2510
2512
|
JSXOpeningElement(node) {
|
|
2511
|
-
const
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
if (openingElementName.property.name !== "Provider") {
|
|
2516
|
-
return;
|
|
2517
|
-
}
|
|
2513
|
+
const fullName = JSX8.getElementName(node.parent);
|
|
2514
|
+
const selfName = fullName.split(".").at(-1);
|
|
2515
|
+
if (selfName == null) return;
|
|
2516
|
+
if (!isContextName(selfName, isReact18OrBelow)) return;
|
|
2518
2517
|
const functionEntry = ctx.getCurrentEntry();
|
|
2519
2518
|
if (functionEntry == null) return;
|
|
2520
2519
|
const attribute = node.attributes.find(
|
|
@@ -2553,6 +2552,13 @@ var no_unstable_context_value_default = createRule({
|
|
|
2553
2552
|
},
|
|
2554
2553
|
defaultOptions: []
|
|
2555
2554
|
});
|
|
2555
|
+
function isContextName(name5, isReact18OrBelow) {
|
|
2556
|
+
if (name5 === "Provider") return true;
|
|
2557
|
+
if (!isReact18OrBelow) {
|
|
2558
|
+
return name5.endsWith("Context") || name5.endsWith("CONTEXT");
|
|
2559
|
+
}
|
|
2560
|
+
return false;
|
|
2561
|
+
}
|
|
2556
2562
|
var RULE_NAME42 = "no-unstable-default-props";
|
|
2557
2563
|
var RULE_FEATURES42 = [
|
|
2558
2564
|
"CHK"
|
|
@@ -3084,12 +3090,12 @@ function checkAndReport(context, node, allowExpressions) {
|
|
|
3084
3090
|
return null;
|
|
3085
3091
|
}
|
|
3086
3092
|
if (node.children.some(
|
|
3087
|
-
(child) =>
|
|
3093
|
+
(child) => JSX8.isLiteral(child) && !JSX8.isWhiteSpace(child) || AST11.is(AST_NODE_TYPES.JSXExpressionContainer)(child)
|
|
3088
3094
|
)) {
|
|
3089
3095
|
return null;
|
|
3090
3096
|
}
|
|
3091
3097
|
}
|
|
3092
|
-
if (
|
|
3098
|
+
if (JSX8.isUserDefinedElement(node.parent)) {
|
|
3093
3099
|
return null;
|
|
3094
3100
|
}
|
|
3095
3101
|
const opener = node.type === AST_NODE_TYPES.JSXFragment ? node.openingFragment : node.openingElement;
|
|
@@ -3098,10 +3104,10 @@ function checkAndReport(context, node, allowExpressions) {
|
|
|
3098
3104
|
return fixer.replaceText(node, trimLikeReact(childrenText));
|
|
3099
3105
|
}
|
|
3100
3106
|
const initialScope = context.sourceCode.getScope(node);
|
|
3101
|
-
if (
|
|
3107
|
+
if (JSX8.isKeyedElement(node, initialScope)) {
|
|
3102
3108
|
return;
|
|
3103
3109
|
}
|
|
3104
|
-
if (
|
|
3110
|
+
if (JSX8.isBuiltInElement(node.parent)) {
|
|
3105
3111
|
context.report({
|
|
3106
3112
|
messageId: "uselessFragment",
|
|
3107
3113
|
node,
|
|
@@ -3125,7 +3131,7 @@ function checkAndReport(context, node, allowExpressions) {
|
|
|
3125
3131
|
const isChildElement = AST11.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent);
|
|
3126
3132
|
switch (true) {
|
|
3127
3133
|
// <Foo content={<>ee eeee eeee ...</>} />
|
|
3128
|
-
case (allowExpressions && !isChildElement && node.children.length === 1 &&
|
|
3134
|
+
case (allowExpressions && !isChildElement && node.children.length === 1 && JSX8.isLiteral(node.children.at(0))): {
|
|
3129
3135
|
return;
|
|
3130
3136
|
}
|
|
3131
3137
|
// <Foo><>hello, world</></Foo>
|
|
@@ -3152,7 +3158,7 @@ function checkAndReport(context, node, allowExpressions) {
|
|
|
3152
3158
|
return;
|
|
3153
3159
|
}
|
|
3154
3160
|
}
|
|
3155
|
-
const nonPaddingChildren = node.children.filter((child) => !
|
|
3161
|
+
const nonPaddingChildren = node.children.filter((child) => !JSX8.isPaddingSpaces(child));
|
|
3156
3162
|
const firstNonPaddingChild = nonPaddingChildren.at(0);
|
|
3157
3163
|
switch (true) {
|
|
3158
3164
|
case nonPaddingChildren.length === 0:
|
|
@@ -3197,7 +3203,7 @@ var no_useless_fragment_default = createRule({
|
|
|
3197
3203
|
const { allowExpressions = true } = option;
|
|
3198
3204
|
return {
|
|
3199
3205
|
JSXElement(node) {
|
|
3200
|
-
if (!
|
|
3206
|
+
if (!JSX8.isFragmentElement(node)) return;
|
|
3201
3207
|
checkAndReport(context, node, allowExpressions);
|
|
3202
3208
|
},
|
|
3203
3209
|
JSXFragment(node) {
|
|
@@ -3415,7 +3421,7 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
3415
3421
|
return {
|
|
3416
3422
|
JSXAttribute(node) {
|
|
3417
3423
|
const { value } = node;
|
|
3418
|
-
const propName =
|
|
3424
|
+
const propName = JSX8.getAttributeName(node);
|
|
3419
3425
|
const hasValueTrue = value?.type === AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === AST_NODE_TYPES.Literal && value.expression.value === true;
|
|
3420
3426
|
if (!hasValueTrue) {
|
|
3421
3427
|
return;
|
|
@@ -3455,7 +3461,7 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
3455
3461
|
create(context) {
|
|
3456
3462
|
return {
|
|
3457
3463
|
JSXElement(node) {
|
|
3458
|
-
if (!
|
|
3464
|
+
if (!JSX8.isFragmentElement(node)) return;
|
|
3459
3465
|
const hasAttributes = node.openingElement.attributes.length > 0;
|
|
3460
3466
|
if (hasAttributes) {
|
|
3461
3467
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "A set of composable linting rules 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.6.2",
|
|
53
|
-
"@eslint-react/ast": "1.
|
|
54
|
-
"@eslint-react/core": "1.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
53
|
+
"@eslint-react/ast": "1.29.0",
|
|
54
|
+
"@eslint-react/core": "1.29.0",
|
|
55
|
+
"@eslint-react/jsx": "1.29.0",
|
|
56
|
+
"@eslint-react/eff": "1.29.0",
|
|
57
|
+
"@eslint-react/var": "1.29.0",
|
|
58
|
+
"@eslint-react/shared": "1.29.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.0.10",
|