eslint-plugin-react-x 1.36.0-beta.0 → 1.36.0-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 +9 -13
- package/dist/index.mjs +9 -13
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -136,7 +136,7 @@ var settings3 = {
|
|
|
136
136
|
|
|
137
137
|
// package.json
|
|
138
138
|
var name4 = "eslint-plugin-react-x";
|
|
139
|
-
var version = "1.36.0-beta.
|
|
139
|
+
var version = "1.36.0-beta.2";
|
|
140
140
|
var createRule = shared.createRuleForPlugin("x");
|
|
141
141
|
|
|
142
142
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1953,15 +1953,9 @@ function create28(context) {
|
|
|
1953
1953
|
return AST11__namespace.isClass(node2) && classComponents.some((component) => component.node === node2);
|
|
1954
1954
|
};
|
|
1955
1955
|
for (const { name: name5, node: component } of functionComponents) {
|
|
1956
|
-
if (
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
if (name5 == null) {
|
|
1960
|
-
continue;
|
|
1961
|
-
}
|
|
1962
|
-
const isInsideProperty = component.parent.type === types.AST_NODE_TYPES.Property;
|
|
1963
|
-
const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX8__namespace.findParentAttribute(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
1964
|
-
if (isInsideJSXPropValue) {
|
|
1956
|
+
if (name5 == null) continue;
|
|
1957
|
+
if (core.isDirectValueOfRenderPropertyLoose(component)) continue;
|
|
1958
|
+
if (isInsideJSXAttributeValue(component)) {
|
|
1965
1959
|
if (!core.isDeclaredInRenderPropLoose(component)) {
|
|
1966
1960
|
context.report({
|
|
1967
1961
|
messageId: "noNestedComponentDefinitionInProps",
|
|
@@ -1984,10 +1978,9 @@ function create28(context) {
|
|
|
1984
1978
|
continue;
|
|
1985
1979
|
}
|
|
1986
1980
|
const parentComponent = AST11__namespace.findParentNode(component, isFunctionComponent);
|
|
1987
|
-
|
|
1988
|
-
if (isParentComponentNotDirectValueOfRenderProperty) {
|
|
1981
|
+
if (parentComponent != null && !core.isDirectValueOfRenderPropertyLoose(parentComponent)) {
|
|
1989
1982
|
context.report({
|
|
1990
|
-
messageId:
|
|
1983
|
+
messageId: component.parent.type === types.AST_NODE_TYPES.Property ? "noNestedComponentDefinitionInProps" : "noNestedComponentDefinition",
|
|
1991
1984
|
node: component,
|
|
1992
1985
|
data: {
|
|
1993
1986
|
name: name5
|
|
@@ -2020,6 +2013,9 @@ function create28(context) {
|
|
|
2020
2013
|
}
|
|
2021
2014
|
};
|
|
2022
2015
|
}
|
|
2016
|
+
function isInsideJSXAttributeValue(node) {
|
|
2017
|
+
return node.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX8__namespace.findParentAttribute(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
2018
|
+
}
|
|
2023
2019
|
function isInsideCreateElementProps(context, node) {
|
|
2024
2020
|
const call = AST11__namespace.findParentNode(node, core.isCreateElementCall(context));
|
|
2025
2021
|
if (call == null) return false;
|
package/dist/index.mjs
CHANGED
|
@@ -109,7 +109,7 @@ var settings3 = {
|
|
|
109
109
|
|
|
110
110
|
// package.json
|
|
111
111
|
var name4 = "eslint-plugin-react-x";
|
|
112
|
-
var version = "1.36.0-beta.
|
|
112
|
+
var version = "1.36.0-beta.2";
|
|
113
113
|
var createRule = createRuleForPlugin("x");
|
|
114
114
|
|
|
115
115
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1926,15 +1926,9 @@ function create28(context) {
|
|
|
1926
1926
|
return AST11.isClass(node2) && classComponents.some((component) => component.node === node2);
|
|
1927
1927
|
};
|
|
1928
1928
|
for (const { name: name5, node: component } of functionComponents) {
|
|
1929
|
-
if (
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
if (name5 == null) {
|
|
1933
|
-
continue;
|
|
1934
|
-
}
|
|
1935
|
-
const isInsideProperty = component.parent.type === AST_NODE_TYPES.Property;
|
|
1936
|
-
const isInsideJSXPropValue = component.parent.type === AST_NODE_TYPES.JSXAttribute || JSX8.findParentAttribute(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
1937
|
-
if (isInsideJSXPropValue) {
|
|
1929
|
+
if (name5 == null) continue;
|
|
1930
|
+
if (isDirectValueOfRenderPropertyLoose(component)) continue;
|
|
1931
|
+
if (isInsideJSXAttributeValue(component)) {
|
|
1938
1932
|
if (!isDeclaredInRenderPropLoose(component)) {
|
|
1939
1933
|
context.report({
|
|
1940
1934
|
messageId: "noNestedComponentDefinitionInProps",
|
|
@@ -1957,10 +1951,9 @@ function create28(context) {
|
|
|
1957
1951
|
continue;
|
|
1958
1952
|
}
|
|
1959
1953
|
const parentComponent = AST11.findParentNode(component, isFunctionComponent);
|
|
1960
|
-
|
|
1961
|
-
if (isParentComponentNotDirectValueOfRenderProperty) {
|
|
1954
|
+
if (parentComponent != null && !isDirectValueOfRenderPropertyLoose(parentComponent)) {
|
|
1962
1955
|
context.report({
|
|
1963
|
-
messageId:
|
|
1956
|
+
messageId: component.parent.type === AST_NODE_TYPES.Property ? "noNestedComponentDefinitionInProps" : "noNestedComponentDefinition",
|
|
1964
1957
|
node: component,
|
|
1965
1958
|
data: {
|
|
1966
1959
|
name: name5
|
|
@@ -1993,6 +1986,9 @@ function create28(context) {
|
|
|
1993
1986
|
}
|
|
1994
1987
|
};
|
|
1995
1988
|
}
|
|
1989
|
+
function isInsideJSXAttributeValue(node) {
|
|
1990
|
+
return node.parent.type === AST_NODE_TYPES.JSXAttribute || JSX8.findParentAttribute(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
1991
|
+
}
|
|
1996
1992
|
function isInsideCreateElementProps(context, node) {
|
|
1997
1993
|
const call = AST11.findParentNode(node, isCreateElementCall(context));
|
|
1998
1994
|
if (call == null) return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.36.0-beta.
|
|
3
|
+
"version": "1.36.0-beta.2",
|
|
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",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"compare-versions": "^6.1.1",
|
|
50
50
|
"string-ts": "^2.2.1",
|
|
51
51
|
"ts-pattern": "^5.6.2",
|
|
52
|
-
"@eslint-react/ast": "1.36.0-beta.
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/jsx": "1.36.0-beta.
|
|
56
|
-
"@eslint-react/shared": "1.36.0-beta.
|
|
57
|
-
"@eslint-react/var": "1.36.0-beta.
|
|
52
|
+
"@eslint-react/ast": "1.36.0-beta.2",
|
|
53
|
+
"@eslint-react/core": "1.36.0-beta.2",
|
|
54
|
+
"@eslint-react/eff": "1.36.0-beta.2",
|
|
55
|
+
"@eslint-react/jsx": "1.36.0-beta.2",
|
|
56
|
+
"@eslint-react/shared": "1.36.0-beta.2",
|
|
57
|
+
"@eslint-react/var": "1.36.0-beta.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@types/react": "^19.0.
|
|
60
|
+
"@types/react": "^19.0.11",
|
|
61
61
|
"@types/react-dom": "^19.0.4",
|
|
62
62
|
"ts-api-utils": "^2.0.1",
|
|
63
63
|
"tsup": "^8.4.0",
|