eslint-plugin-react-debug 2.7.4-beta.2 → 2.7.4-beta.5

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 +17 -2
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener, getConfigAdapters, getSettingsFromContext, report } from "@eslint-react/shared";
2
- import { ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, isFromReact, isJsxFragmentElement, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
2
+ import { ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, isInitializedFromReact, isJsxFragmentElement, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
3
3
  import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
4
4
  import { flow } from "@eslint-react/eff";
5
5
  import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from "@typescript-eslint/types";
@@ -41,7 +41,7 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
41
41
  //#endregion
42
42
  //#region package.json
43
43
  var name = "eslint-plugin-react-debug";
44
- var version = "2.7.4-beta.2";
44
+ var version = "2.7.4-beta.5";
45
45
 
46
46
  //#endregion
47
47
  //#region src/utils/create-rule.ts
@@ -178,6 +178,21 @@ function create$1(context) {
178
178
  JSXIdentifier: visitorFunction
179
179
  };
180
180
  }
181
+ /**
182
+ * Check if an identifier node is initialized from React
183
+ * @param node The identifier node to check
184
+ * @param initialScope Initial scope to search for the identifier
185
+ * @param importSource The import source to check against
186
+ * @returns Whether the identifier node is initialized from React
187
+ */
188
+ function isFromReact(node, initialScope, importSource = "react") {
189
+ const name$2 = node.name;
190
+ switch (true) {
191
+ case node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier: return isInitializedFromReact(node.parent.object.name, initialScope, importSource);
192
+ case node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier: return isInitializedFromReact(node.parent.object.name, initialScope, importSource);
193
+ default: return isInitializedFromReact(name$2, initialScope, importSource);
194
+ }
195
+ }
181
196
 
182
197
  //#endregion
183
198
  //#region src/rules/jsx.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-debug",
3
- "version": "2.7.4-beta.2",
3
+ "version": "2.7.4-beta.5",
4
4
  "description": "ESLint React's ESLint plugin for debugging related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -44,11 +44,11 @@
44
44
  "@typescript-eslint/utils": "^8.53.1",
45
45
  "string-ts": "^2.3.1",
46
46
  "ts-pattern": "^5.9.0",
47
- "@eslint-react/ast": "2.7.4-beta.2",
48
- "@eslint-react/core": "2.7.4-beta.2",
49
- "@eslint-react/eff": "2.7.4-beta.2",
50
- "@eslint-react/shared": "2.7.4-beta.2",
51
- "@eslint-react/var": "2.7.4-beta.2"
47
+ "@eslint-react/ast": "2.7.4-beta.5",
48
+ "@eslint-react/core": "2.7.4-beta.5",
49
+ "@eslint-react/shared": "2.7.4-beta.5",
50
+ "@eslint-react/var": "2.7.4-beta.5",
51
+ "@eslint-react/eff": "2.7.4-beta.5"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/react": "^19.2.9",