eslint-plugin-react-debug 1.23.3-next.8 → 1.24.0-next.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.
Files changed (3) hide show
  1. package/dist/index.js +13 -13
  2. package/dist/index.mjs +13 -13
  3. 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.23.3-next.8";
9
+ var version = "1.24.0-next.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: eff.O.getOrElse(eff.F.constant("anonymous"))(name2)
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: eff.O.getOrElse(name2, eff.F.constant("anonymous")),
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.value,
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 getReportDescriptor(node) {
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 eff.O.none();
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 eff.O.none();
174
+ return;
176
175
  }
177
- return eff.O.some({
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: eff.F.flow(getReportDescriptor, eff.O.map(context.report)),
189
- JSXIdentifier: eff.F.flow(getReportDescriptor, eff.O.map(context.report))
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.23.3-next.8";
7
+ var version = "1.24.0-next.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: O.getOrElse(F.constant("anonymous"))(name2)
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: O.getOrElse(name2, F.constant("anonymous")),
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.value,
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 getReportDescriptor(node) {
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 O.none();
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 O.none();
172
+ return;
174
173
  }
175
- return O.some({
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: F.flow(getReportDescriptor, O.map(context.report)),
187
- JSXIdentifier: F.flow(getReportDescriptor, O.map(context.report))
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.23.3-next.8",
3
+ "version": "1.24.0-next.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/rEl1cx/eslint-react",
13
+ "homepage": "https://github.com/Rel1cx/eslint-react",
14
14
  "bugs": {
15
- "url": "https://github.com/rEl1cx/eslint-react/issues"
15
+ "url": "https://github.com/Rel1cx/eslint-react/issues"
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "git+https://github.com/rEl1cx/eslint-react.git",
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.23.3-next.8",
51
- "@eslint-react/core": "1.23.3-next.8",
52
- "@eslint-react/shared": "1.23.3-next.8",
53
- "@eslint-react/eff": "1.23.3-next.8",
54
- "@eslint-react/var": "1.23.3-next.8",
55
- "@eslint-react/types": "1.23.3-next.8",
56
- "@eslint-react/jsx": "1.23.3-next.8"
50
+ "@eslint-react/ast": "1.24.0-next.0",
51
+ "@eslint-react/core": "1.24.0-next.0",
52
+ "@eslint-react/jsx": "1.24.0-next.0",
53
+ "@eslint-react/eff": "1.24.0-next.0",
54
+ "@eslint-react/shared": "1.24.0-next.0",
55
+ "@eslint-react/types": "1.24.0-next.0",
56
+ "@eslint-react/var": "1.24.0-next.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/react": "^19.0.4",