eslint-plugin-react-x 1.36.0-beta.2 → 1.36.0-next.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 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.2";
139
+ var version = "1.36.0-next.0";
140
140
  var createRule = shared.createRuleForPlugin("x");
141
141
 
142
142
  // src/rules/avoid-shorthand-boolean.ts
@@ -1953,9 +1953,15 @@ 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 (name5 == null) continue;
1957
- if (core.isDirectValueOfRenderPropertyLoose(component)) continue;
1958
- if (isInsideJSXAttributeValue(component)) {
1956
+ if (core.isDirectValueOfRenderPropertyLoose(component)) {
1957
+ continue;
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) {
1959
1965
  if (!core.isDeclaredInRenderPropLoose(component)) {
1960
1966
  context.report({
1961
1967
  messageId: "noNestedComponentDefinitionInProps",
@@ -1978,9 +1984,10 @@ function create28(context) {
1978
1984
  continue;
1979
1985
  }
1980
1986
  const parentComponent = AST11__namespace.findParentNode(component, isFunctionComponent);
1981
- if (parentComponent != null && !core.isDirectValueOfRenderPropertyLoose(parentComponent)) {
1987
+ const isParentComponentNotDirectValueOfRenderProperty = parentComponent != null && !core.isDirectValueOfRenderPropertyLoose(parentComponent);
1988
+ if (isParentComponentNotDirectValueOfRenderProperty) {
1982
1989
  context.report({
1983
- messageId: component.parent.type === types.AST_NODE_TYPES.Property ? "noNestedComponentDefinitionInProps" : "noNestedComponentDefinition",
1990
+ messageId: isInsideProperty ? "noNestedComponentDefinitionInProps" : "noNestedComponentDefinition",
1984
1991
  node: component,
1985
1992
  data: {
1986
1993
  name: name5
@@ -2013,9 +2020,6 @@ function create28(context) {
2013
2020
  }
2014
2021
  };
2015
2022
  }
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
- }
2019
2023
  function isInsideCreateElementProps(context, node) {
2020
2024
  const call = AST11__namespace.findParentNode(node, core.isCreateElementCall(context));
2021
2025
  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.2";
112
+ var version = "1.36.0-next.0";
113
113
  var createRule = createRuleForPlugin("x");
114
114
 
115
115
  // src/rules/avoid-shorthand-boolean.ts
@@ -1926,9 +1926,15 @@ 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 (name5 == null) continue;
1930
- if (isDirectValueOfRenderPropertyLoose(component)) continue;
1931
- if (isInsideJSXAttributeValue(component)) {
1929
+ if (isDirectValueOfRenderPropertyLoose(component)) {
1930
+ continue;
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) {
1932
1938
  if (!isDeclaredInRenderPropLoose(component)) {
1933
1939
  context.report({
1934
1940
  messageId: "noNestedComponentDefinitionInProps",
@@ -1951,9 +1957,10 @@ function create28(context) {
1951
1957
  continue;
1952
1958
  }
1953
1959
  const parentComponent = AST11.findParentNode(component, isFunctionComponent);
1954
- if (parentComponent != null && !isDirectValueOfRenderPropertyLoose(parentComponent)) {
1960
+ const isParentComponentNotDirectValueOfRenderProperty = parentComponent != null && !isDirectValueOfRenderPropertyLoose(parentComponent);
1961
+ if (isParentComponentNotDirectValueOfRenderProperty) {
1955
1962
  context.report({
1956
- messageId: component.parent.type === AST_NODE_TYPES.Property ? "noNestedComponentDefinitionInProps" : "noNestedComponentDefinition",
1963
+ messageId: isInsideProperty ? "noNestedComponentDefinitionInProps" : "noNestedComponentDefinition",
1957
1964
  node: component,
1958
1965
  data: {
1959
1966
  name: name5
@@ -1986,9 +1993,6 @@ function create28(context) {
1986
1993
  }
1987
1994
  };
1988
1995
  }
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
- }
1992
1996
  function isInsideCreateElementProps(context, node) {
1993
1997
  const call = AST11.findParentNode(node, isCreateElementCall(context));
1994
1998
  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.2",
3
+ "version": "1.36.0-next.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",
@@ -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.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"
52
+ "@eslint-react/ast": "1.36.0-next.0",
53
+ "@eslint-react/eff": "1.36.0-next.0",
54
+ "@eslint-react/core": "1.36.0-next.0",
55
+ "@eslint-react/jsx": "1.36.0-next.0",
56
+ "@eslint-react/shared": "1.36.0-next.0",
57
+ "@eslint-react/var": "1.36.0-next.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/react": "^19.0.11",
60
+ "@types/react": "^19.0.10",
61
61
  "@types/react-dom": "^19.0.4",
62
62
  "ts-api-utils": "^2.0.1",
63
63
  "tsup": "^8.4.0",