eslint-plugin-react-debug 2.7.2-next.2 → 2.7.2-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 +35 -44
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, getConfigAdapters, getSettingsFromContext, report } from "@eslint-react/shared";
|
|
1
|
+
import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener, getConfigAdapters, getSettingsFromContext, report } from "@eslint-react/shared";
|
|
2
2
|
import { ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, isInitializedFromReact, isJsxFragmentElement, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
|
|
3
3
|
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
4
4
|
import { flow } from "@eslint-react/eff";
|
|
@@ -41,7 +41,7 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
|
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region package.json
|
|
43
43
|
var name = "eslint-plugin-react-debug";
|
|
44
|
-
var version = "2.7.2-next.
|
|
44
|
+
var version = "2.7.2-next.4";
|
|
45
45
|
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/utils/create-rule.ts
|
|
@@ -71,17 +71,14 @@ var class_component_default = createRule({
|
|
|
71
71
|
defaultOptions: []
|
|
72
72
|
});
|
|
73
73
|
function create$4(context) {
|
|
74
|
-
const { ctx,
|
|
75
|
-
return {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
};
|
|
74
|
+
const { ctx, visitors } = useComponentCollectorLegacy(context);
|
|
75
|
+
return defineRuleListener(visitors, { "Program:exit"(program) {
|
|
76
|
+
for (const { name: name$2 = "anonymous", node: component } of ctx.getAllComponents(program)) context.report({
|
|
77
|
+
messageId: "classComponent",
|
|
78
|
+
node: component,
|
|
79
|
+
data: { json: stringify({ name: name$2 }) }
|
|
80
|
+
});
|
|
81
|
+
} });
|
|
85
82
|
}
|
|
86
83
|
|
|
87
84
|
//#endregion
|
|
@@ -99,27 +96,24 @@ var function_component_default = createRule({
|
|
|
99
96
|
defaultOptions: []
|
|
100
97
|
});
|
|
101
98
|
function create$3(context) {
|
|
102
|
-
const { ctx,
|
|
99
|
+
const { ctx, visitors } = useComponentCollector(context, {
|
|
103
100
|
collectDisplayName: true,
|
|
104
101
|
collectHookCalls: true,
|
|
105
102
|
hint: DEFAULT_COMPONENT_DETECTION_HINT
|
|
106
103
|
});
|
|
107
|
-
return {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
};
|
|
104
|
+
return defineRuleListener(visitors, { "Program:exit"(program) {
|
|
105
|
+
for (const { name: name$2 = "anonymous", node, displayName, flag, hookCalls } of ctx.getAllComponents(program)) context.report({
|
|
106
|
+
messageId: "functionComponent",
|
|
107
|
+
node,
|
|
108
|
+
data: { json: stringify({
|
|
109
|
+
name: name$2,
|
|
110
|
+
displayName: displayName == null ? "none" : context.sourceCode.getText(displayName),
|
|
111
|
+
forwardRef: (flag & ComponentFlag.ForwardRef) > 0n,
|
|
112
|
+
hookCalls: hookCalls.length,
|
|
113
|
+
memo: (flag & ComponentFlag.Memo) > 0n
|
|
114
|
+
}) }
|
|
115
|
+
});
|
|
116
|
+
} });
|
|
123
117
|
}
|
|
124
118
|
|
|
125
119
|
//#endregion
|
|
@@ -137,20 +131,17 @@ var hook_default = createRule({
|
|
|
137
131
|
defaultOptions: []
|
|
138
132
|
});
|
|
139
133
|
function create$2(context) {
|
|
140
|
-
const { ctx,
|
|
141
|
-
return {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
};
|
|
134
|
+
const { ctx, visitors } = useHookCollector(context);
|
|
135
|
+
return defineRuleListener(visitors, { "Program:exit"(program) {
|
|
136
|
+
for (const { name: name$2, node, hookCalls } of ctx.getAllHooks(program)) context.report({
|
|
137
|
+
messageId: "hook",
|
|
138
|
+
node,
|
|
139
|
+
data: { json: stringify({
|
|
140
|
+
name: name$2,
|
|
141
|
+
hookCalls: hookCalls.length
|
|
142
|
+
}) }
|
|
143
|
+
});
|
|
144
|
+
} });
|
|
154
145
|
}
|
|
155
146
|
|
|
156
147
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-debug",
|
|
3
|
-
"version": "2.7.2-next.
|
|
3
|
+
"version": "2.7.2-next.4",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for debugging related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@typescript-eslint/utils": "^8.53.0",
|
|
45
45
|
"string-ts": "^2.3.1",
|
|
46
46
|
"ts-pattern": "^5.9.0",
|
|
47
|
-
"@eslint-react/ast": "2.7.2-next.
|
|
48
|
-
"@eslint-react/core": "2.7.2-next.
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
47
|
+
"@eslint-react/ast": "2.7.2-next.4",
|
|
48
|
+
"@eslint-react/core": "2.7.2-next.4",
|
|
49
|
+
"@eslint-react/eff": "2.7.2-next.4",
|
|
50
|
+
"@eslint-react/var": "2.7.2-next.4",
|
|
51
|
+
"@eslint-react/shared": "2.7.2-next.4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/react": "^19.2.8",
|