eslint-plugin-react-debug 1.26.3-next.2 → 1.26.3-next.21

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/README.md CHANGED
@@ -2,9 +2,6 @@
2
2
 
3
3
  Debugging rules.
4
4
 
5
- > [!NOTE]
6
- > This plugin is already included in `@eslint-react/eslint-plugin`. You don't need to install it separately if you are using `@eslint-react/eslint-plugin`.
7
-
8
5
  ## Install
9
6
 
10
7
  ```sh
package/dist/index.d.mts CHANGED
@@ -1,16 +1,41 @@
1
1
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
+ import { RulePreset } from '@eslint-react/shared';
2
3
 
3
4
  declare const _default: {
4
- readonly meta: {
5
+ configs: {
6
+ all: {
7
+ plugins: {
8
+ "react-debug": {
9
+ readonly meta: {
10
+ readonly name: string;
11
+ readonly version: string;
12
+ };
13
+ readonly rules: {
14
+ readonly "class-component": _typescript_eslint_utils_ts_eslint.RuleModule<"classComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
15
+ readonly "function-component": _typescript_eslint_utils_ts_eslint.RuleModule<"functionComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
16
+ readonly hook: _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
17
+ readonly "is-from-react": _typescript_eslint_utils_ts_eslint.RuleModule<"isFromReact", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
18
+ readonly "react-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
19
+ };
20
+ };
21
+ };
22
+ name: string;
23
+ rules: RulePreset;
24
+ };
25
+ "all-legacy": {
26
+ plugins: string[];
27
+ rules: RulePreset;
28
+ };
29
+ };
30
+ meta: {
5
31
  readonly name: string;
6
32
  readonly version: string;
7
33
  };
8
- readonly rules: {
34
+ rules: {
9
35
  readonly "class-component": _typescript_eslint_utils_ts_eslint.RuleModule<"classComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
10
36
  readonly "function-component": _typescript_eslint_utils_ts_eslint.RuleModule<"functionComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
11
37
  readonly hook: _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
12
38
  readonly "is-from-react": _typescript_eslint_utils_ts_eslint.RuleModule<"isFromReact", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
13
- /** @deprecated Use `hook` instead */
14
39
  readonly "react-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
15
40
  };
16
41
  };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,41 @@
1
1
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
+ import { RulePreset } from '@eslint-react/shared';
2
3
 
3
4
  declare const _default: {
4
- readonly meta: {
5
+ configs: {
6
+ all: {
7
+ plugins: {
8
+ "react-debug": {
9
+ readonly meta: {
10
+ readonly name: string;
11
+ readonly version: string;
12
+ };
13
+ readonly rules: {
14
+ readonly "class-component": _typescript_eslint_utils_ts_eslint.RuleModule<"classComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
15
+ readonly "function-component": _typescript_eslint_utils_ts_eslint.RuleModule<"functionComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
16
+ readonly hook: _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
17
+ readonly "is-from-react": _typescript_eslint_utils_ts_eslint.RuleModule<"isFromReact", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
18
+ readonly "react-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
19
+ };
20
+ };
21
+ };
22
+ name: string;
23
+ rules: RulePreset;
24
+ };
25
+ "all-legacy": {
26
+ plugins: string[];
27
+ rules: RulePreset;
28
+ };
29
+ };
30
+ meta: {
5
31
  readonly name: string;
6
32
  readonly version: string;
7
33
  };
8
- readonly rules: {
34
+ rules: {
9
35
  readonly "class-component": _typescript_eslint_utils_ts_eslint.RuleModule<"classComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
10
36
  readonly "function-component": _typescript_eslint_utils_ts_eslint.RuleModule<"functionComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
11
37
  readonly hook: _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
12
38
  readonly "is-from-react": _typescript_eslint_utils_ts_eslint.RuleModule<"isFromReact", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
13
- /** @deprecated Use `hook` instead */
14
39
  readonly "react-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
15
40
  };
16
41
  };
package/dist/index.js CHANGED
@@ -1,12 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var core = require('@eslint-react/core');
4
3
  var shared = require('@eslint-react/shared');
4
+ var core = require('@eslint-react/core');
5
5
  var utils = require('@typescript-eslint/utils');
6
6
 
7
+ var __defProp = Object.defineProperty;
8
+ var __export = (target, all) => {
9
+ for (var name3 in all)
10
+ __defProp(target, name3, { get: all[name3], enumerable: true });
11
+ };
12
+
13
+ // src/configs/all.ts
14
+ var all_exports = {};
15
+ __export(all_exports, {
16
+ name: () => name,
17
+ rules: () => rules,
18
+ settings: () => settings
19
+ });
20
+ var name = "react-debug/all";
21
+ var rules = {
22
+ "react-debug/class-component": "warn",
23
+ "react-debug/function-component": "warn",
24
+ "react-debug/hook": "warn",
25
+ "react-debug/is-from-react": "off"
26
+ };
27
+ var settings = {
28
+ "react-x": shared.DEFAULT_ESLINT_REACT_SETTINGS
29
+ };
30
+
7
31
  // package.json
8
- var name = "eslint-plugin-react-debug";
9
- var version = "1.26.3-next.2";
32
+ var name2 = "eslint-plugin-react-debug";
33
+ var version = "1.26.3-next.21";
10
34
  var createRule = shared.createRuleForPlugin("debug");
11
35
 
12
36
  // src/rules/class-component.ts
@@ -33,12 +57,12 @@ var class_component_default = createRule({
33
57
  ...listeners,
34
58
  "Program:exit"(node) {
35
59
  const components = ctx.getAllComponents(node);
36
- for (const { name: name2 = "anonymous", node: component } of components.values()) {
60
+ for (const { name: name3 = "anonymous", node: component } of components.values()) {
37
61
  context.report({
38
62
  messageId: "classComponent",
39
63
  node: component,
40
64
  data: {
41
- name: name2
65
+ name: name3
42
66
  }
43
67
  });
44
68
  }
@@ -77,12 +101,12 @@ var function_component_default = createRule({
77
101
  ...listeners,
78
102
  "Program:exit"(node) {
79
103
  const components = ctx.getAllComponents(node);
80
- for (const { name: name2 = "anonymous", node: node2, displayName, flag, hookCalls } of components.values()) {
104
+ for (const { name: name3 = "anonymous", node: node2, displayName, flag, hookCalls } of components.values()) {
81
105
  context.report({
82
106
  messageId: "functionComponent",
83
107
  node: node2,
84
108
  data: {
85
- name: name2,
109
+ name: name3,
86
110
  displayName: displayName != null ? context.sourceCode.getText(displayName) : "none",
87
111
  forwardRef: (flag & core.ERComponentFlag.ForwardRef) > 0n,
88
112
  hookCalls: hookCalls.length,
@@ -118,12 +142,12 @@ var hook_default = createRule({
118
142
  ...listeners,
119
143
  "Program:exit"(node) {
120
144
  const allHooks = ctx.getAllHooks(node);
121
- for (const { name: name2, node: node2, hookCalls } of allHooks.values()) {
145
+ for (const { name: name3, node: node2, hookCalls } of allHooks.values()) {
122
146
  context.report({
123
147
  messageId: "hook",
124
148
  node: node2,
125
149
  data: {
126
- name: name2,
150
+ name: name3,
127
151
  hookCalls: hookCalls.length
128
152
  }
129
153
  });
@@ -153,14 +177,14 @@ var is_from_react_default = createRule({
153
177
  create(context) {
154
178
  const { importSource = "react" } = shared.getSettingsFromContext(context);
155
179
  function isFromReact(node, initialScope) {
156
- const name2 = node.name;
180
+ const name3 = node.name;
157
181
  switch (true) {
158
182
  case (node.parent.type === utils.AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === utils.AST_NODE_TYPES.Identifier):
159
183
  return core.isInitializedFromReact(node.parent.object.name, importSource, initialScope);
160
184
  case (node.parent.type === utils.AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === utils.AST_NODE_TYPES.JSXIdentifier):
161
185
  return core.isInitializedFromReact(node.parent.object.name, importSource, initialScope);
162
186
  default:
163
- return core.isInitializedFromReact(name2, importSource, initialScope);
187
+ return core.isInitializedFromReact(name3, importSource, initialScope);
164
188
  }
165
189
  }
166
190
  function visitorFunction(node) {
@@ -168,7 +192,7 @@ var is_from_react_default = createRule({
168
192
  if (shouldSkipDuplicate) {
169
193
  return;
170
194
  }
171
- const name2 = node.name;
195
+ const name3 = node.name;
172
196
  const initialScope = context.sourceCode.getScope(node);
173
197
  if (!isFromReact(node, initialScope)) {
174
198
  return;
@@ -178,7 +202,7 @@ var is_from_react_default = createRule({
178
202
  node,
179
203
  data: {
180
204
  type: node.type,
181
- name: name2,
205
+ name: name3,
182
206
  importSource
183
207
  }
184
208
  });
@@ -191,10 +215,10 @@ var is_from_react_default = createRule({
191
215
  defaultOptions: []
192
216
  });
193
217
 
194
- // src/index.ts
195
- var index_default = {
218
+ // src/plugin.ts
219
+ var plugin = {
196
220
  meta: {
197
- name,
221
+ name: name2,
198
222
  version
199
223
  },
200
224
  rules: {
@@ -208,4 +232,27 @@ var index_default = {
208
232
  }
209
233
  };
210
234
 
235
+ // src/index.ts
236
+ function makeConfig(config) {
237
+ return {
238
+ ...config,
239
+ plugins: {
240
+ "react-debug": plugin
241
+ }
242
+ };
243
+ }
244
+ function makeLegacyConfig({ rules: rules2 }) {
245
+ return {
246
+ plugins: ["react-debug"],
247
+ rules: rules2
248
+ };
249
+ }
250
+ var index_default = {
251
+ ...plugin,
252
+ configs: {
253
+ ["all"]: makeConfig(all_exports),
254
+ ["all-legacy"]: makeLegacyConfig(all_exports)
255
+ }
256
+ };
257
+
211
258
  module.exports = index_default;
package/dist/index.mjs CHANGED
@@ -1,10 +1,34 @@
1
+ import { createRuleForPlugin, getSettingsFromContext, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
1
2
  import { useComponentCollectorLegacy, useComponentCollector, DEFAULT_COMPONENT_HINT, ERComponentFlag, useHookCollector, isInitializedFromReact } from '@eslint-react/core';
2
- import { createRuleForPlugin, getSettingsFromContext } from '@eslint-react/shared';
3
3
  import { AST_NODE_TYPES } from '@typescript-eslint/utils';
4
4
 
5
+ var __defProp = Object.defineProperty;
6
+ var __export = (target, all) => {
7
+ for (var name3 in all)
8
+ __defProp(target, name3, { get: all[name3], enumerable: true });
9
+ };
10
+
11
+ // src/configs/all.ts
12
+ var all_exports = {};
13
+ __export(all_exports, {
14
+ name: () => name,
15
+ rules: () => rules,
16
+ settings: () => settings
17
+ });
18
+ var name = "react-debug/all";
19
+ var rules = {
20
+ "react-debug/class-component": "warn",
21
+ "react-debug/function-component": "warn",
22
+ "react-debug/hook": "warn",
23
+ "react-debug/is-from-react": "off"
24
+ };
25
+ var settings = {
26
+ "react-x": DEFAULT_ESLINT_REACT_SETTINGS
27
+ };
28
+
5
29
  // package.json
6
- var name = "eslint-plugin-react-debug";
7
- var version = "1.26.3-next.2";
30
+ var name2 = "eslint-plugin-react-debug";
31
+ var version = "1.26.3-next.21";
8
32
  var createRule = createRuleForPlugin("debug");
9
33
 
10
34
  // src/rules/class-component.ts
@@ -31,12 +55,12 @@ var class_component_default = createRule({
31
55
  ...listeners,
32
56
  "Program:exit"(node) {
33
57
  const components = ctx.getAllComponents(node);
34
- for (const { name: name2 = "anonymous", node: component } of components.values()) {
58
+ for (const { name: name3 = "anonymous", node: component } of components.values()) {
35
59
  context.report({
36
60
  messageId: "classComponent",
37
61
  node: component,
38
62
  data: {
39
- name: name2
63
+ name: name3
40
64
  }
41
65
  });
42
66
  }
@@ -75,12 +99,12 @@ var function_component_default = createRule({
75
99
  ...listeners,
76
100
  "Program:exit"(node) {
77
101
  const components = ctx.getAllComponents(node);
78
- for (const { name: name2 = "anonymous", node: node2, displayName, flag, hookCalls } of components.values()) {
102
+ for (const { name: name3 = "anonymous", node: node2, displayName, flag, hookCalls } of components.values()) {
79
103
  context.report({
80
104
  messageId: "functionComponent",
81
105
  node: node2,
82
106
  data: {
83
- name: name2,
107
+ name: name3,
84
108
  displayName: displayName != null ? context.sourceCode.getText(displayName) : "none",
85
109
  forwardRef: (flag & ERComponentFlag.ForwardRef) > 0n,
86
110
  hookCalls: hookCalls.length,
@@ -116,12 +140,12 @@ var hook_default = createRule({
116
140
  ...listeners,
117
141
  "Program:exit"(node) {
118
142
  const allHooks = ctx.getAllHooks(node);
119
- for (const { name: name2, node: node2, hookCalls } of allHooks.values()) {
143
+ for (const { name: name3, node: node2, hookCalls } of allHooks.values()) {
120
144
  context.report({
121
145
  messageId: "hook",
122
146
  node: node2,
123
147
  data: {
124
- name: name2,
148
+ name: name3,
125
149
  hookCalls: hookCalls.length
126
150
  }
127
151
  });
@@ -151,14 +175,14 @@ var is_from_react_default = createRule({
151
175
  create(context) {
152
176
  const { importSource = "react" } = getSettingsFromContext(context);
153
177
  function isFromReact(node, initialScope) {
154
- const name2 = node.name;
178
+ const name3 = node.name;
155
179
  switch (true) {
156
180
  case (node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier):
157
181
  return isInitializedFromReact(node.parent.object.name, importSource, initialScope);
158
182
  case (node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier):
159
183
  return isInitializedFromReact(node.parent.object.name, importSource, initialScope);
160
184
  default:
161
- return isInitializedFromReact(name2, importSource, initialScope);
185
+ return isInitializedFromReact(name3, importSource, initialScope);
162
186
  }
163
187
  }
164
188
  function visitorFunction(node) {
@@ -166,7 +190,7 @@ var is_from_react_default = createRule({
166
190
  if (shouldSkipDuplicate) {
167
191
  return;
168
192
  }
169
- const name2 = node.name;
193
+ const name3 = node.name;
170
194
  const initialScope = context.sourceCode.getScope(node);
171
195
  if (!isFromReact(node, initialScope)) {
172
196
  return;
@@ -176,7 +200,7 @@ var is_from_react_default = createRule({
176
200
  node,
177
201
  data: {
178
202
  type: node.type,
179
- name: name2,
203
+ name: name3,
180
204
  importSource
181
205
  }
182
206
  });
@@ -189,10 +213,10 @@ var is_from_react_default = createRule({
189
213
  defaultOptions: []
190
214
  });
191
215
 
192
- // src/index.ts
193
- var index_default = {
216
+ // src/plugin.ts
217
+ var plugin = {
194
218
  meta: {
195
- name,
219
+ name: name2,
196
220
  version
197
221
  },
198
222
  rules: {
@@ -206,4 +230,27 @@ var index_default = {
206
230
  }
207
231
  };
208
232
 
233
+ // src/index.ts
234
+ function makeConfig(config) {
235
+ return {
236
+ ...config,
237
+ plugins: {
238
+ "react-debug": plugin
239
+ }
240
+ };
241
+ }
242
+ function makeLegacyConfig({ rules: rules2 }) {
243
+ return {
244
+ plugins: ["react-debug"],
245
+ rules: rules2
246
+ };
247
+ }
248
+ var index_default = {
249
+ ...plugin,
250
+ configs: {
251
+ ["all"]: makeConfig(all_exports),
252
+ ["all-legacy"]: makeLegacyConfig(all_exports)
253
+ }
254
+ };
255
+
209
256
  export { index_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-debug",
3
- "version": "1.26.3-next.2",
3
+ "version": "1.26.3-next.21",
4
4
  "description": "ESLint React's ESLint plugin for debugging related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,24 +43,24 @@
43
43
  "./package.json"
44
44
  ],
45
45
  "dependencies": {
46
- "@typescript-eslint/scope-manager": "^8.23.0",
47
- "@typescript-eslint/type-utils": "^8.23.0",
48
- "@typescript-eslint/types": "^8.23.0",
49
- "@typescript-eslint/utils": "^8.23.0",
46
+ "@typescript-eslint/scope-manager": "^8.24.1",
47
+ "@typescript-eslint/type-utils": "^8.24.1",
48
+ "@typescript-eslint/types": "^8.24.1",
49
+ "@typescript-eslint/utils": "^8.24.1",
50
50
  "string-ts": "^2.2.1",
51
51
  "ts-pattern": "^5.6.2",
52
- "@eslint-react/ast": "1.26.3-next.2",
53
- "@eslint-react/core": "1.26.3-next.2",
54
- "@eslint-react/eff": "1.26.3-next.2",
55
- "@eslint-react/jsx": "1.26.3-next.2",
56
- "@eslint-react/shared": "1.26.3-next.2",
57
- "@eslint-react/var": "1.26.3-next.2"
52
+ "@eslint-react/ast": "1.26.3-next.21",
53
+ "@eslint-react/core": "1.26.3-next.21",
54
+ "@eslint-react/eff": "1.26.3-next.21",
55
+ "@eslint-react/var": "1.26.3-next.21",
56
+ "@eslint-react/jsx": "1.26.3-next.21",
57
+ "@eslint-react/shared": "1.26.3-next.21"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/react": "^19.0.8",
61
- "@types/react-dom": "^19.0.3",
60
+ "@types/react": "^19.0.10",
61
+ "@types/react-dom": "^19.0.4",
62
62
  "tsup": "^8.3.6",
63
- "@workspace/configs": "0.0.0"
63
+ "@local/configs": "0.0.0"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "eslint": "^8.57.0 || ^9.0.0",
@@ -84,6 +84,6 @@
84
84
  "scripts": {
85
85
  "build": "tsup --dts-resolve",
86
86
  "lint:publish": "publint",
87
- "lint:type": "tsc --noEmit"
87
+ "lint:ts": "tsc --noEmit"
88
88
  }
89
89
  }