eslint-plugin-react-x 4.1.0-beta.0 → 4.2.0-beta.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.
Files changed (2) hide show
  1. package/dist/index.js +6 -8
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -147,7 +147,7 @@ const rules$7 = {
147
147
  //#endregion
148
148
  //#region package.json
149
149
  var name$6 = "eslint-plugin-react-x";
150
- var version = "4.1.0-beta.0";
150
+ var version = "4.2.0-beta.0";
151
151
 
152
152
  //#endregion
153
153
  //#region src/utils/create-rule.ts
@@ -320,14 +320,9 @@ var component_hook_factories_default = createRule({
320
320
  defaultOptions: []
321
321
  });
322
322
  /**
323
- * Check if a function parameter name looks like a React component (PascalCase).
324
- */
325
- function isComponentLikeParamName(name) {
326
- return /^[A-Z]/.test(name);
327
- }
328
- /**
329
323
  * Check if a function parameter has a type annotation that looks like a React component type.
330
324
  * Matches types like ComponentType, React.ComponentType, FC, React.FC, etc.
325
+ * @param param The parameter to check.
331
326
  */
332
327
  function hasComponentTypeAnnotation(param) {
333
328
  if (param.type !== AST_NODE_TYPES.Identifier || param.typeAnnotation == null) return false;
@@ -337,6 +332,7 @@ function hasComponentTypeAnnotation(param) {
337
332
  }
338
333
  /**
339
334
  * Check if a type name refers to a known React component type.
335
+ * @param typeName The type name to check.
340
336
  */
341
337
  function isComponentTypeName(typeName) {
342
338
  if (typeName.type === AST_NODE_TYPES.Identifier) return /^(ComponentType|FC|ComponentClass|FunctionComponent|Component)$/.test(typeName.name);
@@ -350,16 +346,18 @@ function isComponentTypeName(typeName) {
350
346
  * Considers a function an HOC if it takes a parameter that looks like a React component
351
347
  * (by name or type annotation). This does not validate that the function actually returns
352
348
  * a React component.
349
+ * @param fn The function to check.
353
350
  */
354
351
  function isHigherOrderComponent(fn) {
355
352
  return fn.params.some((param) => {
356
- if (param.type === AST_NODE_TYPES.Identifier && isComponentLikeParamName(param.name)) return true;
353
+ if (param.type === AST_NODE_TYPES.Identifier && core.isComponentNameLoose(param.name)) return true;
357
354
  if (hasComponentTypeAnnotation(param)) return true;
358
355
  return false;
359
356
  });
360
357
  }
361
358
  /**
362
359
  * Check if a node is inside a test mock callback (vi.mock or jest.mock).
360
+ * @param node The node to check.
363
361
  */
364
362
  function isInsideTestMockCallback(node) {
365
363
  return ast.findParent(node, ast.isTestMockCallback) != null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "4.1.0-beta.0",
3
+ "version": "4.2.0-beta.0",
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",
@@ -45,11 +45,11 @@
45
45
  "string-ts": "^2.3.1",
46
46
  "ts-api-utils": "^2.5.0",
47
47
  "ts-pattern": "^5.9.0",
48
- "@eslint-react/ast": "4.1.0-beta.0",
49
- "@eslint-react/core": "4.1.0-beta.0",
50
- "@eslint-react/shared": "4.1.0-beta.0",
51
- "@eslint-react/jsx": "4.1.0-beta.0",
52
- "@eslint-react/var": "4.1.0-beta.0"
48
+ "@eslint-react/ast": "4.2.0-beta.0",
49
+ "@eslint-react/core": "4.2.0-beta.0",
50
+ "@eslint-react/jsx": "4.2.0-beta.0",
51
+ "@eslint-react/shared": "4.2.0-beta.0",
52
+ "@eslint-react/var": "4.2.0-beta.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/react": "^19.2.14",