eslint-plugin-react-x 3.0.0-beta.65 → 3.0.0-beta.66
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 +8 -7
- 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.
|
|
150
|
+
var version = "3.0.0-beta.66";
|
|
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
|
|
3752
|
-
const
|
|
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
|
-
|
|
3762
|
-
if (
|
|
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
|
|
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.
|
|
3
|
+
"version": "3.0.0-beta.66",
|
|
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.
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
48
|
+
"@eslint-react/ast": "3.0.0-beta.66",
|
|
49
|
+
"@eslint-react/core": "3.0.0-beta.66",
|
|
50
|
+
"@eslint-react/shared": "3.0.0-beta.66",
|
|
51
|
+
"@eslint-react/eff": "3.0.0-beta.66",
|
|
52
|
+
"@eslint-react/var": "3.0.0-beta.66"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/react": "^19.2.14",
|