eslint-plugin-react-x 3.0.0-beta.64 → 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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ESLint, Linter } from "eslint";
2
2
 
3
3
  //#region src/index.d.ts
4
- type ConfigName = "disable-experimental" | "disable-type-checked" | "recommended" | "recommended-type-checked" | "recommended-typescript" | "strict" | "strict-type-checked" | "strict-typescript";
4
+ type ConfigName = "disable-experimental" | "disable-type-checked" | "disable-conflict-eslint-plugin-react" | "disable-conflict-eslint-plugin-react-hooks" | "recommended" | "recommended-type-checked" | "recommended-typescript" | "strict" | "strict-type-checked" | "strict-typescript";
5
5
  declare const finalPlugin: ESLint.Plugin & {
6
6
  configs: Record<ConfigName, Linter.Config>;
7
7
  };
package/dist/index.js CHANGED
@@ -30,6 +30,84 @@ var __exportAll = (all, no_symbols) => {
30
30
  return target;
31
31
  };
32
32
 
33
+ //#endregion
34
+ //#region src/configs/disable-conflict-eslint-plugin-react.ts
35
+ var disable_conflict_eslint_plugin_react_exports = /* @__PURE__ */ __exportAll({
36
+ name: () => name$10,
37
+ rules: () => rules$10
38
+ });
39
+ const conflictingRules$1 = [
40
+ "react/button-has-type",
41
+ "react/destructuring-assignment",
42
+ "react/display-name",
43
+ "react/forbid-prop-types",
44
+ "react/forward-ref-uses-ref",
45
+ "react/hook-use-state",
46
+ "react/iframe-missing-sandbox",
47
+ "react/jsx-boolean-value",
48
+ "react/jsx-filename-extension",
49
+ "react/jsx-fragments",
50
+ "react/jsx-key",
51
+ "react/jsx-no-comment-textnodes",
52
+ "react/jsx-no-constructed-context-values",
53
+ "react/jsx-no-duplicate-props",
54
+ "react/jsx-no-leaked-render",
55
+ "react/jsx-no-script-url",
56
+ "react/jsx-no-target-blank",
57
+ "react/jsx-no-useless-fragment",
58
+ "react/jsx-pascal-case",
59
+ "react/jsx-uses-react",
60
+ "react/jsx-uses-vars",
61
+ "react/no-access-state-in-setstate",
62
+ "react/no-array-index-key",
63
+ "react/no-children-prop",
64
+ "react/no-danger",
65
+ "react/no-danger-with-children",
66
+ "react/no-deprecated",
67
+ "react/no-did-mount-set-state",
68
+ "react/no-did-update-set-state",
69
+ "react/no-direct-mutation-state",
70
+ "react/no-find-dom-node",
71
+ "react/no-namespace",
72
+ "react/no-object-type-as-default-prop",
73
+ "react/no-redundant-should-component-update",
74
+ "react/no-render-return-value",
75
+ "react/no-string-refs",
76
+ "react/no-unknown-property",
77
+ "react/no-unsafe",
78
+ "react/no-unstable-nested-components",
79
+ "react/no-unused-class-component-members",
80
+ "react/no-unused-state",
81
+ "react/no-will-update-set-state",
82
+ "react/prop-types",
83
+ "react/void-dom-elements-no-children"
84
+ ];
85
+ const name$10 = "react-x/disable-conflict-eslint-plugin-react";
86
+ const rules$10 = Object.fromEntries(conflictingRules$1.map((key) => [key, "off"]));
87
+
88
+ //#endregion
89
+ //#region src/configs/disable-conflict-eslint-plugin-react-hooks.ts
90
+ var disable_conflict_eslint_plugin_react_hooks_exports = /* @__PURE__ */ __exportAll({
91
+ name: () => name$9,
92
+ rules: () => rules$9
93
+ });
94
+ const conflictingRules = [
95
+ "react-hooks/exhaustive-deps",
96
+ "react-hooks/rules-of-hooks",
97
+ "react-hooks/component-hook-factories",
98
+ "react-hooks/error-boundaries",
99
+ "react-hooks/immutability",
100
+ "react-hooks/purity",
101
+ "react-hooks/refs",
102
+ "react-hooks/set-state-in-effect",
103
+ "react-hooks/set-state-in-render",
104
+ "react-hooks/static-components",
105
+ "react-hooks/unsupported-syntax",
106
+ "react-hooks/use-memo"
107
+ ];
108
+ const name$9 = "react-x/disable-conflict-eslint-plugin-react-hooks";
109
+ const rules$9 = Object.fromEntries(conflictingRules.map((key) => [key, "off"]));
110
+
33
111
  //#endregion
34
112
  //#region src/configs/disable-experimental.ts
35
113
  var disable_experimental_exports = /* @__PURE__ */ __exportAll({
@@ -69,7 +147,7 @@ const rules$7 = {
69
147
  //#endregion
70
148
  //#region package.json
71
149
  var name$6 = "eslint-plugin-react-x";
72
- var version = "3.0.0-beta.64";
150
+ var version = "3.0.0-beta.66";
73
151
 
74
152
  //#endregion
75
153
  //#region src/utils/create-rule.ts
@@ -3670,8 +3748,8 @@ function create$13(context) {
3670
3748
  const checker = services.program.getTypeChecker();
3671
3749
  const { ctx, visitor } = core.useComponentCollector(context);
3672
3750
  return defineRuleListener(visitor, { "Program:exit"(program) {
3673
- const totalDeclaredProps = /* @__PURE__ */ new Set();
3674
- const totalUsedProps = /* @__PURE__ */ new Set();
3751
+ const totalDeclaredProps = /* @__PURE__ */ new Map();
3752
+ const totalUsedDeclarations = /* @__PURE__ */ new Set();
3675
3753
  for (const component of ctx.getAllComponents(program)) {
3676
3754
  const [props] = component.node.params;
3677
3755
  if (props == null) continue;
@@ -3680,12 +3758,13 @@ function create$13(context) {
3680
3758
  const tsNode = services.esTreeNodeToTSNodeMap.get(props);
3681
3759
  const declaredProps = checker.getTypeAtLocation(tsNode).getProperties();
3682
3760
  for (const declaredProp of declaredProps) {
3683
- totalDeclaredProps.add(declaredProp);
3684
- 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);
3685
3765
  }
3686
3766
  }
3687
- const unusedProps = totalDeclaredProps.difference(totalUsedProps);
3688
- 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);
3689
3768
  } });
3690
3769
  }
3691
3770
  function collectUsedPropKeysOfParameter(context, usedPropKeys, parameter) {
@@ -7383,6 +7462,8 @@ const finalPlugin = {
7383
7462
  configs: {
7384
7463
  ["disable-experimental"]: disable_experimental_exports,
7385
7464
  ["disable-type-checked"]: disable_type_checked_exports,
7465
+ ["disable-conflict-eslint-plugin-react"]: disable_conflict_eslint_plugin_react_exports,
7466
+ ["disable-conflict-eslint-plugin-react-hooks"]: disable_conflict_eslint_plugin_react_hooks_exports,
7386
7467
  ["recommended"]: recommended_exports,
7387
7468
  ["recommended-type-checked"]: recommended_type_checked_exports,
7388
7469
  ["recommended-typescript"]: recommended_typescript_exports,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "3.0.0-beta.64",
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.64",
49
- "@eslint-react/eff": "3.0.0-beta.64",
50
- "@eslint-react/core": "3.0.0-beta.64",
51
- "@eslint-react/shared": "3.0.0-beta.64",
52
- "@eslint-react/var": "3.0.0-beta.64"
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",