eslint-plugin-react-debug 1.41.0 → 1.41.1-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 CHANGED
@@ -3,6 +3,7 @@
3
3
  var shared = require('@eslint-react/shared');
4
4
  var ER2 = require('@eslint-react/core');
5
5
  var utils = require('@typescript-eslint/utils');
6
+ var JSX = require('@eslint-react/jsx');
6
7
  var kit = require('@eslint-react/kit');
7
8
  var tsPattern = require('ts-pattern');
8
9
  var typescript = require('typescript');
@@ -26,6 +27,7 @@ function _interopNamespace(e) {
26
27
  }
27
28
 
28
29
  var ER2__namespace = /*#__PURE__*/_interopNamespace(ER2);
30
+ var JSX__namespace = /*#__PURE__*/_interopNamespace(JSX);
29
31
 
30
32
  var __defProp = Object.defineProperty;
31
33
  var __export = (target, all) => {
@@ -54,7 +56,7 @@ var settings = {
54
56
 
55
57
  // package.json
56
58
  var name2 = "eslint-plugin-react-debug";
57
- var version = "1.41.0";
59
+ var version = "1.41.1-beta.0";
58
60
  var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("debug"));
59
61
 
60
62
  // src/rules/class-component.ts
@@ -246,11 +248,11 @@ var jsx_default = createRule({
246
248
  meta: {
247
249
  type: "problem",
248
250
  docs: {
249
- description: "Reports all React Hooks.",
251
+ description: "Reports all JSX elements and fragments.",
250
252
  [Symbol.for("rule_features")]: RULE_FEATURES5
251
253
  },
252
254
  messages: {
253
- jsx: "[jsx] jsx: '{{jsx}}', jsxFactory: '{{jsxFactory}}', jsxFragmentFactory: '{{jsxFragmentFactory}}', jsxRuntime: '{{jsxRuntime}}' jsxImportSource: '{{jsxImportSource}}'"
255
+ jsx: "[jsx {{type}}] jsx: '{{jsx}}', jsxFactory: '{{jsxFactory}}', jsxFragmentFactory: '{{jsxFragmentFactory}}', jsxRuntime: '{{jsxRuntime}}' jsxImportSource: '{{jsxImportSource}}'"
254
256
  },
255
257
  schema: []
256
258
  },
@@ -265,26 +267,28 @@ function create5(context) {
265
267
  ...jsxConfigFromContext,
266
268
  ...jsxConfigFromAnnotation
267
269
  };
268
- const baseDescriptor = {
270
+ const getDescriptor = (type) => ({
269
271
  messageId: "jsx",
270
272
  data: {
273
+ type,
271
274
  jsx: tsPattern.match(jsxConfig.jsx).with(typescript.JsxEmit.None, () => "none").with(typescript.JsxEmit.ReactJSX, () => "react-jsx").with(typescript.JsxEmit.ReactJSXDev, () => "react-jsx-dev").with(typescript.JsxEmit.React, () => "react").with(typescript.JsxEmit.ReactNative, () => "react-native").with(typescript.JsxEmit.Preserve, () => "preserve").otherwise(() => "unknown"),
272
275
  jsxFactory: jsxConfig.jsxFactory,
273
276
  jsxFragmentFactory: jsxConfig.jsxFragmentFactory,
274
277
  jsxImportSource: jsxConfig.jsxImportSource,
275
278
  jsxRuntime: tsPattern.match(jsxConfig.jsx).with(tsPattern.P.union(typescript.JsxEmit.None, typescript.JsxEmit.ReactJSX, typescript.JsxEmit.ReactJSXDev), () => "automatic").otherwise(() => "classic")
276
279
  }
277
- };
280
+ });
278
281
  return {
279
282
  JSXElement(node) {
283
+ const isFragment = JSX__namespace.isFragmentElement(node);
280
284
  context.report({
281
- ...baseDescriptor,
285
+ ...getDescriptor(isFragment ? "fragment" : "element"),
282
286
  node
283
287
  });
284
288
  },
285
289
  JSXFragment(node) {
286
290
  context.report({
287
- ...baseDescriptor,
291
+ ...getDescriptor("fragment"),
288
292
  node
289
293
  });
290
294
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { getDocsUrl, getSettingsFromContext, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
2
2
  import * as ER2 from '@eslint-react/core';
3
3
  import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';
4
+ import * as JSX from '@eslint-react/jsx';
4
5
  import { JsxConfig } from '@eslint-react/kit';
5
6
  import { match, P } from 'ts-pattern';
6
7
  import { JsxEmit } from 'typescript';
@@ -32,7 +33,7 @@ var settings = {
32
33
 
33
34
  // package.json
34
35
  var name2 = "eslint-plugin-react-debug";
35
- var version = "1.41.0";
36
+ var version = "1.41.1-beta.0";
36
37
  var createRule = ESLintUtils.RuleCreator(getDocsUrl("debug"));
37
38
 
38
39
  // src/rules/class-component.ts
@@ -224,11 +225,11 @@ var jsx_default = createRule({
224
225
  meta: {
225
226
  type: "problem",
226
227
  docs: {
227
- description: "Reports all React Hooks.",
228
+ description: "Reports all JSX elements and fragments.",
228
229
  [Symbol.for("rule_features")]: RULE_FEATURES5
229
230
  },
230
231
  messages: {
231
- jsx: "[jsx] jsx: '{{jsx}}', jsxFactory: '{{jsxFactory}}', jsxFragmentFactory: '{{jsxFragmentFactory}}', jsxRuntime: '{{jsxRuntime}}' jsxImportSource: '{{jsxImportSource}}'"
232
+ jsx: "[jsx {{type}}] jsx: '{{jsx}}', jsxFactory: '{{jsxFactory}}', jsxFragmentFactory: '{{jsxFragmentFactory}}', jsxRuntime: '{{jsxRuntime}}' jsxImportSource: '{{jsxImportSource}}'"
232
233
  },
233
234
  schema: []
234
235
  },
@@ -243,26 +244,28 @@ function create5(context) {
243
244
  ...jsxConfigFromContext,
244
245
  ...jsxConfigFromAnnotation
245
246
  };
246
- const baseDescriptor = {
247
+ const getDescriptor = (type) => ({
247
248
  messageId: "jsx",
248
249
  data: {
250
+ type,
249
251
  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"),
250
252
  jsxFactory: jsxConfig.jsxFactory,
251
253
  jsxFragmentFactory: jsxConfig.jsxFragmentFactory,
252
254
  jsxImportSource: jsxConfig.jsxImportSource,
253
255
  jsxRuntime: match(jsxConfig.jsx).with(P.union(JsxEmit.None, JsxEmit.ReactJSX, JsxEmit.ReactJSXDev), () => "automatic").otherwise(() => "classic")
254
256
  }
255
- };
257
+ });
256
258
  return {
257
259
  JSXElement(node) {
260
+ const isFragment = JSX.isFragmentElement(node);
258
261
  context.report({
259
- ...baseDescriptor,
262
+ ...getDescriptor(isFragment ? "fragment" : "element"),
260
263
  node
261
264
  });
262
265
  },
263
266
  JSXFragment(node) {
264
267
  context.report({
265
- ...baseDescriptor,
268
+ ...getDescriptor("fragment"),
266
269
  node
267
270
  });
268
271
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-debug",
3
- "version": "1.41.0",
3
+ "version": "1.41.1-beta.0",
4
4
  "description": "ESLint React's ESLint plugin for debugging related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,19 +43,19 @@
43
43
  "./package.json"
44
44
  ],
45
45
  "dependencies": {
46
- "@typescript-eslint/scope-manager": "^8.29.0",
47
- "@typescript-eslint/type-utils": "^8.29.0",
48
- "@typescript-eslint/types": "^8.29.0",
49
- "@typescript-eslint/utils": "^8.29.0",
46
+ "@typescript-eslint/scope-manager": "^8.29.1",
47
+ "@typescript-eslint/type-utils": "^8.29.1",
48
+ "@typescript-eslint/types": "^8.29.1",
49
+ "@typescript-eslint/utils": "^8.29.1",
50
50
  "string-ts": "^2.2.1",
51
51
  "ts-pattern": "^5.7.0",
52
- "@eslint-react/ast": "1.41.0",
53
- "@eslint-react/core": "1.41.0",
54
- "@eslint-react/jsx": "1.41.0",
55
- "@eslint-react/eff": "1.41.0",
56
- "@eslint-react/shared": "1.41.0",
57
- "@eslint-react/kit": "1.41.0",
58
- "@eslint-react/var": "1.41.0"
52
+ "@eslint-react/ast": "1.41.1-beta.0",
53
+ "@eslint-react/core": "1.41.1-beta.0",
54
+ "@eslint-react/eff": "1.41.1-beta.0",
55
+ "@eslint-react/jsx": "1.41.1-beta.0",
56
+ "@eslint-react/kit": "1.41.1-beta.0",
57
+ "@eslint-react/shared": "1.41.1-beta.0",
58
+ "@eslint-react/var": "1.41.1-beta.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/react": "^19.1.0",