eslint-plugin-react-debug 1.34.0-next.0 → 1.34.0-next.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 +105 -101
- package/dist/index.mjs +105 -101
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var settings = {
|
|
|
30
30
|
|
|
31
31
|
// package.json
|
|
32
32
|
var name2 = "eslint-plugin-react-debug";
|
|
33
|
-
var version = "1.34.0-next.
|
|
33
|
+
var version = "1.34.0-next.1";
|
|
34
34
|
var createRule = shared.createRuleForPlugin("debug");
|
|
35
35
|
|
|
36
36
|
// src/rules/class-component.ts
|
|
@@ -51,26 +51,27 @@ var class_component_default = createRule({
|
|
|
51
51
|
schema: []
|
|
52
52
|
},
|
|
53
53
|
name: RULE_NAME,
|
|
54
|
-
create
|
|
55
|
-
const { ctx, listeners } = core.useComponentCollectorLegacy();
|
|
56
|
-
return {
|
|
57
|
-
...listeners,
|
|
58
|
-
"Program:exit"(node) {
|
|
59
|
-
const components = ctx.getAllComponents(node);
|
|
60
|
-
for (const { name: name3 = "anonymous", node: component } of components.values()) {
|
|
61
|
-
context.report({
|
|
62
|
-
messageId: "classComponent",
|
|
63
|
-
node: component,
|
|
64
|
-
data: {
|
|
65
|
-
name: name3
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
},
|
|
54
|
+
create,
|
|
72
55
|
defaultOptions: []
|
|
73
56
|
});
|
|
57
|
+
function create(context) {
|
|
58
|
+
const { ctx, listeners } = core.useComponentCollectorLegacy();
|
|
59
|
+
return {
|
|
60
|
+
...listeners,
|
|
61
|
+
"Program:exit"(node) {
|
|
62
|
+
const components = ctx.getAllComponents(node);
|
|
63
|
+
for (const { name: name3 = "anonymous", node: component } of components.values()) {
|
|
64
|
+
context.report({
|
|
65
|
+
messageId: "classComponent",
|
|
66
|
+
node: component,
|
|
67
|
+
data: {
|
|
68
|
+
name: name3
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
74
75
|
var RULE_NAME2 = "function-component";
|
|
75
76
|
var RULE_FEATURES2 = [
|
|
76
77
|
"DBG"
|
|
@@ -88,37 +89,38 @@ var function_component_default = createRule({
|
|
|
88
89
|
schema: []
|
|
89
90
|
},
|
|
90
91
|
name: RULE_NAME2,
|
|
91
|
-
create
|
|
92
|
-
const { ctx, listeners } = core.useComponentCollector(
|
|
93
|
-
context,
|
|
94
|
-
{
|
|
95
|
-
collectDisplayName: true,
|
|
96
|
-
collectHookCalls: true,
|
|
97
|
-
hint: core.DEFAULT_COMPONENT_HINT
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
return {
|
|
101
|
-
...listeners,
|
|
102
|
-
"Program:exit"(node) {
|
|
103
|
-
const components = ctx.getAllComponents(node);
|
|
104
|
-
for (const { name: name3 = "anonymous", node: node2, displayName, flag, hookCalls } of components.values()) {
|
|
105
|
-
context.report({
|
|
106
|
-
messageId: "functionComponent",
|
|
107
|
-
node: node2,
|
|
108
|
-
data: {
|
|
109
|
-
name: name3,
|
|
110
|
-
displayName: displayName != null ? context.sourceCode.getText(displayName) : "none",
|
|
111
|
-
forwardRef: (flag & core.ERComponentFlag.ForwardRef) > 0n,
|
|
112
|
-
hookCalls: hookCalls.length,
|
|
113
|
-
memo: (flag & core.ERComponentFlag.Memo) > 0n
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
},
|
|
92
|
+
create: create2,
|
|
120
93
|
defaultOptions: []
|
|
121
94
|
});
|
|
95
|
+
function create2(context) {
|
|
96
|
+
const { ctx, listeners } = core.useComponentCollector(
|
|
97
|
+
context,
|
|
98
|
+
{
|
|
99
|
+
collectDisplayName: true,
|
|
100
|
+
collectHookCalls: true,
|
|
101
|
+
hint: core.DEFAULT_COMPONENT_HINT
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
return {
|
|
105
|
+
...listeners,
|
|
106
|
+
"Program:exit"(node) {
|
|
107
|
+
const components = ctx.getAllComponents(node);
|
|
108
|
+
for (const { name: name3 = "anonymous", node: node2, displayName, flag, hookCalls } of components.values()) {
|
|
109
|
+
context.report({
|
|
110
|
+
messageId: "functionComponent",
|
|
111
|
+
node: node2,
|
|
112
|
+
data: {
|
|
113
|
+
name: name3,
|
|
114
|
+
displayName: displayName != null ? context.sourceCode.getText(displayName) : "none",
|
|
115
|
+
forwardRef: (flag & core.ERComponentFlag.ForwardRef) > 0n,
|
|
116
|
+
hookCalls: hookCalls.length,
|
|
117
|
+
memo: (flag & core.ERComponentFlag.Memo) > 0n
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
122
124
|
var RULE_NAME3 = "hook";
|
|
123
125
|
var RULE_FEATURES3 = [
|
|
124
126
|
"DBG"
|
|
@@ -136,27 +138,28 @@ var hook_default = createRule({
|
|
|
136
138
|
schema: []
|
|
137
139
|
},
|
|
138
140
|
name: RULE_NAME3,
|
|
139
|
-
create
|
|
140
|
-
const { ctx, listeners } = core.useHookCollector();
|
|
141
|
-
return {
|
|
142
|
-
...listeners,
|
|
143
|
-
"Program:exit"(node) {
|
|
144
|
-
const allHooks = ctx.getAllHooks(node);
|
|
145
|
-
for (const { name: name3, node: node2, hookCalls } of allHooks.values()) {
|
|
146
|
-
context.report({
|
|
147
|
-
messageId: "hook",
|
|
148
|
-
node: node2,
|
|
149
|
-
data: {
|
|
150
|
-
name: name3,
|
|
151
|
-
hookCalls: hookCalls.length
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
},
|
|
141
|
+
create: create3,
|
|
158
142
|
defaultOptions: []
|
|
159
143
|
});
|
|
144
|
+
function create3(context) {
|
|
145
|
+
const { ctx, listeners } = core.useHookCollector();
|
|
146
|
+
return {
|
|
147
|
+
...listeners,
|
|
148
|
+
"Program:exit"(node) {
|
|
149
|
+
const allHooks = ctx.getAllHooks(node);
|
|
150
|
+
for (const { name: name3, node: node2, hookCalls } of allHooks.values()) {
|
|
151
|
+
context.report({
|
|
152
|
+
messageId: "hook",
|
|
153
|
+
node: node2,
|
|
154
|
+
data: {
|
|
155
|
+
name: name3,
|
|
156
|
+
hookCalls: hookCalls.length
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
160
163
|
var RULE_NAME4 = "is-from-react";
|
|
161
164
|
var RULE_FEATURES4 = [
|
|
162
165
|
"DBG"
|
|
@@ -174,42 +177,43 @@ var is_from_react_default = createRule({
|
|
|
174
177
|
schema: []
|
|
175
178
|
},
|
|
176
179
|
name: RULE_NAME4,
|
|
177
|
-
create
|
|
178
|
-
const { importSource = "react" } = shared.getSettingsFromContext(context);
|
|
179
|
-
function isFromReact(node, initialScope) {
|
|
180
|
-
const name3 = node.name;
|
|
181
|
-
switch (true) {
|
|
182
|
-
case (node.parent.type === utils.AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === utils.AST_NODE_TYPES.Identifier):
|
|
183
|
-
return core.isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
184
|
-
case (node.parent.type === utils.AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === utils.AST_NODE_TYPES.JSXIdentifier):
|
|
185
|
-
return core.isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
186
|
-
default:
|
|
187
|
-
return core.isInitializedFromReact(name3, importSource, initialScope);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function visitorFunction(node) {
|
|
191
|
-
const shouldSkipDuplicate = node.parent.type === utils.AST_NODE_TYPES.ImportSpecifier && node.parent.imported === node && node.parent.imported.name === node.parent.local.name;
|
|
192
|
-
if (shouldSkipDuplicate) return;
|
|
193
|
-
const name3 = node.name;
|
|
194
|
-
const initialScope = context.sourceCode.getScope(node);
|
|
195
|
-
if (!isFromReact(node, initialScope)) return;
|
|
196
|
-
context.report({
|
|
197
|
-
messageId: "isFromReact",
|
|
198
|
-
node,
|
|
199
|
-
data: {
|
|
200
|
-
type: node.type,
|
|
201
|
-
name: name3,
|
|
202
|
-
importSource
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
return {
|
|
207
|
-
Identifier: visitorFunction,
|
|
208
|
-
JSXIdentifier: visitorFunction
|
|
209
|
-
};
|
|
210
|
-
},
|
|
180
|
+
create: create4,
|
|
211
181
|
defaultOptions: []
|
|
212
182
|
});
|
|
183
|
+
function create4(context) {
|
|
184
|
+
const { importSource = "react" } = shared.getSettingsFromContext(context);
|
|
185
|
+
function isFromReact(node, initialScope) {
|
|
186
|
+
const name3 = node.name;
|
|
187
|
+
switch (true) {
|
|
188
|
+
case (node.parent.type === utils.AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === utils.AST_NODE_TYPES.Identifier):
|
|
189
|
+
return core.isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
190
|
+
case (node.parent.type === utils.AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === utils.AST_NODE_TYPES.JSXIdentifier):
|
|
191
|
+
return core.isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
192
|
+
default:
|
|
193
|
+
return core.isInitializedFromReact(name3, importSource, initialScope);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function visitorFunction(node) {
|
|
197
|
+
const shouldSkipDuplicate = node.parent.type === utils.AST_NODE_TYPES.ImportSpecifier && node.parent.imported === node && node.parent.imported.name === node.parent.local.name;
|
|
198
|
+
if (shouldSkipDuplicate) return;
|
|
199
|
+
const name3 = node.name;
|
|
200
|
+
const initialScope = context.sourceCode.getScope(node);
|
|
201
|
+
if (!isFromReact(node, initialScope)) return;
|
|
202
|
+
context.report({
|
|
203
|
+
messageId: "isFromReact",
|
|
204
|
+
node,
|
|
205
|
+
data: {
|
|
206
|
+
type: node.type,
|
|
207
|
+
name: name3,
|
|
208
|
+
importSource
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
Identifier: visitorFunction,
|
|
214
|
+
JSXIdentifier: visitorFunction
|
|
215
|
+
};
|
|
216
|
+
}
|
|
213
217
|
|
|
214
218
|
// src/plugin.ts
|
|
215
219
|
var plugin = {
|
package/dist/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ var settings = {
|
|
|
28
28
|
|
|
29
29
|
// package.json
|
|
30
30
|
var name2 = "eslint-plugin-react-debug";
|
|
31
|
-
var version = "1.34.0-next.
|
|
31
|
+
var version = "1.34.0-next.1";
|
|
32
32
|
var createRule = createRuleForPlugin("debug");
|
|
33
33
|
|
|
34
34
|
// src/rules/class-component.ts
|
|
@@ -49,26 +49,27 @@ var class_component_default = createRule({
|
|
|
49
49
|
schema: []
|
|
50
50
|
},
|
|
51
51
|
name: RULE_NAME,
|
|
52
|
-
create
|
|
53
|
-
const { ctx, listeners } = useComponentCollectorLegacy();
|
|
54
|
-
return {
|
|
55
|
-
...listeners,
|
|
56
|
-
"Program:exit"(node) {
|
|
57
|
-
const components = ctx.getAllComponents(node);
|
|
58
|
-
for (const { name: name3 = "anonymous", node: component } of components.values()) {
|
|
59
|
-
context.report({
|
|
60
|
-
messageId: "classComponent",
|
|
61
|
-
node: component,
|
|
62
|
-
data: {
|
|
63
|
-
name: name3
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
},
|
|
52
|
+
create,
|
|
70
53
|
defaultOptions: []
|
|
71
54
|
});
|
|
55
|
+
function create(context) {
|
|
56
|
+
const { ctx, listeners } = useComponentCollectorLegacy();
|
|
57
|
+
return {
|
|
58
|
+
...listeners,
|
|
59
|
+
"Program:exit"(node) {
|
|
60
|
+
const components = ctx.getAllComponents(node);
|
|
61
|
+
for (const { name: name3 = "anonymous", node: component } of components.values()) {
|
|
62
|
+
context.report({
|
|
63
|
+
messageId: "classComponent",
|
|
64
|
+
node: component,
|
|
65
|
+
data: {
|
|
66
|
+
name: name3
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
72
73
|
var RULE_NAME2 = "function-component";
|
|
73
74
|
var RULE_FEATURES2 = [
|
|
74
75
|
"DBG"
|
|
@@ -86,37 +87,38 @@ var function_component_default = createRule({
|
|
|
86
87
|
schema: []
|
|
87
88
|
},
|
|
88
89
|
name: RULE_NAME2,
|
|
89
|
-
create
|
|
90
|
-
const { ctx, listeners } = useComponentCollector(
|
|
91
|
-
context,
|
|
92
|
-
{
|
|
93
|
-
collectDisplayName: true,
|
|
94
|
-
collectHookCalls: true,
|
|
95
|
-
hint: DEFAULT_COMPONENT_HINT
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
return {
|
|
99
|
-
...listeners,
|
|
100
|
-
"Program:exit"(node) {
|
|
101
|
-
const components = ctx.getAllComponents(node);
|
|
102
|
-
for (const { name: name3 = "anonymous", node: node2, displayName, flag, hookCalls } of components.values()) {
|
|
103
|
-
context.report({
|
|
104
|
-
messageId: "functionComponent",
|
|
105
|
-
node: node2,
|
|
106
|
-
data: {
|
|
107
|
-
name: name3,
|
|
108
|
-
displayName: displayName != null ? context.sourceCode.getText(displayName) : "none",
|
|
109
|
-
forwardRef: (flag & ERComponentFlag.ForwardRef) > 0n,
|
|
110
|
-
hookCalls: hookCalls.length,
|
|
111
|
-
memo: (flag & ERComponentFlag.Memo) > 0n
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
},
|
|
90
|
+
create: create2,
|
|
118
91
|
defaultOptions: []
|
|
119
92
|
});
|
|
93
|
+
function create2(context) {
|
|
94
|
+
const { ctx, listeners } = useComponentCollector(
|
|
95
|
+
context,
|
|
96
|
+
{
|
|
97
|
+
collectDisplayName: true,
|
|
98
|
+
collectHookCalls: true,
|
|
99
|
+
hint: DEFAULT_COMPONENT_HINT
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
return {
|
|
103
|
+
...listeners,
|
|
104
|
+
"Program:exit"(node) {
|
|
105
|
+
const components = ctx.getAllComponents(node);
|
|
106
|
+
for (const { name: name3 = "anonymous", node: node2, displayName, flag, hookCalls } of components.values()) {
|
|
107
|
+
context.report({
|
|
108
|
+
messageId: "functionComponent",
|
|
109
|
+
node: node2,
|
|
110
|
+
data: {
|
|
111
|
+
name: name3,
|
|
112
|
+
displayName: displayName != null ? context.sourceCode.getText(displayName) : "none",
|
|
113
|
+
forwardRef: (flag & ERComponentFlag.ForwardRef) > 0n,
|
|
114
|
+
hookCalls: hookCalls.length,
|
|
115
|
+
memo: (flag & ERComponentFlag.Memo) > 0n
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
120
122
|
var RULE_NAME3 = "hook";
|
|
121
123
|
var RULE_FEATURES3 = [
|
|
122
124
|
"DBG"
|
|
@@ -134,27 +136,28 @@ var hook_default = createRule({
|
|
|
134
136
|
schema: []
|
|
135
137
|
},
|
|
136
138
|
name: RULE_NAME3,
|
|
137
|
-
create
|
|
138
|
-
const { ctx, listeners } = useHookCollector();
|
|
139
|
-
return {
|
|
140
|
-
...listeners,
|
|
141
|
-
"Program:exit"(node) {
|
|
142
|
-
const allHooks = ctx.getAllHooks(node);
|
|
143
|
-
for (const { name: name3, node: node2, hookCalls } of allHooks.values()) {
|
|
144
|
-
context.report({
|
|
145
|
-
messageId: "hook",
|
|
146
|
-
node: node2,
|
|
147
|
-
data: {
|
|
148
|
-
name: name3,
|
|
149
|
-
hookCalls: hookCalls.length
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
},
|
|
139
|
+
create: create3,
|
|
156
140
|
defaultOptions: []
|
|
157
141
|
});
|
|
142
|
+
function create3(context) {
|
|
143
|
+
const { ctx, listeners } = useHookCollector();
|
|
144
|
+
return {
|
|
145
|
+
...listeners,
|
|
146
|
+
"Program:exit"(node) {
|
|
147
|
+
const allHooks = ctx.getAllHooks(node);
|
|
148
|
+
for (const { name: name3, node: node2, hookCalls } of allHooks.values()) {
|
|
149
|
+
context.report({
|
|
150
|
+
messageId: "hook",
|
|
151
|
+
node: node2,
|
|
152
|
+
data: {
|
|
153
|
+
name: name3,
|
|
154
|
+
hookCalls: hookCalls.length
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
158
161
|
var RULE_NAME4 = "is-from-react";
|
|
159
162
|
var RULE_FEATURES4 = [
|
|
160
163
|
"DBG"
|
|
@@ -172,42 +175,43 @@ var is_from_react_default = createRule({
|
|
|
172
175
|
schema: []
|
|
173
176
|
},
|
|
174
177
|
name: RULE_NAME4,
|
|
175
|
-
create
|
|
176
|
-
const { importSource = "react" } = getSettingsFromContext(context);
|
|
177
|
-
function isFromReact(node, initialScope) {
|
|
178
|
-
const name3 = node.name;
|
|
179
|
-
switch (true) {
|
|
180
|
-
case (node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier):
|
|
181
|
-
return isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
182
|
-
case (node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier):
|
|
183
|
-
return isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
184
|
-
default:
|
|
185
|
-
return isInitializedFromReact(name3, importSource, initialScope);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function visitorFunction(node) {
|
|
189
|
-
const shouldSkipDuplicate = node.parent.type === AST_NODE_TYPES.ImportSpecifier && node.parent.imported === node && node.parent.imported.name === node.parent.local.name;
|
|
190
|
-
if (shouldSkipDuplicate) return;
|
|
191
|
-
const name3 = node.name;
|
|
192
|
-
const initialScope = context.sourceCode.getScope(node);
|
|
193
|
-
if (!isFromReact(node, initialScope)) return;
|
|
194
|
-
context.report({
|
|
195
|
-
messageId: "isFromReact",
|
|
196
|
-
node,
|
|
197
|
-
data: {
|
|
198
|
-
type: node.type,
|
|
199
|
-
name: name3,
|
|
200
|
-
importSource
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
return {
|
|
205
|
-
Identifier: visitorFunction,
|
|
206
|
-
JSXIdentifier: visitorFunction
|
|
207
|
-
};
|
|
208
|
-
},
|
|
178
|
+
create: create4,
|
|
209
179
|
defaultOptions: []
|
|
210
180
|
});
|
|
181
|
+
function create4(context) {
|
|
182
|
+
const { importSource = "react" } = getSettingsFromContext(context);
|
|
183
|
+
function isFromReact(node, initialScope) {
|
|
184
|
+
const name3 = node.name;
|
|
185
|
+
switch (true) {
|
|
186
|
+
case (node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier):
|
|
187
|
+
return isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
188
|
+
case (node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier):
|
|
189
|
+
return isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
190
|
+
default:
|
|
191
|
+
return isInitializedFromReact(name3, importSource, initialScope);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function visitorFunction(node) {
|
|
195
|
+
const shouldSkipDuplicate = node.parent.type === AST_NODE_TYPES.ImportSpecifier && node.parent.imported === node && node.parent.imported.name === node.parent.local.name;
|
|
196
|
+
if (shouldSkipDuplicate) return;
|
|
197
|
+
const name3 = node.name;
|
|
198
|
+
const initialScope = context.sourceCode.getScope(node);
|
|
199
|
+
if (!isFromReact(node, initialScope)) return;
|
|
200
|
+
context.report({
|
|
201
|
+
messageId: "isFromReact",
|
|
202
|
+
node,
|
|
203
|
+
data: {
|
|
204
|
+
type: node.type,
|
|
205
|
+
name: name3,
|
|
206
|
+
importSource
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
Identifier: visitorFunction,
|
|
212
|
+
JSXIdentifier: visitorFunction
|
|
213
|
+
};
|
|
214
|
+
}
|
|
211
215
|
|
|
212
216
|
// src/plugin.ts
|
|
213
217
|
var plugin = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-debug",
|
|
3
|
-
"version": "1.34.0-next.
|
|
3
|
+
"version": "1.34.0-next.1",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for debugging related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"@typescript-eslint/utils": "^8.26.1",
|
|
50
50
|
"string-ts": "^2.2.1",
|
|
51
51
|
"ts-pattern": "^5.6.2",
|
|
52
|
-
"@eslint-react/ast": "1.34.0-next.
|
|
53
|
-
"@eslint-react/core": "1.34.0-next.
|
|
54
|
-
"@eslint-react/eff": "1.34.0-next.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/var": "1.34.0-next.
|
|
52
|
+
"@eslint-react/ast": "1.34.0-next.1",
|
|
53
|
+
"@eslint-react/core": "1.34.0-next.1",
|
|
54
|
+
"@eslint-react/eff": "1.34.0-next.1",
|
|
55
|
+
"@eslint-react/jsx": "1.34.0-next.1",
|
|
56
|
+
"@eslint-react/shared": "1.34.0-next.1",
|
|
57
|
+
"@eslint-react/var": "1.34.0-next.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/react": "^19.0.10",
|