eslint-plugin-react-debug 3.0.0-next.6 → 3.0.0-next.60

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.d.ts CHANGED
@@ -1,20 +1,9 @@
1
- import * as _eslint_react_shared0 from "@eslint-react/shared";
1
+ import { ESLint, Linter } from "eslint";
2
2
 
3
3
  //#region src/index.d.ts
4
- declare const _default: {
5
- configs: {
6
- all: {
7
- plugins: {};
8
- name?: string;
9
- rules?: Record<string, _eslint_react_shared0.RuleConfig>;
10
- settings?: _eslint_react_shared0.SettingsConfig;
11
- };
12
- };
13
- meta: {
14
- name: string;
15
- version: string;
16
- };
17
- rules: Record<string, _eslint_react_shared0.CompatibleRule>;
4
+ type ConfigName = "all";
5
+ declare const finalPlugin: ESLint.Plugin & {
6
+ configs: Record<ConfigName, Linter.Config>;
18
7
  };
19
8
  //#endregion
20
- export { _default as default };
9
+ export { finalPlugin as default };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener, getConfigAdapters, getSettingsFromContext, report } from "@eslint-react/shared";
1
+ import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener, getSettingsFromContext, report } from "@eslint-react/shared";
2
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";
@@ -21,28 +21,10 @@ var __exportAll = (all, no_symbols) => {
21
21
  return target;
22
22
  };
23
23
 
24
- //#endregion
25
- //#region src/configs/all.ts
26
- var all_exports = /* @__PURE__ */ __exportAll({
27
- name: () => name$1,
28
- rules: () => rules,
29
- settings: () => settings
30
- });
31
- const name$1 = "react-debug/all";
32
- const rules = {
33
- "react-debug/class-component": "warn",
34
- "react-debug/function-component": "warn",
35
- "react-debug/hook": "warn",
36
- "react-debug/is-from-react": "warn",
37
- "react-debug/is-from-ref": "warn",
38
- "react-debug/jsx": "warn"
39
- };
40
- const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
41
-
42
24
  //#endregion
43
25
  //#region package.json
44
- var name = "eslint-plugin-react-debug";
45
- var version = "3.0.0-next.6";
26
+ var name$1 = "eslint-plugin-react-debug";
27
+ var version = "3.0.0-next.60";
46
28
 
47
29
  //#endregion
48
30
  //#region src/utils/create-rule.ts
@@ -58,7 +40,7 @@ function stringify(value) {
58
40
  }
59
41
 
60
42
  //#endregion
61
- //#region src/rules/class-component.ts
43
+ //#region src/rules/class-component/class-component.ts
62
44
  const RULE_NAME$5 = "class-component";
