eslint-plugin-react-debug 2.12.3-next.3 → 2.12.4-beta.1
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 +11 -7
- 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.
|
|
45
|
+
var version = "2.12.4-beta.1";
|
|
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
|
-
|
|
214
|
-
|
|
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
|
|
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.
|
|
231
|
-
case node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier: return core.
|
|
232
|
-
default: return core.
|
|
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
|
+
"version": "2.12.4-beta.1",
|
|
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.
|
|
47
|
-
"@eslint-react/core": "2.12.
|
|
48
|
-
"@eslint-react/shared": "2.12.
|
|
49
|
-
"@eslint-react/eff": "2.12.
|
|
50
|
-
"@eslint-react/var": "2.12.
|
|
46
|
+
"@eslint-react/ast": "2.12.4-beta.1",
|
|
47
|
+
"@eslint-react/core": "2.12.4-beta.1",
|
|
48
|
+
"@eslint-react/shared": "2.12.4-beta.1",
|
|
49
|
+
"@eslint-react/eff": "2.12.4-beta.1",
|
|
50
|
+
"@eslint-react/var": "2.12.4-beta.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/react": "^19.2.13",
|