eslint-plugin-react-web-api 5.3.0-next.1 → 5.3.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.
Files changed (2) hide show
  1. package/dist/index.js +28 -18
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ var __exportAll = (all, no_symbols) => {
28
28
  //#endregion
29
29
  //#region package.json
30
30
  var name$1 = "eslint-plugin-react-web-api";
31
- var version = "5.3.0-next.1";
31
+ var version = "5.3.1-beta.0";
32
32
 
33
33
  //#endregion
34
34
  //#region src/types/component-phase.ts
@@ -110,9 +110,10 @@ function getOptions(context, node) {
110
110
  //#region src/rules/no-leaked-event-listener/no-leaked-event-listener.ts
111
111
  const RULE_NAME$4 = "no-leaked-event-listener";
112
112
  function getCallKind$4(node) {
113
+ const callee = Extract.unwrap(node.callee);
113
114
  switch (true) {
114
- case node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("addEventListener", "removeEventListener", "abort"))(node.callee.name): return node.callee.name;
115
- case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("addEventListener", "removeEventListener", "abort"))(node.callee.property.name): return node.callee.property.name;
115
+ case callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("addEventListener", "removeEventListener", "abort"))(callee.name): return callee.name;
116
+ case callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("addEventListener", "removeEventListener", "abort"))(callee.property.name): return callee.property.name;
116
117
  default: return "other";
117
118
  }
118
119
  }