63
45
  var class_component_default = createRule({
64
46
  meta: {
@@ -75,15 +57,15 @@ function create$5(context) {
75
57
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
76
58
  return defineRuleListener(visitor, { "Program:exit"(program) {
77
59
  for (const { name = "anonymous", node: component } of ctx.getAllComponents(program)) context.report({
60
+ data: { json: stringify({ name }) },
78
61
  messageId: "default",
79
- node: component,
80
- data: { json: stringify({ name }) }
62
+ node: component
81
63
  });
82
64
  } });
83
65
  }
84
66
 
85
67
  //#endregion
86
- //#region src/rules/function-component.ts
68
+ //#region src/rules/function-component/function-component.ts
87
69
  const RULE_NAME$4 = "function-component";
88
70
  var function_component_default = createRule({
89
71
  meta: {
@@ -102,22 +84,22 @@ function create$4(context) {
102
84
  hint: core.DEFAULT_COMPONENT_DETECTION_HINT
103
85
  });
104
86
  return defineRuleListener(visitor, { "Program:exit"(program) {
105
- for (const { name = "anonymous", node, displayName, flag, hookCalls } of ctx.getAllComponents(program)) context.report({
106
- messageId: "default",
107
- node,
87
+ for (const { name = "anonymous", displayName, flag, hookCalls, node } of ctx.getAllComponents(program)) context.report({
108
88
  data: { json: stringify({
109
89
  name,
110
90
  displayName: displayName == null ? "none" : context.sourceCode.getText(displayName),
111
91
  forwardRef: (flag & core.ComponentFlag.ForwardRef) > 0n,
112
92
  hookCalls: hookCalls.length,
113
93
  memo: (flag & core.ComponentFlag.Memo) > 0n
114
- }) }
94
+ }) },
95
+ messageId: "default",
96
+ node
115
97
  });
116
98
  } });
117
99
  }
118
100
 
119
101
  //#endregion
120
- //#region src/rules/hook.ts
102
+ //#region src/rules/hook/hook.ts
121
103
  const RULE_NAME$3 = "hook";
122
104
  var hook_default = createRule({
123
105
  meta: {
@@ -133,19 +115,19 @@ var hook_default = createRule({
133
115
  function create$3(context) {
134
116
  const { ctx, visitor } = core.useHookCollector(context);
135
117
  return defineRuleListener(visitor, { "Program:exit"(program) {
136
- for (const { name, node, hookCalls } of ctx.getAllHooks(program)) context.report({
137
- messageId: "default",
138
- node,
118
+ for (const { name, hookCalls, node } of ctx.getAllHooks(program)) context.report({
139
119
  data: { json: stringify({
140
120
  name,
141
121
  hookCalls: hookCalls.length
142
- }) }
122
+ }) },
123
+ messageId: "default",
124
+ node
143
125
  });
144
126
  } });
145
127
  }
146
128
 
147
129
  //#endregion
148
- //#region src/rules/is-from-react.ts
130
+ //#region src/rules/is-from-react/is-from-react.ts
149
131
  const RULE_NAME$2 = "is-from-react";
150
132
  var is_from_react_default = createRule({
151
133
  meta: {
@@ -165,18 +147,18 @@ function create$2(context) {
165
147
  const name = node.name;
166
148
  if (!isFromReact(node, context.sourceCode.getScope(node), importSource)) return;
167
149
  context.report({
168
- messageId: "default",
169
- node,
170
150
  data: { json: stringify({
171
151
  name,
172
152
  importSource
173
- }) }
153
+ }) },
154
+ messageId: "default",
155
+ node
174
156
  });
175
157
  }
176
- return {
158
+ return defineRuleListener({
177
159
  Identifier: visitorFunction,
178
160
  JSXIdentifier: visitorFunction
179
- };
161
+ });
180
162
  }
181
163
  /**
182
164
  * Check if an identifier node is initialized from React
@@ -195,7 +177,7 @@ function isFromReact(node, initialScope, importSource = "react") {
195
177
  }
196
178
 
197
179
  //#endregion
198
- //#region src/rules/is-from-ref.ts
180
+ //#region src/rules/is-from-ref/is-from-ref.ts
199
181
  const RULE_NAME$1 = "is-from-ref";
200
182
  var is_from_ref_default = createRule({
201
183
  meta: {
@@ -217,16 +199,16 @@ function create$1(context) {
217
199
  init: context.sourceCode.getText(refInit)
218
200
  });
219
201
  context.report({
202
+ data: { json },
220
203
  messageId: "default",
221
- node,
222
- data: { json }
204
+ node
223
205
  });
224
206
  }
225
207
  }
226
- return {
208
+ return defineRuleListener({
227
209
  Identifier: visitorFunction,
228
210
  JSXIdentifier: visitorFunction
229
- };
211
+ });
230
212
  }
231
213
  function getRefInitNode(node, initialScope) {
232
214
  const name = node.name;
@@ -238,7 +220,7 @@ function getRefInitNode(node, initialScope) {
238
220
  }
239
221
 
240
222
  //#endregion
241
- //#region src/rules/jsx.ts
223
+ //#region src/rules/jsx/jsx.ts
242
224
  const { JsxEmit } = core;
243
225
  const RULE_NAME = "jsx";
244
226
  var jsx_default = createRule({
@@ -261,8 +243,6 @@ function create(context) {
261
243
  };
262
244
  function getReportDescriptor(context) {
263
245
  return (node) => ({
264
- messageId: "default",
265
- node,
266
246
  data: { json: stringify({
267
247
  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(),
268
248
  type: core.getJsxElementType(context, node),
@@ -271,17 +251,19 @@ function create(context) {
271
251
  jsxFragmentFactory: jsxConfig.jsxFragmentFactory,
272
252
  jsxImportSource: jsxConfig.jsxImportSource,
273
253
  jsxRuntime: match(jsxConfig.jsx).with(P.union(JsxEmit.None, JsxEmit.ReactJSX, JsxEmit.ReactJSXDev), () => "automatic").otherwise(() => "classic")
274
- }) }
254
+ }) },
255
+ messageId: "default",
256
+ node
275
257
  });
276
258
  }
277
- return { "JSXElement, JSXFragment": flow(getReportDescriptor(context), report(context)) };
259
+ return defineRuleListener({ "JSXElement, JSXFragment": flow(getReportDescriptor(context), report(context)) });
278
260
  }
279
261
 
280
262
  //#endregion
281
263
  //#region src/plugin.ts
282
264
  const plugin = {
283
265
  meta: {
284
- name,
266
+ name: name$1,
285
267
  version
286
268
  },
287
269
  rules: {
@@ -294,13 +276,32 @@ const plugin = {
294
276
  }
295
277
  };
296
278
 
279
+ //#endregion
280
+ //#region src/configs/all.ts
281
+ var all_exports = /* @__PURE__ */ __exportAll({
282
+ name: () => name,
283
+ plugins: () => plugins,
284
+ rules: () => rules,
285
+ settings: () => settings
286
+ });
287
+ const name = "react-debug/all";
288
+ const rules = {
289
+ "react-debug/class-component": "warn",
290
+ "react-debug/function-component": "warn",
291
+ "react-debug/hook": "warn",
292
+ "react-debug/is-from-react": "warn",
293
+ "react-debug/is-from-ref": "warn",
294
+ "react-debug/jsx": "warn"
295
+ };
296
+ const plugins = { "react-debug": plugin };
297
+ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
298
+
297
299
  //#endregion
298
300
  //#region src/index.ts
299
- const { toFlatConfig } = getConfigAdapters("react-debug", plugin);
300
- var src_default = {
301
+ const finalPlugin = {
301
302
  ...plugin,
302
- configs: { ["all"]: toFlatConfig(all_exports) }
303
+ configs: { ["all"]: all_exports }
303
304
  };
304
305
 
305
306
  //#endregion
306
- export { src_default as default };
307
+ export { finalPlugin as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-debug",
3
- "version": "3.0.0-next.6",
3
+ "version": "3.0.0-next.60",
4
4
  "description": "ESLint React's ESLint plugin for debugging related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,16 +43,17 @@
43
43
  "@typescript-eslint/types": "canary",
44
44
  "@typescript-eslint/utils": "canary",
45
45
  "ts-pattern": "^5.9.0",
46
- "@eslint-react/ast": "3.0.0-next.6",
47
- "@eslint-react/core": "3.0.0-next.6",
48
- "@eslint-react/eff": "3.0.0-next.6",
49
- "@eslint-react/var": "3.0.0-next.6",
50
- "@eslint-react/shared": "3.0.0-next.6"
46
+ "@eslint-react/ast": "3.0.0-next.60",
47
+ "@eslint-react/core": "3.0.0-next.60",
48
+ "@eslint-react/eff": "3.0.0-next.60",
49
+ "@eslint-react/shared": "3.0.0-next.60",
50
+ "@eslint-react/var": "3.0.0-next.60"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "^19.2.14",
54
54
  "@types/react-dom": "^19.2.3",
55
- "tsdown": "^0.20.3",
55
+ "eslint": "^10.0.2",
56
+ "tsdown": "^0.21.0-beta.2",
56
57
  "@local/configs": "0.0.0"
57
58
  },
58
59
  "peerDependencies": {
@@ -68,6 +69,6 @@
68
69
  "scripts": {
69
70
  "build": "tsdown",
70
71
  "lint:publish": "publint",
71
- "lint:ts": "tsc --noEmit"
72
+ "lint:ts": "tsl"
72
73
  }
73
74
  }