eslint-plugin-react-x 3.0.0-beta.65 → 3.0.0-beta.67

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 +8 -7
  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 = "3.0.0-beta.65";
150
+ var version = "3.0.0-beta.67";
151
151
 
152
152
  //#endregion
153
153
  //#region src/utils/create-rule.ts
@@ -3748,8 +3748,8 @@ function create$13(context) {
3748
3748
  const checker = services.program.getTypeChecker();
3749
3749
  const { ctx, visitor } = core.useComponentCollector(context);
3750
3750
  return defineRuleListener(visitor, { "Program:exit"(program) {
3751
- const totalDeclaredProps = /* @__PURE__ */ new Set();
3752
- const totalUsedProps = /* @__PURE__ */ new Set();
3751
+ const totalDeclaredProps = /* @__PURE__ */ new Map();
3752
+ const totalUsedDeclarations = /* @__PURE__ */ new Set();
3753
3753
  for (const component of ctx.getAllComponents(program)) {
3754
3754
  const [props] = component.node.params;
3755
3755
  if (props == null) continue;
@@ -3758,12 +3758,13 @@ function create$13(context) {
3758
3758
  const tsNode = services.esTreeNodeToTSNodeMap.get(props);
3759
3759
  const declaredProps = checker.getTypeAtLocation(tsNode).getProperties();
3760
3760
  for (const declaredProp of declaredProps) {
3761
- totalDeclaredProps.add(declaredProp);
3762
- if (usedPropKeys.has(declaredProp.name)) totalUsedProps.add(declaredProp);
3761
+ const declaration = declaredProp.getDeclarations()?.[0];
3762
+ if (declaration == null) continue;
3763
+ if (!totalDeclaredProps.has(declaration)) totalDeclaredProps.set(declaration, declaredProp);
3764
+ if (usedPropKeys.has(declaredProp.name)) totalUsedDeclarations.add(declaration);
3763
3765
  }
3764
3766
  }
3765
- const unusedProps = totalDeclaredProps.difference(totalUsedProps);
3766
- for (const unusedProp of unusedProps) reportUnusedProp(context, services, unusedProp);
3767
+ for (const [declaration, symbol] of totalDeclaredProps.entries()) if (!totalUsedDeclarations.has(declaration)) reportUnusedProp(context, services, symbol);
3767
3768
  } });
3768
3769
  }
3769
3770
  function collectUsedPropKeysOfParameter(context, usedPropKeys, parameter) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "3.0.0-beta.65",
3
+ "version": "3.0.0-beta.67",
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.4.0",
47
47
  "ts-pattern": "^5.9.0",
48
- "@eslint-react/ast": "3.0.0-beta.65",
49
- "@eslint-react/shared": "3.0.0-beta.65",
50
- "@eslint-react/eff": "3.0.0-beta.65",
51
- "@eslint-react/var": "3.0.0-beta.65",
52
- "@eslint-react/core": "3.0.0-beta.65"
48
+ "@eslint-react/ast": "3.0.0-beta.67",
49
+ "@eslint-react/core": "3.0.0-beta.67",
50
+ "@eslint-react/eff": "3.0.0-beta.67",
51
+ "@eslint-react/shared": "3.0.0-beta.67",
52
+ "@eslint-react/var": "3.0.0-beta.67"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/react": "^19.2.14",