eslint-plugin-react-debug 1.23.3-next.7 → 1.24.0-beta.0
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 +13 -13
- package/dist/index.mjs +13 -13
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@eslint-react/core');
|
|
4
|
-
var eff = require('@eslint-react/eff');
|
|
5
4
|
var shared = require('@eslint-react/shared');
|
|
6
5
|
var utils = require('@typescript-eslint/utils');
|
|
7
6
|
|
|
8
7
|
// package.json
|
|
9
8
|
var name = "eslint-plugin-react-debug";
|
|
10
|
-
var version = "1.
|
|
9
|
+
var version = "1.24.0-beta.0";
|
|
11
10
|
var createRule = shared.createRuleForPlugin("debug");
|
|
12
11
|
|
|
13
12
|
// src/rules/class-component.ts
|
|
@@ -35,12 +34,12 @@ var class_component_default = createRule({
|
|
|
35
34
|
...listeners,
|
|
36
35
|
"Program:exit"(node) {
|
|
37
36
|
const components = ctx.getAllComponents(node);
|
|
38
|
-
for (const { name: name2, node: component } of components.values()) {
|
|
37
|
+
for (const { name: name2 = "anonymous", node: component } of components.values()) {
|
|
39
38
|
context.report({
|
|
40
39
|
messageId: "classComponent",
|
|
41
40
|
node: component,
|
|
42
41
|
data: {
|
|
43
|
-
name:
|
|
42
|
+
name: name2
|
|
44
43
|
}
|
|
45
44
|
});
|
|
46
45
|
}
|
|
@@ -73,12 +72,12 @@ var function_component_default = createRule({
|
|
|
73
72
|
...listeners,
|
|
74
73
|
"Program:exit"(node) {
|
|
75
74
|
const components = ctx.getAllComponents(node);
|
|
76
|
-
for (const { name: name2, node: node2, flag, hookCalls } of components.values()) {
|
|
75
|
+
for (const { name: name2 = "anonymous", node: node2, flag, hookCalls } of components.values()) {
|
|
77
76
|
context.report({
|
|
78
77
|
messageId: "functionComponent",
|
|
79
78
|
node: node2,
|
|
80
79
|
data: {
|
|
81
|
-
name:
|
|
80
|
+
name: name2,
|
|
82
81
|
forwardRef: (flag & core.ERFunctionComponentFlag.ForwardRef) > 0n,
|
|
83
82
|
hookCalls: hookCalls.length,
|
|
84
83
|
memo: (flag & core.ERFunctionComponentFlag.Memo) > 0n
|
|
@@ -119,7 +118,7 @@ var hook_default = createRule({
|
|
|
119
118
|
messageId: "hook",
|
|
120
119
|
node: node2,
|
|
121
120
|
data: {
|
|
122
|
-
name: name2
|
|
121
|
+
name: name2,
|
|
123
122
|
hookCalls: hookCalls.length
|
|
124
123
|
}
|
|
125
124
|
});
|
|
@@ -164,20 +163,21 @@ var is_from_react_default = createRule({
|
|
|
164
163
|
return core.isInitializedFromReact(name2, initialScope, settings.importSource);
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
|
-
function
|
|
166
|
+
function visitorFunction(node) {
|
|
168
167
|
const shouldSkipDuplicate = node.parent.type === utils.AST_NODE_TYPES.ImportSpecifier && node.parent.imported === node && node.parent.imported.name === node.parent.local.name;
|
|
169
168
|
if (shouldSkipDuplicate) {
|
|
170
|
-
return
|
|
169
|
+
return;
|
|
171
170
|
}
|
|
172
171
|
const name2 = node.name;
|
|
173
172
|
const initialScope = context.sourceCode.getScope(node);
|
|
174
173
|
if (!isFromReact(node, initialScope)) {
|
|
175
|
-
return
|
|
174
|
+
return;
|
|
176
175
|
}
|
|
177
|
-
|
|
176
|
+
context.report({
|
|
178
177
|
messageId: "isFromReact",
|
|
179
178
|
node,
|
|
180
179
|
data: {
|
|
180
|
+
// eslint-disable-next-line eslint-plugin/no-unused-placeholders
|
|
181
181
|
type: node.type,
|
|
182
182
|
name: name2,
|
|
183
183
|
importSource: settings.importSource
|
|
@@ -185,8 +185,8 @@ var is_from_react_default = createRule({
|
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
return {
|
|
188
|
-
Identifier:
|
|
189
|
-
JSXIdentifier:
|
|
188
|
+
Identifier: visitorFunction,
|
|
189
|
+
JSXIdentifier: visitorFunction
|
|
190
190
|
};
|
|
191
191
|
},
|
|
192
192
|
defaultOptions: []
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useComponentCollectorLegacy, useComponentCollector, ERFunctionComponentFlag, useHookCollector, isInitializedFromReact } from '@eslint-react/core';
|
|
2
|
-
import { O, F } from '@eslint-react/eff';
|
|
3
2
|
import { createRuleForPlugin, getSettingsFromContext } from '@eslint-react/shared';
|
|
4
3
|
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
5
4
|
|
|
6
5
|
// package.json
|
|
7
6
|
var name = "eslint-plugin-react-debug";
|
|
8
|
-
var version = "1.
|
|
7
|
+
var version = "1.24.0-beta.0";
|
|
9
8
|
var createRule = createRuleForPlugin("debug");
|
|
10
9
|
|
|
11
10
|
// src/rules/class-component.ts
|
|
@@ -33,12 +32,12 @@ var class_component_default = createRule({
|
|
|
33
32
|
...listeners,
|
|
34
33
|
"Program:exit"(node) {
|
|
35
34
|
const components = ctx.getAllComponents(node);
|
|
36
|
-
for (const { name: name2, node: component } of components.values()) {
|
|
35
|
+
for (const { name: name2 = "anonymous", node: component } of components.values()) {
|
|
37
36
|
context.report({
|
|
38
37
|
messageId: "classComponent",
|
|
39
38
|
node: component,
|
|
40
39
|
data: {
|
|
41
|
-
name:
|
|
40
|
+
name: name2
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
43
|
}
|
|
@@ -71,12 +70,12 @@ var function_component_default = createRule({
|
|
|
71
70
|
...listeners,
|
|
72
71
|
"Program:exit"(node) {
|
|
73
72
|
const components = ctx.getAllComponents(node);
|
|
74
|
-
for (const { name: name2, node: node2, flag, hookCalls } of components.values()) {
|
|
73
|
+
for (const { name: name2 = "anonymous", node: node2, flag, hookCalls } of components.values()) {
|
|
75
74
|
context.report({
|
|
76
75
|
messageId: "functionComponent",
|
|
77
76
|
node: node2,
|
|
78
77
|
data: {
|
|
79
|
-
name:
|
|
78
|
+
name: name2,
|
|
80
79
|
forwardRef: (flag & ERFunctionComponentFlag.ForwardRef) > 0n,
|
|
81
80
|
hookCalls: hookCalls.length,
|
|
82
81
|
memo: (flag & ERFunctionComponentFlag.Memo) > 0n
|
|
@@ -117,7 +116,7 @@ var hook_default = createRule({
|
|
|
117
116
|
messageId: "hook",
|
|
118
117
|
node: node2,
|
|
119
118
|
data: {
|
|
120
|
-
name: name2
|
|
119
|
+
name: name2,
|
|
121
120
|
hookCalls: hookCalls.length
|
|
122
121
|
}
|
|
123
122
|
});
|
|
@@ -162,20 +161,21 @@ var is_from_react_default = createRule({
|
|
|
162
161
|
return isInitializedFromReact(name2, initialScope, settings.importSource);
|
|
163
162
|
}
|
|
164
163
|
}
|
|
165
|
-
function
|
|
164
|
+
function visitorFunction(node) {
|
|
166
165
|
const shouldSkipDuplicate = node.parent.type === AST_NODE_TYPES.ImportSpecifier && node.parent.imported === node && node.parent.imported.name === node.parent.local.name;
|
|
167
166
|
if (shouldSkipDuplicate) {
|
|
168
|
-
return
|
|
167
|
+
return;
|
|
169
168
|
}
|
|
170
169
|
const name2 = node.name;
|
|
171
170
|
const initialScope = context.sourceCode.getScope(node);
|
|
172
171
|
if (!isFromReact(node, initialScope)) {
|
|
173
|
-
return
|
|
172
|
+
return;
|
|
174
173
|
}
|
|
175
|
-
|
|
174
|
+
context.report({
|
|
176
175
|
messageId: "isFromReact",
|
|
177
176
|
node,
|
|
178
177
|
data: {
|
|
178
|
+
// eslint-disable-next-line eslint-plugin/no-unused-placeholders
|
|
179
179
|
type: node.type,
|
|
180
180
|
name: name2,
|
|
181
181
|
importSource: settings.importSource
|
|
@@ -183,8 +183,8 @@ var is_from_react_default = createRule({
|
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
return {
|
|
186
|
-
Identifier:
|
|
187
|
-
JSXIdentifier:
|
|
186
|
+
Identifier: visitorFunction,
|
|
187
|
+
JSXIdentifier: visitorFunction
|
|
188
188
|
};
|
|
189
189
|
},
|
|
190
190
|
defaultOptions: []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-debug",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0-beta.0",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for debugging related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"eslint-plugin",
|
|
11
11
|
"eslint-plugin-react-debug"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://github.com/
|
|
13
|
+
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/
|
|
15
|
+
"url": "https://github.com/Rel1cx/eslint-react/issues"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git+https://github.com/
|
|
19
|
+
"url": "git+https://github.com/Rel1cx/eslint-react.git",
|
|
20
20
|
"directory": "packages/plugins/eslint-plugin-react-debug"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@typescript-eslint/utils": "^8.19.1",
|
|
48
48
|
"string-ts": "^2.2.0",
|
|
49
49
|
"ts-pattern": "^5.6.0",
|
|
50
|
-
"@eslint-react/ast": "1.
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/jsx": "1.
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/var": "1.
|
|
50
|
+
"@eslint-react/ast": "1.24.0-beta.0",
|
|
51
|
+
"@eslint-react/eff": "1.24.0-beta.0",
|
|
52
|
+
"@eslint-react/core": "1.24.0-beta.0",
|
|
53
|
+
"@eslint-react/jsx": "1.24.0-beta.0",
|
|
54
|
+
"@eslint-react/shared": "1.24.0-beta.0",
|
|
55
|
+
"@eslint-react/types": "1.24.0-beta.0",
|
|
56
|
+
"@eslint-react/var": "1.24.0-beta.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/react": "^19.0.4",
|