eslint-plugin-react-web-api 1.28.0-next.2 → 1.28.0-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
@@ -55,12 +55,12 @@ var settings = {
55
55
 
56
56
  // package.json
57
57
  var name2 = "eslint-plugin-react-web-api";
58
- var version = "1.28.0-next.2";
58
+ var version = "1.28.0-next.4";
59
59
  var createRule = shared.createRuleForPlugin("web-api");
60
60
  function getPhaseKindOfFunction(node) {
61
61
  return tsPattern.match(node).when(core.isFunctionOfUseEffectSetup, () => "setup").when(core.isFunctionOfUseEffectCleanup, () => "cleanup").when(core.isFunctionOfComponentDidMount, () => "mount").when(core.isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => eff._);
62
62
  }
63
- function isInstanceIdEqual(a, b, context) {
63
+ function isInstanceIdEqual(context, a, b) {
64
64
  return VAR2__namespace.isVariableIdEqual(a, b, [
65
65
  context.sourceCode.getScope(a),
66
66
  context.sourceCode.getScope(b)
@@ -334,7 +334,7 @@ var no_leaked_interval_default = createRule({
334
334
  const sEntries = [];
335
335
  const cEntries = [];
336
336
  function isInverseEntry(a, b) {
337
- return isInstanceIdEqual(a.timerId, b.timerId, context);
337
+ return isInstanceIdEqual(context, a.timerId, b.timerId);
338
338
  }
339
339
  return {
340
340
  [":function"](node) {
@@ -434,7 +434,7 @@ var RULE_FEATURES3 = [
434
434
  function isNewResizeObserver(node) {
435
435
  return node?.type === utils.AST_NODE_TYPES.NewExpression && node.callee.type === utils.AST_NODE_TYPES.Identifier && node.callee.name === "ResizeObserver";
436
436
  }
437
- function isFromObserver(node, context) {
437
+ function isFromObserver(context, node) {
438
438
  switch (true) {
439
439
  case node.type === utils.AST_NODE_TYPES.Identifier: {
440
440
  const initialScope = context.sourceCode.getScope(node);
@@ -442,16 +442,16 @@ function isFromObserver(node, context) {
442
442
  return isNewResizeObserver(object);
443
443
  }
444
444
  case node.type === utils.AST_NODE_TYPES.MemberExpression:
445
- return isFromObserver(node.object, context);
445
+ return isFromObserver(context, node.object);
446
446
  default:
447
447
  return false;
448
448
  }
449
449
  }
450
- function getCallKind3(node, context) {
450
+ function getCallKind3(context, node) {
451
451
  switch (true) {
452
- case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("observe", "unobserve", "disconnect"))(node.callee.name) && isFromObserver(node.callee, context)):
452
+ case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("observe", "unobserve", "disconnect"))(node.callee.name) && isFromObserver(context, node.callee)):
453
453
  return node.callee.name;
454
- case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("observe", "unobserve", "disconnect"))(node.callee.property.name) && isFromObserver(node.callee, context)):
454
+ case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("observe", "unobserve", "disconnect"))(node.callee.property.name) && isFromObserver(context, node.callee)):
455
455
  return node.callee.property.name;
456
456
  default:
457
457
  return "other";
@@ -501,7 +501,7 @@ var no_leaked_resize_observer_default = createRule({
501
501
  return;
502
502
  }
503
503
  const { object } = node.callee;
504
- tsPattern.match(getCallKind3(node, context)).with("disconnect", () => {
504
+ tsPattern.match(getCallKind3(context, node)).with("disconnect", () => {
505
505
  dEntries.push({
506
506
  kind: "disconnect",
507
507
  node,
@@ -566,11 +566,11 @@ var no_leaked_resize_observer_default = createRule({
566
566
  },
567
567
  ["Program:exit"]() {
568
568
  for (const { id, node, phaseNode } of observers) {
569
- if (dEntries.some((e) => isInstanceIdEqual(e.observer, id, context))) {
569
+ if (dEntries.some((e) => isInstanceIdEqual(context, e.observer, id))) {
570
570
  continue;
571
571
  }
572
- const oentries = oEntries.filter((e) => isInstanceIdEqual(e.observer, id, context));
573
- const uentries = uEntries.filter((e) => isInstanceIdEqual(e.observer, id, context));
572
+ const oentries = oEntries.filter((e) => isInstanceIdEqual(context, e.observer, id));
573
+ const uentries = uEntries.filter((e) => isInstanceIdEqual(context, e.observer, id));
574
574
  const isDynamic = (node2) => node2?.type === utils.AST_NODE_TYPES.CallExpression || AST__namespace.isConditional(node2);
575
575
  const isPhaseNode = (node2) => node2 === phaseNode;
576
576
  const hasDynamicallyAdded = oentries.some((e) => !isPhaseNode(AST__namespace.findParentNode(e.node, eff.or(isDynamic, isPhaseNode))));
@@ -579,7 +579,7 @@ var no_leaked_resize_observer_default = createRule({
579
579
  continue;
580
580
  }
581
581
  for (const oEntry of oentries) {
582
- if (uentries.some((uEntry) => isInstanceIdEqual(uEntry.element, oEntry.element, context))) {
582
+ if (uentries.some((uEntry) => isInstanceIdEqual(context, uEntry.element, oEntry.element))) {
583
583
  continue;
584
584
  }
585
585
  context.report({ messageId: "expectedDisconnectOrUnobserveInCleanup", node: oEntry.node });
@@ -627,7 +627,7 @@ var no_leaked_timeout_default = createRule({
627
627
  const sEntries = [];
628
628
  const rEntries = [];
629
629
  function isInverseEntry(a, b) {
630
- return isInstanceIdEqual(a.timerId, b.timerId, context);
630
+ return isInstanceIdEqual(context, a.timerId, b.timerId);
631
631
  }
632
632
  return {
633
633
  [":function"](node) {
package/dist/index.mjs CHANGED
@@ -32,12 +32,12 @@ var settings = {
32
32
 
33
33
  // package.json
34
34
  var name2 = "eslint-plugin-react-web-api";
35
- var version = "1.28.0-next.2";
35
+ var version = "1.28.0-next.4";
36
36
  var createRule = createRuleForPlugin("web-api");
37
37
  function getPhaseKindOfFunction(node) {
38
38
  return match(node).when(isFunctionOfUseEffectSetup, () => "setup").when(isFunctionOfUseEffectCleanup, () => "cleanup").when(isFunctionOfComponentDidMount, () => "mount").when(isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => _);
39
39
  }
40
- function isInstanceIdEqual(a, b, context) {
40
+ function isInstanceIdEqual(context, a, b) {
41
41
  return VAR2.isVariableIdEqual(a, b, [
42
42
  context.sourceCode.getScope(a),
43
43
  context.sourceCode.getScope(b)
@@ -311,7 +311,7 @@ var no_leaked_interval_default = createRule({
311
311
  const sEntries = [];
312
312
  const cEntries = [];
313
313
  function isInverseEntry(a, b) {
314
- return isInstanceIdEqual(a.timerId, b.timerId, context);
314
+ return isInstanceIdEqual(context, a.timerId, b.timerId);
315
315
  }
316
316
  return {
317
317
  [":function"](node) {
@@ -411,7 +411,7 @@ var RULE_FEATURES3 = [
411
411
  function isNewResizeObserver(node) {
412
412
  return node?.type === AST_NODE_TYPES.NewExpression && node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === "ResizeObserver";
413
413
  }
414
- function isFromObserver(node, context) {
414
+ function isFromObserver(context, node) {
415
415
  switch (true) {
416
416
  case node.type === AST_NODE_TYPES.Identifier: {
417
417
  const initialScope = context.sourceCode.getScope(node);
@@ -419,16 +419,16 @@ function isFromObserver(node, context) {
419
419
  return isNewResizeObserver(object);
420
420
  }
421
421
  case node.type === AST_NODE_TYPES.MemberExpression:
422
- return isFromObserver(node.object, context);
422
+ return isFromObserver(context, node.object);
423
423
  default:
424
424
  return false;
425
425
  }
426
426
  }
427
- function getCallKind3(node, context) {
427
+ function getCallKind3(context, node) {
428
428
  switch (true) {
429
- case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(node.callee.name) && isFromObserver(node.callee, context)):
429
+ case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(node.callee.name) && isFromObserver(context, node.callee)):
430
430
  return node.callee.name;
431
- 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(node.callee, context)):
431
+ 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)):
432
432
  return node.callee.property.name;
433
433
  default:
434
434
  return "other";
@@ -478,7 +478,7 @@ var no_leaked_resize_observer_default = createRule({
478
478
  return;
479
479
  }
480
480
  const { object } = node.callee;
481
- match(getCallKind3(node, context)).with("disconnect", () => {
481
+ match(getCallKind3(context, node)).with("disconnect", () => {
482
482
  dEntries.push({
483
483
  kind: "disconnect",
484
484
  node,
@@ -543,11 +543,11 @@ var no_leaked_resize_observer_default = createRule({
543
543
  },
544
544
  ["Program:exit"]() {
545
545
  for (const { id, node, phaseNode } of observers) {
546
- if (dEntries.some((e) => isInstanceIdEqual(e.observer, id, context))) {
546
+ if (dEntries.some((e) => isInstanceIdEqual(context, e.observer, id))) {
547
547
  continue;
548
548
  }
549
- const oentries = oEntries.filter((e) => isInstanceIdEqual(e.observer, id, context));
550
- const uentries = uEntries.filter((e) => isInstanceIdEqual(e.observer, id, context));
549
+ const oentries = oEntries.filter((e) => isInstanceIdEqual(context, e.observer, id));
550
+ const uentries = uEntries.filter((e) => isInstanceIdEqual(context, e.observer, id));
551
551
  const isDynamic = (node2) => node2?.type === AST_NODE_TYPES.CallExpression || AST.isConditional(node2);
552
552
  const isPhaseNode = (node2) => node2 === phaseNode;
553
553
  const hasDynamicallyAdded = oentries.some((e) => !isPhaseNode(AST.findParentNode(e.node, or(isDynamic, isPhaseNode))));
@@ -556,7 +556,7 @@ var no_leaked_resize_observer_default = createRule({
556
556
  continue;
557
557
  }
558
558
  for (const oEntry of oentries) {
559
- if (uentries.some((uEntry) => isInstanceIdEqual(uEntry.element, oEntry.element, context))) {
559
+ if (uentries.some((uEntry) => isInstanceIdEqual(context, uEntry.element, oEntry.element))) {
560
560
  continue;
561
561
  }
562
562
  context.report({ messageId: "expectedDisconnectOrUnobserveInCleanup", node: oEntry.node });
@@ -604,7 +604,7 @@ var no_leaked_timeout_default = createRule({
604
604
  const sEntries = [];
605
605
  const rEntries = [];
606
606
  function isInverseEntry(a, b) {
607
- return isInstanceIdEqual(a.timerId, b.timerId, context);
607
+ return isInstanceIdEqual(context, a.timerId, b.timerId);
608
608
  }
609
609
  return {
610
610
  [":function"](node) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-web-api",
3
- "version": "1.28.0-next.2",
3
+ "version": "1.28.0-next.4",
4
4
  "description": "ESLint React's ESLint plugin for interacting with Web APIs",
5
5
  "keywords": [
6
6
  "react",
@@ -48,12 +48,12 @@
48
48
  "@typescript-eslint/utils": "^8.25.0",
49
49
  "string-ts": "^2.2.1",
50
50
  "ts-pattern": "^5.6.2",
51
- "@eslint-react/ast": "1.28.0-next.2",
52
- "@eslint-react/core": "1.28.0-next.2",
53
- "@eslint-react/eff": "1.28.0-next.2",
54
- "@eslint-react/jsx": "1.28.0-next.2",
55
- "@eslint-react/shared": "1.28.0-next.2",
56
- "@eslint-react/var": "1.28.0-next.2"
51
+ "@eslint-react/core": "1.28.0-next.4",
52
+ "@eslint-react/ast": "1.28.0-next.4",
53
+ "@eslint-react/eff": "1.28.0-next.4",
54
+ "@eslint-react/jsx": "1.28.0-next.4",
55
+ "@eslint-react/shared": "1.28.0-next.4",
56
+ "@eslint-react/var": "1.28.0-next.4"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/react": "^19.0.10",