eslint-plugin-react-x 1.52.2-beta.2 → 1.52.2-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
@@ -142,7 +142,7 @@ var settings3 = {
142
142
 
143
143
  // package.json
144
144
  var name4 = "eslint-plugin-react-x";
145
- var version = "1.52.2-beta.2";
145
+ var version = "1.52.2-next.0";
146
146
  var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
147
147
 
148
148
  // src/rules/avoid-shorthand-boolean.ts
@@ -1362,8 +1362,17 @@ function create26(context) {
1362
1362
  const variable = VAR2__namespace.findVariable(object.name, context.sourceCode.getScope(node));
1363
1363
  const variableNode = VAR2__namespace.getVariableInitNode(variable, 0);
1364
1364
  if (variableNode == null) return;
1365
- if (!AST8__namespace.isFunction(variableNode)) return;
1365
+ if (!AST8__namespace.isFunction(variableNode) && !ER25__namespace.isClassComponent(variableNode)) return;
1366
1366
  context.report({ messageId: "noDefaultProps", node: property });
1367
+ },
1368
+ PropertyDefinition(node) {
1369
+ if (!ER25__namespace.isClassComponent(node.parent.parent)) {
1370
+ return;
1371
+ }
1372
+ if (!node.static || node.key.type !== types.AST_NODE_TYPES.Identifier || node.key.name !== "defaultProps") {
1373
+ return;
1374
+ }
1375
+ context.report({ messageId: "noDefaultProps", node });
1367
1376
  }
1368
1377
  };
1369
1378
  }
@@ -2135,7 +2144,7 @@ function create36(context) {
2135
2144
  const isFunctionComponent = (node) => {
2136
2145
  return AST8__namespace.isFunction(node) && functionComponents.some((component) => component.node === node);
2137
2146
  };
2138
- const isClassComponent11 = (node) => {
2147
+ const isClassComponent12 = (node) => {
2139
2148
  return AST8__namespace.isClass(node) && classComponents.some((component) => component.node === node);
2140
2149
  };
2141
2150
  for (const { name: name5, node: component } of functionComponents) {
@@ -2189,7 +2198,7 @@ function create36(context) {
2189
2198
  }
2190
2199
  }
2191
2200
  for (const { name: name5 = "unknown", node: component } of classComponents) {
2192
- if (AST8__namespace.findParentNode(component, (n) => isClassComponent11(n) || isFunctionComponent(n)) == null) {
2201
+ if (AST8__namespace.findParentNode(component, (n) => isClassComponent12(n) || isFunctionComponent(n)) == null) {
2193
2202
  continue;
2194
2203
  }
2195
2204
  context.report({
package/dist/index.mjs CHANGED
@@ -115,7 +115,7 @@ var settings3 = {
115
115
 
116
116
  // package.json
117
117
  var name4 = "eslint-plugin-react-x";
118
- var version = "1.52.2-beta.2";
118
+ var version = "1.52.2-next.0";
119
119
  var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
120
120
 
121
121
  // src/rules/avoid-shorthand-boolean.ts
@@ -1335,8 +1335,17 @@ function create26(context) {
1335
1335
  const variable = VAR2.findVariable(object.name, context.sourceCode.getScope(node));
1336
1336
  const variableNode = VAR2.getVariableInitNode(variable, 0);
1337
1337
  if (variableNode == null) return;
1338
- if (!AST8.isFunction(variableNode)) return;
1338
+ if (!AST8.isFunction(variableNode) && !ER25.isClassComponent(variableNode)) return;
1339
1339
  context.report({ messageId: "noDefaultProps", node: property });
1340
+ },
1341
+ PropertyDefinition(node) {
1342
+ if (!ER25.isClassComponent(node.parent.parent)) {
1343
+ return;
1344
+ }
1345
+ if (!node.static || node.key.type !== AST_NODE_TYPES.Identifier || node.key.name !== "defaultProps") {
1346
+ return;
1347
+ }
1348
+ context.report({ messageId: "noDefaultProps", node });
1340
1349
  }
1341
1350
  };
1342
1351
  }
@@ -2108,7 +2117,7 @@ function create36(context) {
2108
2117
  const isFunctionComponent = (node) => {
2109
2118
  return AST8.isFunction(node) && functionComponents.some((component) => component.node === node);
2110
2119
  };
2111
- const isClassComponent11 = (node) => {
2120
+ const isClassComponent12 = (node) => {
2112
2121
  return AST8.isClass(node) && classComponents.some((component) => component.node === node);
2113
2122
  };
2114
2123
  for (const { name: name5, node: component } of functionComponents) {
@@ -2162,7 +2171,7 @@ function create36(context) {
2162
2171
  }
2163
2172
  }
2164
2173
  for (const { name: name5 = "unknown", node: component } of classComponents) {
2165
- if (AST8.findParentNode(component, (n) => isClassComponent11(n) || isFunctionComponent(n)) == null) {
2174
+ if (AST8.findParentNode(component, (n) => isClassComponent12(n) || isFunctionComponent(n)) == null) {
2166
2175
  continue;
2167
2176
  }
2168
2177
  context.report({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "1.52.2-beta.2",
3
+ "version": "1.52.2-next.0",
4
4
  "description": "A set of composable ESLint rules for 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.7.1",
53
- "@eslint-react/ast": "1.52.2-beta.2",
54
- "@eslint-react/core": "1.52.2-beta.2",
55
- "@eslint-react/eff": "1.52.2-beta.2",
56
- "@eslint-react/kit": "1.52.2-beta.2",
57
- "@eslint-react/shared": "1.52.2-beta.2",
58
- "@eslint-react/var": "1.52.2-beta.2"
53
+ "@eslint-react/ast": "1.52.2-next.0",
54
+ "@eslint-react/core": "1.52.2-next.0",
55
+ "@eslint-react/shared": "1.52.2-next.0",
56
+ "@eslint-react/kit": "1.52.2-next.0",
57
+ "@eslint-react/eff": "1.52.2-next.0",
58
+ "@eslint-react/var": "1.52.2-next.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/react": "^19.1.8",