eslint-plugin-react-x 1.23.3-next.6 → 1.23.3-next.8
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 -8
- package/dist/index.mjs +14 -8
- 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.3-next.
|
|
45
|
+
var version = "1.23.3-next.8";
|
|
46
46
|
var createRule = shared.createRuleForPlugin("x");
|
|
47
47
|
|
|
48
48
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1600,12 +1600,12 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1600
1600
|
const services = utils.ESLintUtils.getParserServices(context, false);
|
|
1601
1601
|
function getReportDescriptor(node) {
|
|
1602
1602
|
return tsPattern.match(node).when(AST11__namespace.isJSX, eff.O.none).with({ type: types.AST_NODE_TYPES.LogicalExpression, operator: "&&" }, ({ left, right }) => {
|
|
1603
|
-
const isLeftUnaryNot =
|
|
1603
|
+
const isLeftUnaryNot = left.type === types.AST_NODE_TYPES.UnaryExpression && left.operator === "!";
|
|
1604
1604
|
if (isLeftUnaryNot) {
|
|
1605
1605
|
return getReportDescriptor(right);
|
|
1606
1606
|
}
|
|
1607
1607
|
const initialScope = context.sourceCode.getScope(left);
|
|
1608
|
-
const isLeftNan =
|
|
1608
|
+
const isLeftNan = left.type === types.AST_NODE_TYPES.Identifier && left.name === "NaN" || eff.O.exists(VAR__namespace.getStaticValue(left, initialScope), (v) => v === "NaN");
|
|
1609
1609
|
if (isLeftNan) {
|
|
1610
1610
|
return eff.O.some({
|
|
1611
1611
|
messageId: "noLeakedConditionalRendering",
|
|
@@ -1634,7 +1634,7 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1634
1634
|
);
|
|
1635
1635
|
}).otherwise(eff.O.none);
|
|
1636
1636
|
}
|
|
1637
|
-
const visitorFunction = eff.F.flow(getReportDescriptor, eff.O.map(context.report)
|
|
1637
|
+
const visitorFunction = eff.F.flow(getReportDescriptor, eff.O.map(context.report));
|
|
1638
1638
|
return {
|
|
1639
1639
|
"JSXExpressionContainer > ConditionalExpression": visitorFunction,
|
|
1640
1640
|
"JSXExpressionContainer > LogicalExpression": visitorFunction
|
|
@@ -1854,8 +1854,12 @@ var no_nested_components_default = createRule({
|
|
|
1854
1854
|
...collector.listeners,
|
|
1855
1855
|
...collectorLegacy.listeners,
|
|
1856
1856
|
"Program:exit"(node) {
|
|
1857
|
-
const functionComponents =
|
|
1858
|
-
|
|
1857
|
+
const functionComponents = [
|
|
1858
|
+
...collector.ctx.getAllComponents(node).values()
|
|
1859
|
+
];
|
|
1860
|
+
const classComponents = [
|
|
1861
|
+
...collectorLegacy.ctx.getAllComponents(node).values()
|
|
1862
|
+
];
|
|
1859
1863
|
const isFunctionComponent = (node2) => {
|
|
1860
1864
|
return AST11__namespace.isFunction(node2) && functionComponents.some((component) => component.node === node2);
|
|
1861
1865
|
};
|
|
@@ -3001,7 +3005,9 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
3001
3005
|
}
|
|
3002
3006
|
},
|
|
3003
3007
|
"Program:exit"(node) {
|
|
3004
|
-
const components =
|
|
3008
|
+
const components = [
|
|
3009
|
+
...ctx.getAllComponents(node).values()
|
|
3010
|
+
];
|
|
3005
3011
|
function isFunctionComponent(block) {
|
|
3006
3012
|
if (!AST11__namespace.isFunction(block)) {
|
|
3007
3013
|
return false;
|
|
@@ -3026,7 +3032,7 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
3026
3032
|
continue;
|
|
3027
3033
|
}
|
|
3028
3034
|
const [props, ctx2] = component.params;
|
|
3029
|
-
const isMatch =
|
|
3035
|
+
const isMatch = (node2) => node2 != null && node2.type === types.AST_NODE_TYPES.Identifier && node2.name === memberExpression.object.name;
|
|
3030
3036
|
if (isMatch(props)) {
|
|
3031
3037
|
context.report({
|
|
3032
3038
|
messageId: "preferDestructuringAssignment",
|
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.3-next.
|
|
18
|
+
var version = "1.23.3-next.8";
|
|
19
19
|
var createRule = createRuleForPlugin("x");
|
|
20
20
|
|
|
21
21
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1573,12 +1573,12 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1573
1573
|
const services = ESLintUtils.getParserServices(context, false);
|
|
1574
1574
|
function getReportDescriptor(node) {
|
|
1575
1575
|
return match(node).when(AST11.isJSX, O.none).with({ type: AST_NODE_TYPES.LogicalExpression, operator: "&&" }, ({ left, right }) => {
|
|
1576
|
-
const isLeftUnaryNot =
|
|
1576
|
+
const isLeftUnaryNot = left.type === AST_NODE_TYPES.UnaryExpression && left.operator === "!";
|
|
1577
1577
|
if (isLeftUnaryNot) {
|
|
1578
1578
|
return getReportDescriptor(right);
|
|
1579
1579
|
}
|
|
1580
1580
|
const initialScope = context.sourceCode.getScope(left);
|
|
1581
|
-
const isLeftNan =
|
|
1581
|
+
const isLeftNan = left.type === AST_NODE_TYPES.Identifier && left.name === "NaN" || O.exists(VAR.getStaticValue(left, initialScope), (v) => v === "NaN");
|
|
1582
1582
|
if (isLeftNan) {
|
|
1583
1583
|
return O.some({
|
|
1584
1584
|
messageId: "noLeakedConditionalRendering",
|
|
@@ -1607,7 +1607,7 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1607
1607
|
);
|
|
1608
1608
|
}).otherwise(O.none);
|
|
1609
1609
|
}
|
|
1610
|
-
const visitorFunction = F.flow(getReportDescriptor, O.map(context.report)
|
|
1610
|
+
const visitorFunction = F.flow(getReportDescriptor, O.map(context.report));
|
|
1611
1611
|
return {
|
|
1612
1612
|
"JSXExpressionContainer > ConditionalExpression": visitorFunction,
|
|
1613
1613
|
"JSXExpressionContainer > LogicalExpression": visitorFunction
|
|
@@ -1827,8 +1827,12 @@ var no_nested_components_default = createRule({
|
|
|
1827
1827
|
...collector.listeners,
|
|
1828
1828
|
...collectorLegacy.listeners,
|
|
1829
1829
|
"Program:exit"(node) {
|
|
1830
|
-
const functionComponents =
|
|
1831
|
-
|
|
1830
|
+
const functionComponents = [
|
|
1831
|
+
...collector.ctx.getAllComponents(node).values()
|
|
1832
|
+
];
|
|
1833
|
+
const classComponents = [
|
|
1834
|
+
...collectorLegacy.ctx.getAllComponents(node).values()
|
|
1835
|
+
];
|
|
1832
1836
|
const isFunctionComponent = (node2) => {
|
|
1833
1837
|
return AST11.isFunction(node2) && functionComponents.some((component) => component.node === node2);
|
|
1834
1838
|
};
|
|
@@ -2974,7 +2978,9 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2974
2978
|
}
|
|
2975
2979
|
},
|
|
2976
2980
|
"Program:exit"(node) {
|
|
2977
|
-
const components =
|
|
2981
|
+
const components = [
|
|
2982
|
+
...ctx.getAllComponents(node).values()
|
|
2983
|
+
];
|
|
2978
2984
|
function isFunctionComponent(block) {
|
|
2979
2985
|
if (!AST11.isFunction(block)) {
|
|
2980
2986
|
return false;
|
|
@@ -2999,7 +3005,7 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2999
3005
|
continue;
|
|
3000
3006
|
}
|
|
3001
3007
|
const [props, ctx2] = component.params;
|
|
3002
|
-
const isMatch =
|
|
3008
|
+
const isMatch = (node2) => node2 != null && node2.type === AST_NODE_TYPES.Identifier && node2.name === memberExpression.object.name;
|
|
3003
3009
|
if (isMatch(props)) {
|
|
3004
3010
|
context.report({
|
|
3005
3011
|
messageId: "preferDestructuringAssignment",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.23.3-next.
|
|
3
|
+
"version": "1.23.3-next.8",
|
|
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",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"is-immutable-type": "^5.0.1",
|
|
49
49
|
"string-ts": "^2.2.0",
|
|
50
50
|
"ts-pattern": "^5.6.0",
|
|
51
|
-
"@eslint-react/ast": "1.23.3-next.
|
|
52
|
-
"@eslint-react/core": "1.23.3-next.
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
51
|
+
"@eslint-react/ast": "1.23.3-next.8",
|
|
52
|
+
"@eslint-react/core": "1.23.3-next.8",
|
|
53
|
+
"@eslint-react/eff": "1.23.3-next.8",
|
|
54
|
+
"@eslint-react/shared": "1.23.3-next.8",
|
|
55
|
+
"@eslint-react/jsx": "1.23.3-next.8",
|
|
56
|
+
"@eslint-react/types": "1.23.3-next.8",
|
|
57
|
+
"@eslint-react/var": "1.23.3-next.8"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/react": "^19.0.4",
|