eslint-plugin-react-web-api 1.23.1-next.3 → 1.23.1-next.4

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
@@ -34,7 +34,7 @@ var VAR2__namespace = /*#__PURE__*/_interopNamespace(VAR2);
34
34
 
35
35
  // package.json
36
36
  var name = "eslint-plugin-react-web-api";
37
- var version = "1.23.1-next.3";
37
+ var version = "1.23.1-next.4";
38
38
  var createRule = shared.createRuleForPlugin("web-api");
39
39
  function getInstanceID(node, prev) {
40
40
  switch (true) {
@@ -85,6 +85,20 @@ function getCallKind(node) {
85
85
  function getFunctionKind(node) {
86
86
  return eff.O.getOrElse(getPhaseKindOfFunction(node), eff.F.constant("other"));
87
87
  }
88
+ function getSignalValueExpression(node, initialScope) {
89
+ switch (node.type) {
90
+ case utils.AST_NODE_TYPES.Identifier:
91
+ return eff.F.pipe(
92
+ VAR2__namespace.findVariable(node, initialScope),
93
+ eff.O.flatMap(VAR2__namespace.getVariableNode(0)),
94
+ eff.O.flatMap((n) => getSignalValueExpression(n, initialScope))
95
+ );
96
+ case utils.AST_NODE_TYPES.MemberExpression:
97
+ return eff.O.some(node);
98
+ default:
99
+ return eff.O.none();
100
+ }
101
+ }
88
102
  function getOptions(node, initialScope) {
89
103
  const findProp = (properties, propName) => {
90
104
  return JSX__namespace.findPropInProperties(properties, initialScope)(propName);
@@ -124,21 +138,7 @@ function getOptions(node, initialScope) {
124
138
  const vSignal = eff.O.flatMap(pSignal, (prop) => {
125
139
  if (prop.type !== utils.AST_NODE_TYPES.Property) return eff.O.none();
126
140
  const { value } = prop;
127
- const getSignalExp = (node3) => {
128
- switch (node3.type) {
129
- case utils.AST_NODE_TYPES.Identifier:
130
- return eff.F.pipe(
131
- VAR2__namespace.findVariable(node3, initialScope),
132
- eff.O.flatMap(VAR2__namespace.getVariableNode(0)),
133
- eff.O.flatMap(getSignalExp)
134
- );
135
- case utils.AST_NODE_TYPES.MemberExpression:
136
- return eff.O.some(node3);
137
- default:
138
- return eff.O.none();
139
- }
140
- };
141
- return getSignalExp(value);
141
+ return getSignalValueExpression(value, initialScope);
142
142
  });
143
143
  return { capture: vCapture, once: vOnce, signal: vSignal };
144
144
  }
@@ -157,9 +157,9 @@ var no_leaked_event_listener_default = createRule({
157
157
  [Symbol.for("rule_features")]: RULE_FEATURES
158
158
  },
159
159
  messages: {
160
- noLeakedEventListenerInEffect: "A 'addEventListener' in '{{effectMethodKind}}' should have a corresponding 'removeEventListener' in its cleanup function.",
161
- noLeakedEventListenerInLifecycle: "A 'addEventListener' in 'componentDidMount' should have a corresponding 'removeEventListener' in 'componentWillUnmount' method.",
162
- noLeakedEventListenerOfInlineFunction: "A '{{eventMethodKind}}' should not have an inline listener function."
160
+ noLeakedEventListenerInEffect: "An 'addEventListener' in '{{effectMethodKind}}' should have a corresponding 'removeEventListener' in its cleanup function.",
161
+ noLeakedEventListenerInLifecycle: "An 'addEventListener' in 'componentDidMount' should have a corresponding 'removeEventListener' in 'componentWillUnmount' method.",
162
+ noLeakedEventListenerOfInlineFunction: "A/an '{{eventMethodKind}}' should not have an inline listener function."
163
163
  },
164
164
  schema: []
165
165
  },
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from '@typescript-eslint/types';
10
10
 
11
11
  // package.json
12
12
  var name = "eslint-plugin-react-web-api";
13
- var version = "1.23.1-next.3";
13
+ var version = "1.23.1-next.4";
14
14
  var createRule = createRuleForPlugin("web-api");
15
15
  function getInstanceID(node, prev) {
16
16
  switch (true) {
@@ -61,6 +61,20 @@ function getCallKind(node) {
61
61
  function getFunctionKind(node) {
62
62
  return O.getOrElse(getPhaseKindOfFunction(node), F.constant("other"));
63
63
  }
64
+ function getSignalValueExpression(node, initialScope) {
65
+ switch (node.type) {
66
+ case AST_NODE_TYPES.Identifier:
67
+ return F.pipe(
68
+ VAR2.findVariable(node, initialScope),
69
+ O.flatMap(VAR2.getVariableNode(0)),
70
+ O.flatMap((n) => getSignalValueExpression(n, initialScope))
71
+ );
72
+ case AST_NODE_TYPES.MemberExpression:
73
+ return O.some(node);
74
+ default:
75
+ return O.none();
76
+ }
77
+ }
64
78
  function getOptions(node, initialScope) {
65
79
  const findProp = (properties, propName) => {
66
80
  return JSX.findPropInProperties(properties, initialScope)(propName);
@@ -100,21 +114,7 @@ function getOptions(node, initialScope) {
100
114
  const vSignal = O.flatMap(pSignal, (prop) => {
101
115
  if (prop.type !== AST_NODE_TYPES.Property) return O.none();
102
116
  const { value } = prop;
103
- const getSignalExp = (node3) => {
104
- switch (node3.type) {
105
- case AST_NODE_TYPES.Identifier:
106
- return F.pipe(
107
- VAR2.findVariable(node3, initialScope),
108
- O.flatMap(VAR2.getVariableNode(0)),
109
- O.flatMap(getSignalExp)
110
- );
111
- case AST_NODE_TYPES.MemberExpression:
112
- return O.some(node3);
113
- default:
114
- return O.none();
115
- }
116
- };
117
- return getSignalExp(value);
117
+ return getSignalValueExpression(value, initialScope);
118
118
  });
119
119
  return { capture: vCapture, once: vOnce, signal: vSignal };
120
120
  }
@@ -133,9 +133,9 @@ var no_leaked_event_listener_default = createRule({
133
133
  [Symbol.for("rule_features")]: RULE_FEATURES
134
134
  },
135
135
  messages: {
136
- noLeakedEventListenerInEffect: "A 'addEventListener' in '{{effectMethodKind}}' should have a corresponding 'removeEventListener' in its cleanup function.",
137
- noLeakedEventListenerInLifecycle: "A 'addEventListener' in 'componentDidMount' should have a corresponding 'removeEventListener' in 'componentWillUnmount' method.",
138
- noLeakedEventListenerOfInlineFunction: "A '{{eventMethodKind}}' should not have an inline listener function."
136
+ noLeakedEventListenerInEffect: "An 'addEventListener' in '{{effectMethodKind}}' should have a corresponding 'removeEventListener' in its cleanup function.",
137
+ noLeakedEventListenerInLifecycle: "An 'addEventListener' in 'componentDidMount' should have a corresponding 'removeEventListener' in 'componentWillUnmount' method.",
138
+ noLeakedEventListenerOfInlineFunction: "A/an '{{eventMethodKind}}' should not have an inline listener function."
139
139
  },
140
140
  schema: []
141
141
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-web-api",
3
- "version": "1.23.1-next.3",
3
+ "version": "1.23.1-next.4",
4
4
  "description": "ESLint React's ESLint plugin for interacting with Web APIs",
5
5
  "keywords": [
6
6
  "react",
@@ -46,13 +46,13 @@
46
46
  "@typescript-eslint/utils": "^8.19.0",
47
47
  "string-ts": "^2.2.0",
48
48
  "ts-pattern": "^5.6.0",
49
- "@eslint-react/ast": "1.23.1-next.3",
50
- "@eslint-react/core": "1.23.1-next.3",
51
- "@eslint-react/eff": "1.23.1-next.3",
52
- "@eslint-react/jsx": "1.23.1-next.3",
53
- "@eslint-react/shared": "1.23.1-next.3",
54
- "@eslint-react/var": "1.23.1-next.3",
55
- "@eslint-react/types": "1.23.1-next.3"
49
+ "@eslint-react/ast": "1.23.1-next.4",
50
+ "@eslint-react/core": "1.23.1-next.4",
51
+ "@eslint-react/jsx": "1.23.1-next.4",
52
+ "@eslint-react/eff": "1.23.1-next.4",
53
+ "@eslint-react/shared": "1.23.1-next.4",
54
+ "@eslint-react/var": "1.23.1-next.4",
55
+ "@eslint-react/types": "1.23.1-next.4"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/react": "^19.0.2",