eslint-plugin-react-debug 2.12.3-next.3 → 2.12.4-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 +11 -7
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
42
42
  //#endregion
43
43
  //#region package.json
44
44
  var name = "eslint-plugin-react-debug";
45
- var version = "2.12.3-next.3";
45
+ var version = "2.12.4-beta.0";
46
46
 
47
47
  //#endregion
48
48
  //#region src/utils/create-rule.ts
@@ -210,8 +210,12 @@ var is_from_ref_default = createRule({
210
210
  });
211
211
  function create$1(context) {
212
212
  function visitorFunction(node) {
213
- if (isFromRef(node, context.sourceCode.getScope(node))) {
214
- const json = stringify({ name: node.name });
213
+ const refInit = getRefInitNode(node, context.sourceCode.getScope(node));
214
+ if (refInit != null) {
215
+ const json = stringify({
216
+ name: node.name,
217
+ init: context.sourceCode.getText(refInit)
218
+ });
215
219
  context.report({
216
220
  messageId: "default",
217
221
  node,
@@ -224,12 +228,12 @@ function create$1(context) {
224
228
  JSXIdentifier: visitorFunction
225
229
  };
226
230
  }
227
- function isFromRef(node, initialScope) {
231
+ function getRefInitNode(node, initialScope) {
228
232
  const name = node.name;
229
233
  switch (true) {
230
- case node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier: return core.isInitializedFromRef(node.parent.object.name, initialScope);
231
- case node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier: return core.isInitializedFromRef(node.parent.object.name, initialScope);
232
- default: return core.isInitializedFromRef(name, initialScope);
234
+ case node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier: return core.getRefInit(node.parent.object.name, initialScope);
235
+ case node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier: return core.getRefInit(node.parent.object.name, initialScope);
236
+ default: return core.getRefInit(name, initialScope);
233
237
  }
234
238
  }
235
239
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-debug",
3
- "version": "2.12.3-next.3",
3
+ "version": "2.12.4-beta.0",
4
4
  "description": "ESLint React's ESLint plugin for debugging related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,11 +43,11 @@
43
43
  "@typescript-eslint/types": "^8.54.0",
44
44
  "@typescript-eslint/utils": "^8.54.0",
45
45
  "ts-pattern": "^5.9.0",
46
- "@eslint-react/ast": "2.12.3-next.3",
47
- "@eslint-react/core": "2.12.3-next.3",
48
- "@eslint-react/shared": "2.12.3-next.3",
49
- "@eslint-react/eff": "2.12.3-next.3",
50
- "@eslint-react/var": "2.12.3-next.3"
46
+ "@eslint-react/ast": "2.12.4-beta.0",
47
+ "@eslint-react/core": "2.12.4-beta.0",
48
+ "@eslint-react/eff": "2.12.4-beta.0",
49
+ "@eslint-react/shared": "2.12.4-beta.0",
50
+ "@eslint-react/var": "2.12.4-beta.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "^19.2.13",