eslint-plugin-react-debug 2.0.1-next.3 → 2.0.1-next.4
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 -12
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_ESLINT_REACT_SETTINGS, getConfigAdapters, getDocsUrl, getSettingsFromContext } from "@eslint-react/shared";
|
|
2
|
-
import
|
|
3
|
-
import { JsxEmit, getElementType, getJsxConfigFromAnnotation, getJsxConfigFromContext, isFragmentElement } from "@eslint-react/core";
|
|
2
|
+
import { ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, getElementType, getJsxConfigFromAnnotation, getJsxConfigFromContext, isFragmentElement, isInitializedFromReact, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
|
|
4
3
|
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
5
4
|
import { flow } from "@eslint-react/eff";
|
|
6
5
|
import { report } from "@eslint-react/kit";
|
|
@@ -38,7 +37,7 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
|
|
|
38
37
|
//#endregion
|
|
39
38
|
//#region package.json
|
|
40
39
|
var name = "eslint-plugin-react-debug";
|
|
41
|
-
var version = "2.0.1-next.
|
|
40
|
+
var version = "2.0.1-next.4";
|
|
42
41
|
|
|
43
42
|
//#endregion
|
|
44
43
|
//#region src/utils/create-rule.ts
|
|
@@ -69,7 +68,7 @@ var class_component_default = createRule({
|
|
|
69
68
|
defaultOptions: []
|
|
70
69
|
});
|
|
71
70
|
function create$4(context) {
|
|
72
|
-
const { ctx, listeners } =
|
|
71
|
+
const { ctx, listeners } = useComponentCollectorLegacy();
|
|
73
72
|
return {
|
|
74
73
|
...listeners,
|
|
75
74
|
"Program:exit"(program) {
|
|
@@ -102,10 +101,10 @@ var function_component_default = createRule({
|
|
|
102
101
|
defaultOptions: []
|
|
103
102
|
});
|
|
104
103
|
function create$3(context) {
|
|
105
|
-
const { ctx, listeners } =
|
|
104
|
+
const { ctx, listeners } = useComponentCollector(context, {
|
|
106
105
|
collectDisplayName: true,
|
|
107
106
|
collectHookCalls: true,
|
|
108
|
-
hint:
|
|
107
|
+
hint: DEFAULT_COMPONENT_DETECTION_HINT
|
|
109
108
|
});
|
|
110
109
|
return {
|
|
111
110
|
...listeners,
|
|
@@ -117,9 +116,9 @@ function create$3(context) {
|
|
|
117
116
|
data: { json: stringify({
|
|
118
117
|
name: name$2,
|
|
119
118
|
displayName: displayName == null ? "none" : context.sourceCode.getText(displayName),
|
|
120
|
-
forwardRef: (flag &
|
|
119
|
+
forwardRef: (flag & ComponentFlag.ForwardRef) > 0n,
|
|
121
120
|
hookCalls: hookCalls.length,
|
|
122
|
-
memo: (flag &
|
|
121
|
+
memo: (flag & ComponentFlag.Memo) > 0n
|
|
123
122
|
}) }
|
|
124
123
|
});
|
|
125
124
|
}
|
|
@@ -145,7 +144,7 @@ var hook_default = createRule({
|
|
|
145
144
|
defaultOptions: []
|
|
146
145
|
});
|
|
147
146
|
function create$2(context) {
|
|
148
|
-
const { ctx, listeners } =
|
|
147
|
+
const { ctx, listeners } = useHookCollector();
|
|
149
148
|
return {
|
|
150
149
|
...listeners,
|
|
151
150
|
"Program:exit"(program) {
|
|
@@ -211,9 +210,9 @@ function create$1(context) {
|
|
|
211
210
|
function isFromReact(node, importSource, initialScope) {
|
|
212
211
|
const name$2 = node.name;
|
|
213
212
|
switch (true) {
|
|
214
|
-
case node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier: return
|
|
215
|
-
case node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier: return
|
|
216
|
-
default: return
|
|
213
|
+
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, importSource, initialScope);
|
|
214
|
+
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, importSource, initialScope);
|
|
215
|
+
default: return isInitializedFromReact(name$2, importSource, initialScope);
|
|
217
216
|
}
|
|
218
217
|
}
|
|
219
218
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-debug",
|
|
3
|
-
"version": "2.0.1-next.
|
|
3
|
+
"version": "2.0.1-next.4",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for debugging related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@typescript-eslint/utils": "^8.44.1",
|
|
42
42
|
"string-ts": "^2.2.1",
|
|
43
43
|
"ts-pattern": "^5.8.0",
|
|
44
|
-
"@eslint-react/ast": "2.0.1-next.
|
|
45
|
-
"@eslint-react/eff": "2.0.1-next.
|
|
46
|
-
"@eslint-react/kit": "2.0.1-next.
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/var": "2.0.1-next.
|
|
44
|
+
"@eslint-react/ast": "2.0.1-next.4",
|
|
45
|
+
"@eslint-react/eff": "2.0.1-next.4",
|
|
46
|
+
"@eslint-react/kit": "2.0.1-next.4",
|
|
47
|
+
"@eslint-react/shared": "2.0.1-next.4",
|
|
48
|
+
"@eslint-react/core": "2.0.1-next.4",
|
|
49
|
+
"@eslint-react/var": "2.0.1-next.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/react": "^19.1.14",
|