eslint-plugin-react-debug 1.24.0-next.9 → 1.24.1-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 +8 -17
- package/dist/index.mjs +9 -18
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var utils = require('@typescript-eslint/utils');
|
|
|
6
6
|
|
|
7
7
|
// package.json
|
|
8
8
|
var name = "eslint-plugin-react-debug";
|
|
9
|
-
var version = "1.24.
|
|
9
|
+
var version = "1.24.1-beta.1";
|
|
10
10
|
var createRule = shared.createRuleForPlugin("debug");
|
|
11
11
|
|
|
12
12
|
// src/rules/class-component.ts
|
|
@@ -18,7 +18,6 @@ var class_component_default = createRule({
|
|
|
18
18
|
meta: {
|
|
19
19
|
type: "problem",
|
|
20
20
|
docs: {
|
|
21
|
-
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
22
21
|
description: "report all class components, including anonymous ones",
|
|
23
22
|
[Symbol.for("rule_features")]: RULE_FEATURES
|
|
24
23
|
},
|
|
@@ -56,7 +55,6 @@ var function_component_default = createRule({
|
|
|
56
55
|
meta: {
|
|
57
56
|
type: "problem",
|
|
58
57
|
docs: {
|
|
59
|
-
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
60
58
|
description: "report all function components, including anonymous ones",
|
|
61
59
|
[Symbol.for("rule_features")]: RULE_FEATURES2
|
|
62
60
|
},
|
|
@@ -86,9 +84,9 @@ var function_component_default = createRule({
|
|
|
86
84
|
data: {
|
|
87
85
|
name: name2,
|
|
88
86
|
displayName: displayName != null ? context.sourceCode.getText(displayName) : "none",
|
|
89
|
-
forwardRef: (flag & core.
|
|
87
|
+
forwardRef: (flag & core.ERComponentFlag.ForwardRef) > 0n,
|
|
90
88
|
hookCalls: hookCalls.length,
|
|
91
|
-
memo: (flag & core.
|
|
89
|
+
memo: (flag & core.ERComponentFlag.Memo) > 0n
|
|
92
90
|
}
|
|
93
91
|
});
|
|
94
92
|
}
|
|
@@ -105,7 +103,6 @@ var hook_default = createRule({
|
|
|
105
103
|
meta: {
|
|
106
104
|
type: "problem",
|
|
107
105
|
docs: {
|
|
108
|
-
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
109
106
|
description: "report all React Hooks",
|
|
110
107
|
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
111
108
|
},
|
|
@@ -144,7 +141,6 @@ var is_from_react_default = createRule({
|
|
|
144
141
|
meta: {
|
|
145
142
|
type: "problem",
|
|
146
143
|
docs: {
|
|
147
|
-
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
148
144
|
description: "report all identifiers that are initialized from React.",
|
|
149
145
|
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
150
146
|
},
|
|
@@ -155,20 +151,16 @@ var is_from_react_default = createRule({
|
|
|
155
151
|
},
|
|
156
152
|
name: RULE_NAME4,
|
|
157
153
|
create(context) {
|
|
158
|
-
const
|
|
159
|
-
importSource: "react",
|
|
160
|
-
...shared.getSettingsFromContext(context),
|
|
161
|
-
strictImportCheck: true
|
|
162
|
-
};
|
|
154
|
+
const { importSource = "react" } = shared.getSettingsFromContext(context);
|
|
163
155
|
function isFromReact(node, initialScope) {
|
|
164
156
|
const name2 = node.name;
|
|
165
157
|
switch (true) {
|
|
166
158
|
case (node.parent.type === utils.AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === utils.AST_NODE_TYPES.Identifier):
|
|
167
|
-
return core.isInitializedFromReact(node.parent.object.name,
|
|
159
|
+
return core.isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
168
160
|
case (node.parent.type === utils.AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === utils.AST_NODE_TYPES.JSXIdentifier):
|
|
169
|
-
return core.isInitializedFromReact(node.parent.object.name,
|
|
161
|
+
return core.isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
170
162
|
default:
|
|
171
|
-
return core.isInitializedFromReact(name2,
|
|
163
|
+
return core.isInitializedFromReact(name2, importSource, initialScope);
|
|
172
164
|
}
|
|
173
165
|
}
|
|
174
166
|
function visitorFunction(node) {
|
|
@@ -185,10 +177,9 @@ var is_from_react_default = createRule({
|
|
|
185
177
|
messageId: "isFromReact",
|
|
186
178
|
node,
|
|
187
179
|
data: {
|
|
188
|
-
// eslint-disable-next-line eslint-plugin/no-unused-placeholders
|
|
189
180
|
type: node.type,
|
|
190
181
|
name: name2,
|
|
191
|
-
importSource
|
|
182
|
+
importSource
|
|
192
183
|
}
|
|
193
184
|
});
|
|
194
185
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useComponentCollectorLegacy, useComponentCollector, DEFAULT_COMPONENT_HINT,
|
|
1
|
+
import { useComponentCollectorLegacy, useComponentCollector, DEFAULT_COMPONENT_HINT, ERComponentFlag, useHookCollector, isInitializedFromReact } from '@eslint-react/core';
|
|
2
2
|
import { createRuleForPlugin, getSettingsFromContext } from '@eslint-react/shared';
|
|
3
3
|
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
6
|
var name = "eslint-plugin-react-debug";
|
|
7
|
-
var version = "1.24.
|
|
7
|
+
var version = "1.24.1-beta.1";
|
|
8
8
|
var createRule = createRuleForPlugin("debug");
|
|
9
9
|
|
|
10
10
|
// src/rules/class-component.ts
|
|
@@ -16,7 +16,6 @@ var class_component_default = createRule({
|
|
|
16
16
|
meta: {
|
|
17
17
|
type: "problem",
|
|
18
18
|
docs: {
|
|
19
|
-
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
20
19
|
description: "report all class components, including anonymous ones",
|
|
21
20
|
[Symbol.for("rule_features")]: RULE_FEATURES
|
|
22
21
|
},
|
|
@@ -54,7 +53,6 @@ var function_component_default = createRule({
|
|
|
54
53
|
meta: {
|
|
55
54
|
type: "problem",
|
|
56
55
|
docs: {
|
|
57
|
-
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
58
56
|
description: "report all function components, including anonymous ones",
|
|
59
57
|
[Symbol.for("rule_features")]: RULE_FEATURES2
|
|
60
58
|
},
|
|
@@ -84,9 +82,9 @@ var function_component_default = createRule({
|
|
|
84
82
|
data: {
|
|
85
83
|
name: name2,
|
|
86
84
|
displayName: displayName != null ? context.sourceCode.getText(displayName) : "none",
|
|
87
|
-
forwardRef: (flag &
|
|
85
|
+
forwardRef: (flag & ERComponentFlag.ForwardRef) > 0n,
|
|
88
86
|
hookCalls: hookCalls.length,
|
|
89
|
-
memo: (flag &
|
|
87
|
+
memo: (flag & ERComponentFlag.Memo) > 0n
|
|
90
88
|
}
|
|
91
89
|
});
|
|
92
90
|
}
|
|
@@ -103,7 +101,6 @@ var hook_default = createRule({
|
|
|
103
101
|
meta: {
|
|
104
102
|
type: "problem",
|
|
105
103
|
docs: {
|
|
106
|
-
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
107
104
|
description: "report all React Hooks",
|
|
108
105
|
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
109
106
|
},
|
|
@@ -142,7 +139,6 @@ var is_from_react_default = createRule({
|
|
|
142
139
|
meta: {
|
|
143
140
|
type: "problem",
|
|
144
141
|
docs: {
|
|
145
|
-
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
146
142
|
description: "report all identifiers that are initialized from React.",
|
|
147
143
|
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
148
144
|
},
|
|
@@ -153,20 +149,16 @@ var is_from_react_default = createRule({
|
|
|
153
149
|
},
|
|
154
150
|
name: RULE_NAME4,
|
|
155
151
|
create(context) {
|
|
156
|
-
const
|
|
157
|
-
importSource: "react",
|
|
158
|
-
...getSettingsFromContext(context),
|
|
159
|
-
strictImportCheck: true
|
|
160
|
-
};
|
|
152
|
+
const { importSource = "react" } = getSettingsFromContext(context);
|
|
161
153
|
function isFromReact(node, initialScope) {
|
|
162
154
|
const name2 = node.name;
|
|
163
155
|
switch (true) {
|
|
164
156
|
case (node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier):
|
|
165
|
-
return isInitializedFromReact(node.parent.object.name,
|
|
157
|
+
return isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
166
158
|
case (node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier):
|
|
167
|
-
return isInitializedFromReact(node.parent.object.name,
|
|
159
|
+
return isInitializedFromReact(node.parent.object.name, importSource, initialScope);
|
|
168
160
|
default:
|
|
169
|
-
return isInitializedFromReact(name2,
|
|
161
|
+
return isInitializedFromReact(name2, importSource, initialScope);
|
|
170
162
|
}
|
|
171
163
|
}
|
|
172
164
|
function visitorFunction(node) {
|
|
@@ -183,10 +175,9 @@ var is_from_react_default = createRule({
|
|
|
183
175
|
messageId: "isFromReact",
|
|
184
176
|
node,
|
|
185
177
|
data: {
|
|
186
|
-
// eslint-disable-next-line eslint-plugin/no-unused-placeholders
|
|
187
178
|
type: node.type,
|
|
188
179
|
name: name2,
|
|
189
|
-
importSource
|
|
180
|
+
importSource
|
|
190
181
|
}
|
|
191
182
|
});
|
|
192
183
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-debug",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.1-beta.1",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for debugging related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
"./package.json"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
45
|
-
"@typescript-eslint/type-utils": "^8.
|
|
46
|
-
"@typescript-eslint/types": "^8.
|
|
47
|
-
"@typescript-eslint/utils": "^8.
|
|
44
|
+
"@typescript-eslint/scope-manager": "^8.21.0",
|
|
45
|
+
"@typescript-eslint/type-utils": "^8.21.0",
|
|
46
|
+
"@typescript-eslint/types": "^8.21.0",
|
|
47
|
+
"@typescript-eslint/utils": "^8.21.0",
|
|
48
48
|
"string-ts": "^2.2.0",
|
|
49
|
-
"ts-pattern": "^5.6.
|
|
50
|
-
"@eslint-react/ast": "1.24.
|
|
51
|
-
"@eslint-react/core": "1.24.
|
|
52
|
-
"@eslint-react/eff": "1.24.
|
|
53
|
-
"@eslint-react/jsx": "1.24.
|
|
54
|
-
"@eslint-react/shared": "1.24.
|
|
55
|
-
"@eslint-react/var": "1.24.
|
|
49
|
+
"ts-pattern": "^5.6.2",
|
|
50
|
+
"@eslint-react/ast": "1.24.1-beta.1",
|
|
51
|
+
"@eslint-react/core": "1.24.1-beta.1",
|
|
52
|
+
"@eslint-react/eff": "1.24.1-beta.1",
|
|
53
|
+
"@eslint-react/jsx": "1.24.1-beta.1",
|
|
54
|
+
"@eslint-react/shared": "1.24.1-beta.1",
|
|
55
|
+
"@eslint-react/var": "1.24.1-beta.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/react": "^19.0.7",
|