eslint-plugin-react-debug 2.8.1 → 2.8.2-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 +16 -15
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener, getConfigAdapters, getSettingsFromContext, report } from "@eslint-react/shared";
|
|
2
|
-
import
|
|
2
|
+
import * as core from "@eslint-react/core";
|
|
3
3
|
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
4
4
|
import { flow } from "@eslint-react/eff";
|
|
5
5
|
import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from "@typescript-eslint/types";
|
|
@@ -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.8.1";
|
|
44
|
+
var version = "2.8.2-beta.1";
|
|
45
45
|
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/utils/create-rule.ts
|
|
@@ -71,7 +71,7 @@ var class_component_default = createRule({
|
|
|
71
71
|
defaultOptions: []
|
|
72
72
|
});
|
|
73
73
|
function create$4(context) {
|
|
74
|
-
const { ctx, visitor } = useComponentCollectorLegacy(context);
|
|
74
|
+
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
75
75
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
76
76
|
for (const { name = "anonymous", node: component } of ctx.getAllComponents(program)) context.report({
|
|
77
77
|
messageId: "classComponent",
|
|
@@ -96,9 +96,9 @@ var function_component_default = createRule({
|
|
|
96
96
|
defaultOptions: []
|
|
97
97
|
});
|
|
98
98
|
function create$3(context) {
|
|
99
|
-
const { ctx, visitor } = useComponentCollector(context, {
|
|
99
|
+
const { ctx, visitor } = core.useComponentCollector(context, {
|
|
100
100
|
collectDisplayName: true,
|
|
101
|
-
hint: DEFAULT_COMPONENT_DETECTION_HINT
|
|
101
|
+
hint: core.DEFAULT_COMPONENT_DETECTION_HINT
|
|
102
102
|
});
|
|
103
103
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
104
104
|
for (const { name = "anonymous", node, displayName, flag, hookCalls } of ctx.getAllComponents(program)) context.report({
|
|
@@ -107,9 +107,9 @@ function create$3(context) {
|
|
|
107
107
|
data: { json: stringify({
|
|
108
108
|
name,
|
|
109
109
|
displayName: displayName == null ? "none" : context.sourceCode.getText(displayName),
|
|
110
|
-
forwardRef: (flag & ComponentFlag.ForwardRef) > 0n,
|
|
110
|
+
forwardRef: (flag & core.ComponentFlag.ForwardRef) > 0n,
|
|
111
111
|
hookCalls: hookCalls.length,
|
|
112
|
-
memo: (flag & ComponentFlag.Memo) > 0n
|
|
112
|
+
memo: (flag & core.ComponentFlag.Memo) > 0n
|
|
113
113
|
}) }
|
|
114
114
|
});
|
|
115
115
|
} });
|
|
@@ -130,7 +130,7 @@ var hook_default = createRule({
|
|
|
130
130
|
defaultOptions: []
|
|
131
131
|
});
|
|
132
132
|
function create$2(context) {
|
|
133
|
-
const { ctx, visitor } = useHookCollector(context);
|
|
133
|
+
const { ctx, visitor } = core.useHookCollector(context);
|
|
134
134
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
135
135
|
for (const { name, node, hookCalls } of ctx.getAllHooks(program)) context.report({
|
|
136
136
|
messageId: "hook",
|
|
@@ -187,14 +187,15 @@ function create$1(context) {
|
|
|
187
187
|
function isFromReact(node, initialScope, importSource = "react") {
|
|
188
188
|
const name = node.name;
|
|
189
189
|
switch (true) {
|
|
190
|
-
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, initialScope, importSource);
|
|
191
|
-
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, initialScope, importSource);
|
|
192
|
-
default: return isInitializedFromReact(name, initialScope, importSource);
|
|
190
|
+
case node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier: return core.isInitializedFromReact(node.parent.object.name, initialScope, importSource);
|
|
191
|
+
case node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier: return core.isInitializedFromReact(node.parent.object.name, initialScope, importSource);
|
|
192
|
+
default: return core.isInitializedFromReact(name, initialScope, importSource);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
//#endregion
|
|
197
197
|
//#region src/rules/jsx.ts
|
|
198
|
+
const { JsxEmit } = core;
|
|
198
199
|
const RULE_NAME = "jsx";
|
|
199
200
|
var jsx_default = createRule({
|
|
200
201
|
meta: {
|
|
@@ -208,8 +209,8 @@ var jsx_default = createRule({
|
|
|
208
209
|
defaultOptions: []
|
|
209
210
|
});
|
|
210
211
|
function create(context) {
|
|
211
|
-
const jsxConfigFromContext = getJsxConfigFromContext(context);
|
|
212
|
-
const jsxConfigFromAnnotation = getJsxConfigFromAnnotation(context);
|
|
212
|
+
const jsxConfigFromContext = core.getJsxConfigFromContext(context);
|
|
213
|
+
const jsxConfigFromAnnotation = core.getJsxConfigFromAnnotation(context);
|
|
213
214
|
const jsxConfig = {
|
|
214
215
|
...jsxConfigFromContext,
|
|
215
216
|
...jsxConfigFromAnnotation
|
|
@@ -219,8 +220,8 @@ function create(context) {
|
|
|
219
220
|
messageId: "jsx",
|
|
220
221
|
node,
|
|
221
222
|
data: { json: stringify({
|
|
222
|
-
kind: match(node).with({ type: AST_NODE_TYPES$1.JSXElement }, (n) => isJsxFragmentElement(context, n, jsxConfig) ? "fragment" : "element").with({ type: AST_NODE_TYPES$1.JSXFragment }, () => "fragment").exhaustive(),
|
|
223
|
-
type: getJsxElementType(context, node),
|
|
223
|
+
kind: match(node).with({ type: AST_NODE_TYPES$1.JSXElement }, (n) => core.isJsxFragmentElement(context, n, jsxConfig) ? "fragment" : "element").with({ type: AST_NODE_TYPES$1.JSXFragment }, () => "fragment").exhaustive(),
|
|
224
|
+
type: core.getJsxElementType(context, node),
|
|
224
225
|
jsx: match(jsxConfig.jsx).with(JsxEmit.None, () => "none").with(JsxEmit.ReactJSX, () => "react-jsx").with(JsxEmit.ReactJSXDev, () => "react-jsx-dev").with(JsxEmit.React, () => "react").with(JsxEmit.ReactNative, () => "react-native").with(JsxEmit.Preserve, () => "preserve").otherwise(() => "unknown"),
|
|
225
226
|
jsxFactory: jsxConfig.jsxFactory,
|
|
226
227
|
jsxFragmentFactory: jsxConfig.jsxFragmentFactory,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-debug",
|
|
3
|
-
"version": "2.8.1",
|
|
3
|
+
"version": "2.8.2-beta.1",
|
|
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.54.0",
|
|
45
45
|
"string-ts": "^2.3.1",
|
|
46
46
|
"ts-pattern": "^5.9.0",
|
|
47
|
-
"@eslint-react/ast": "2.8.1",
|
|
48
|
-
"@eslint-react/core": "2.8.1",
|
|
49
|
-
"@eslint-react/eff": "2.8.1",
|
|
50
|
-
"@eslint-react/shared": "2.8.1",
|
|
51
|
-
"@eslint-react/var": "2.8.1"
|
|
47
|
+
"@eslint-react/ast": "2.8.2-beta.1",
|
|
48
|
+
"@eslint-react/core": "2.8.2-beta.1",
|
|
49
|
+
"@eslint-react/eff": "2.8.2-beta.1",
|
|
50
|
+
"@eslint-react/shared": "2.8.2-beta.1",
|
|
51
|
+
"@eslint-react/var": "2.8.2-beta.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/react": "^19.2.10",
|