@@ -177,8 +178,9 @@ function create$4(context) {
177
178
  const fKind = fEntries.findLast((x) => x.kind !== "other")?.kind;
178
179
  if (fKind == null) return;
179
180
  if (!ComponentPhaseRelevance.has(fKind)) return;
181
+ const unwrappedCallee = Extract.unwrap(node.callee);
180
182
  match(getCallKind$4(node)).with("addEventListener", (callKind) => {
181
- if (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && core.isAPIFromReactNative(node.callee.object.name, context.sourceCode.getScope(node))) return;
183
+ if (unwrappedCallee.type === AST_NODE_TYPES.MemberExpression && unwrappedCallee.object.type === AST_NODE_TYPES.Identifier && core.isAPIFromReactNative(unwrappedCallee.object.name, context.sourceCode.getScope(node))) return;
182
184
  const [type, listener, options] = node.arguments;
183
185
  if (type == null || listener == null) return;
184
186
  const opts = options == null ? defaultOptions : getOptions(context, options);
@@ -261,11 +263,12 @@ function resolveToObjectExpression(context, node) {
261
263
  //#region src/rules/no-leaked-fetch/no-leaked-fetch.ts
262
264
  const RULE_NAME$3 = "no-leaked-fetch";
263
265
  function getCallKind$3(node) {
266
+ const callee = Extract.unwrap(node.callee);
264
267
  switch (true) {
265
- case node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === "fetch": return "fetch";
266
- case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "fetch": return "fetch";
267
- case node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === "abort": return "abort";
268
- case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "abort": return "abort";
268
+ case callee.type === AST_NODE_TYPES.Identifier && callee.name === "fetch": return "fetch";
269
+ case callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === "fetch": return "fetch";
270
+ case callee.type === AST_NODE_TYPES.Identifier && callee.name === "abort": return "abort";
271
+ case callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === "abort": return "abort";
269
272
  default: return "other";
270
273
  }
271
274
  }
@@ -317,7 +320,8 @@ function getFetchController(context, node) {
317
320
  return getControllerFromSignal(context, signalProp.value);
318
321
  }
319
322
  function getAbortController(node) {
320
- if (node.callee.type === AST_NODE_TYPES.MemberExpression) return node.callee.object;
323
+ const callee = Extract.unwrap(node.callee);
324
+ if (callee.type === AST_NODE_TYPES.MemberExpression) return callee.object;
321
325
  return null;
322
326
  }
323
327
  var no_leaked_fetch_default = createRule({
@@ -403,9 +407,10 @@ function create$3(context) {
403
407
  //#region src/rules/no-leaked-interval/no-leaked-interval.ts
404
408
  const RULE_NAME$2 = "no-leaked-interval";
405
409
  function getCallKind$2(node) {
410
+ const callee = Extract.unwrap(node.callee);
406
411
  switch (true) {
407
- case node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setInterval", "clearInterval"))(node.callee.name): return node.callee.name;
408
- case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setInterval", "clearInterval"))(node.callee.property.name): return node.callee.property.name;
412
+ case callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setInterval", "clearInterval"))(callee.name): return callee.name;
413
+ case callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setInterval", "clearInterval"))(callee.property.name): return callee.property.name;
409
414
  default: return "other";
410
415
  }
411
416
  }
@@ -652,7 +657,9 @@ const isConditional = isOneOf([
652
657
  AST_NODE_TYPES.ConditionalExpression
653
658
  ]);
654
659
  function isNewResizeObserver(node) {
655
- return node?.type === AST_NODE_TYPES.NewExpression && node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === "ResizeObserver";
660
+ if (node?.type !== AST_NODE_TYPES.NewExpression) return false;
661
+ const callee = Extract.unwrap(node.callee);
662
+ return callee.type === AST_NODE_TYPES.Identifier && callee.name === "ResizeObserver";
656
663
  }
657
664
  function isFromObserver(context, node) {
658
665
  switch (true) {
@@ -669,9 +676,10 @@ function isFromObserver(context, node) {
669
676
  //#region src/rules/no-leaked-resize-observer/no-leaked-resize-observer.ts
670
677
  const RULE_NAME$1 = "no-leaked-resize-observer";
671
678
  function getCallKind$1(context, node) {
679
+ const callee = Extract.unwrap(node.callee);
672
680
  switch (true) {
673
- case node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(node.callee.name) && isFromObserver(context, node.callee): return node.callee.name;
674
- case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(node.callee.property.name) && isFromObserver(context, node.callee): return node.callee.property.name;
681
+ case callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(callee.name) && isFromObserver(context, callee): return callee.name;
682
+ case callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(callee.property.name) && isFromObserver(context, callee): return callee.property.name;
675
683
  default: return "other";
676
684
  }
677
685
  }
@@ -712,10 +720,11 @@ function create$1(context) {
712
720
  fEntries.pop();
713
721
  },
714
722
  ["CallExpression"](node) {
715
- if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return;
723
+ const unwrappedCallee = Extract.unwrap(node.callee);
724
+ if (unwrappedCallee.type !== AST_NODE_TYPES.MemberExpression) return;
716
725
  const fKind = fEntries.findLast((x) => x.kind !== "other")?.kind;
717
726
  if (fKind == null || !ComponentPhaseRelevance.has(fKind)) return;
718
- const { object } = node.callee;
727
+ const { object } = unwrappedCallee;
719
728
  match(getCallKind$1(context, node)).with("disconnect", () => {
720
729
  dEntries.push({
721
730
  kind: "ResizeObserver",
@@ -801,9 +810,10 @@ function create$1(context) {
801
810
  //#region src/rules/no-leaked-timeout/no-leaked-timeout.ts
802
811
  const RULE_NAME = "no-leaked-timeout";
803
812
  function getCallKind(node) {
813
+ const callee = Extract.unwrap(node.callee);
804
814
  switch (true) {
805
- case node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setTimeout", "clearTimeout"))(node.callee.name): return node.callee.name;
806
- case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setTimeout", "clearTimeout"))(node.callee.property.name): return node.callee.property.name;
815
+ case callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setTimeout", "clearTimeout"))(callee.name): return callee.name;
816
+ case callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setTimeout", "clearTimeout"))(callee.property.name): return callee.property.name;
807
817
  default: return "other";
808
818
  }
809
819
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-web-api",
3
- "version": "5.3.0-next.1",
3
+ "version": "5.3.1-beta.0",
4
4
  "description": "ESLint React's ESLint plugin for interacting with Web APIs",
5
5
  "keywords": [
6
6
  "react",
@@ -43,11 +43,11 @@
43
43
  "@typescript-eslint/utils": "^8.58.2",
44
44
  "birecord": "^0.1.1",
45
45
  "ts-pattern": "^5.9.0",
46
- "@eslint-react/ast": "5.3.0-next.1",
47
- "@eslint-react/core": "5.3.0-next.1",
48
- "@eslint-react/eslint": "5.3.0-next.1",
49
- "@eslint-react/shared": "5.3.0-next.1",
50
- "@eslint-react/var": "5.3.0-next.1"
46
+ "@eslint-react/ast": "5.3.1-beta.0",
47
+ "@eslint-react/eslint": "5.3.1-beta.0",
48
+ "@eslint-react/shared": "5.3.1-beta.0",
49
+ "@eslint-react/var": "5.3.1-beta.0",
50
+ "@eslint-react/core": "5.3.1-beta.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "^19.2.14",