eslint-plugin-react-web-api 1.38.5-next.2 → 1.39.0-beta.1

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
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var shared = require('@eslint-react/shared');
4
+ var ER4 = require('@eslint-react/core');
4
5
  var AST = require('@eslint-react/ast');
5
- var core = require('@eslint-react/core');
6
6
  var eff = require('@eslint-react/eff');
7
7
  var VAR = require('@eslint-react/var');
8
8
  var utils = require('@typescript-eslint/utils');
@@ -26,6 +26,7 @@ function _interopNamespace(e) {
26
26
  return Object.freeze(n);
27
27
  }
28
28
 
29
+ var ER4__namespace = /*#__PURE__*/_interopNamespace(ER4);
29
30
  var AST__namespace = /*#__PURE__*/_interopNamespace(AST);
30
31
  var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
31
32
 
@@ -55,10 +56,10 @@ var settings = {
55
56
 
56
57
  // package.json
57
58
  var name2 = "eslint-plugin-react-web-api";
58
- var version = "1.38.5-next.2";
59
+ var version = "1.39.0-beta.1";
59
60
  var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("web-api"));
60
61
  function getPhaseKindOfFunction(node) {
61
- return tsPattern.match(node).when(core.isFunctionOfUseEffectSetup, () => "setup").when(core.isFunctionOfUseEffectCleanup, () => "cleanup").when(core.isFunctionOfComponentDidMount, () => "mount").when(core.isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => eff._);
62
+ return tsPattern.match(node).when(ER4__namespace.isFunctionOfUseEffectSetup, () => "setup").when(ER4__namespace.isFunctionOfUseEffectCleanup, () => "cleanup").when(ER4__namespace.isFunctionOfComponentDidMount, () => "mount").when(ER4__namespace.isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => eff._);
62
63
  }
63
64
 
64
65
  // src/rules/no-leaked-event-listener.ts
@@ -182,7 +183,7 @@ function create(context) {
182
183
  function isInverseEntry(aEntry, rEntry) {
183
184
  const { type: aType, callee: aCallee, capture: aCapture, listener: aListener, phase: aPhase } = aEntry;
184
185
  const { type: rType, callee: rCallee, capture: rCapture, listener: rListener, phase: rPhase } = rEntry;
185
- if (!core.isInversePhase(aPhase, rPhase)) {
186
+ if (!ER4__namespace.isInversePhase(aPhase, rPhase)) {
186
187
  return false;
187
188
  }
188
189
  return isSameObject(aCallee, rCallee) && AST__namespace.isNodeEqual(aListener, rListener) && VAR__namespace.isNodeValueEqual(aType, rType, [
@@ -217,7 +218,7 @@ function create(context) {
217
218
  if (fKind == null) {
218
219
  return;
219
220
  }
220
- if (!core.ERPhaseRelevance.has(fKind)) {
221
+ if (!ER4__namespace.ComponentPhaseRelevance.has(fKind)) {
221
222
  return;
222
223
  }
223
224
  tsPattern.match(getCallKind(node)).with("addEventListener", (callKind) => {
@@ -328,7 +329,7 @@ function create2(context) {
328
329
  const sEntries = [];
329
330
  const cEntries = [];
330
331
  function isInverseEntry(a, b) {
331
- return core.isInstanceIdEqual(context, a.timerId, b.timerId);
332
+ return ER4__namespace.isInstanceIdEqual(context, a.timerId, b.timerId);
332
333
  }
333
334
  return {
334
335
  [":function"](node) {
@@ -345,7 +346,7 @@ function create2(context) {
345
346
  if (fEntry == null) {
346
347
  break;
347
348
  }
348
- if (!core.ERPhaseRelevance.has(fEntry.kind)) {
349
+ if (!ER4__namespace.ComponentPhaseRelevance.has(fEntry.kind)) {
349
350
  break;
350
351
  }
351
352
  const intervalIdNode = VAR__namespace.getVariableDeclaratorId(node);
@@ -370,7 +371,7 @@ function create2(context) {
370
371
  if (fEntry == null) {
371
372
  break;
372
373
  }
373
- if (!core.ERPhaseRelevance.has(fEntry.kind)) {
374
+ if (!ER4__namespace.ComponentPhaseRelevance.has(fEntry.kind)) {
374
375
  break;
375
376
  }
376
377
  const [intervalIdNode] = node.arguments;
@@ -490,7 +491,7 @@ function create3(context) {
490
491
  return;
491
492
  }
492
493
  const fKind = fEntries.findLast((x) => x.kind !== "other")?.kind;
493
- if (fKind == null || !core.ERPhaseRelevance.has(fKind)) {
494
+ if (fKind == null || !ER4__namespace.ComponentPhaseRelevance.has(fKind)) {
494
495
  return;
495
496
  }
496
497
  const { object } = node.callee;
@@ -536,13 +537,13 @@ function create3(context) {
536
537
  ["NewExpression"](node) {
537
538
  const fEntry = fEntries.findLast((x) => x.kind !== "other");
538
539
  if (fEntry == null) return;
539
- if (!core.ERPhaseRelevance.has(fEntry.kind)) {
540
+ if (!ER4__namespace.ComponentPhaseRelevance.has(fEntry.kind)) {
540
541
  return;
541
542
  }
542
543
  if (!isNewResizeObserver(node)) {
543
544
  return;
544
545
  }
545
- const id = core.getInstanceId(node);
546
+ const id = ER4__namespace.getInstanceId(node);
546
547
  if (id == null) {
547
548
  context.report({
548
549
  messageId: "unexpectedFloatingInstance",
@@ -559,11 +560,11 @@ function create3(context) {
559
560
  },
560
561
  ["Program:exit"]() {
561
562
  for (const { id, node, phaseNode } of observers) {
562
- if (dEntries.some((e) => core.isInstanceIdEqual(context, e.observer, id))) {
563
+ if (dEntries.some((e) => ER4__namespace.isInstanceIdEqual(context, e.observer, id))) {
563
564
  continue;
564
565
  }
565
- const oentries = oEntries.filter((e) => core.isInstanceIdEqual(context, e.observer, id));
566
- const uentries = uEntries.filter((e) => core.isInstanceIdEqual(context, e.observer, id));
566
+ const oentries = oEntries.filter((e) => ER4__namespace.isInstanceIdEqual(context, e.observer, id));
567
+ const uentries = uEntries.filter((e) => ER4__namespace.isInstanceIdEqual(context, e.observer, id));
567
568
  const isDynamic = (node2) => node2?.type === utils.AST_NODE_TYPES.CallExpression || AST__namespace.isConditional(node2);
568
569
  const isPhaseNode = (node2) => node2 === phaseNode;
569
570
  const hasDynamicallyAdded = oentries.some((e) => !isPhaseNode(AST__namespace.findParentNode(e.node, eff.or(isDynamic, isPhaseNode))));
@@ -572,7 +573,7 @@ function create3(context) {
572
573
  continue;
573
574
  }
574
575
  for (const oEntry of oentries) {
575
- if (uentries.some((uEntry) => core.isInstanceIdEqual(context, uEntry.element, oEntry.element))) {
576
+ if (uentries.some((uEntry) => ER4__namespace.isInstanceIdEqual(context, uEntry.element, oEntry.element))) {
576
577
  continue;
577
578
  }
578
579
  context.report({ messageId: "expectedDisconnectOrUnobserveInCleanup", node: oEntry.node });
@@ -619,7 +620,7 @@ function create4(context) {
619
620
  const sEntries = [];
620
621
  const rEntries = [];
621
622
  function isInverseEntry(a, b) {
622
- return core.isInstanceIdEqual(context, a.timerId, b.timerId);
623
+ return ER4__namespace.isInstanceIdEqual(context, a.timerId, b.timerId);
623
624
  }
624
625
  return {
625
626
  [":function"](node) {
@@ -631,7 +632,7 @@ function create4(context) {
631
632
  },
632
633
  ["CallExpression"](node) {
633
634
  const fEntry = fEntries.findLast((f) => f.kind !== "other");
634
- if (!core.ERPhaseRelevance.has(fEntry?.kind)) {
635
+ if (!ER4__namespace.ComponentPhaseRelevance.has(fEntry?.kind)) {
635
636
  return;
636
637
  }
637
638
  switch (getCallKind4(node)) {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getDocsUrl, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
2
+ import * as ER4 from '@eslint-react/core';
2
3
  import * as AST from '@eslint-react/ast';
3
- import { ERPhaseRelevance, isInstanceIdEqual, getInstanceId, isInversePhase, isFunctionOfUseEffectSetup, isFunctionOfUseEffectCleanup, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount } from '@eslint-react/core';
4
4
  import { _, or } from '@eslint-react/eff';
5
5
  import * as VAR from '@eslint-react/var';
6
6
  import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';
@@ -32,10 +32,10 @@ var settings = {
32
32
 
33
33
  // package.json
34
34
  var name2 = "eslint-plugin-react-web-api";
35
- var version = "1.38.5-next.2";
35
+ var version = "1.39.0-beta.1";
36
36
  var createRule = ESLintUtils.RuleCreator(getDocsUrl("web-api"));
37
37
  function getPhaseKindOfFunction(node) {
38
- return match(node).when(isFunctionOfUseEffectSetup, () => "setup").when(isFunctionOfUseEffectCleanup, () => "cleanup").when(isFunctionOfComponentDidMount, () => "mount").when(isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => _);
38
+ return match(node).when(ER4.isFunctionOfUseEffectSetup, () => "setup").when(ER4.isFunctionOfUseEffectCleanup, () => "cleanup").when(ER4.isFunctionOfComponentDidMount, () => "mount").when(ER4.isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => _);
39
39
  }
40
40
 
41
41
  // src/rules/no-leaked-event-listener.ts
@@ -159,7 +159,7 @@ function create(context) {
159
159
  function isInverseEntry(aEntry, rEntry) {
160
160
  const { type: aType, callee: aCallee, capture: aCapture, listener: aListener, phase: aPhase } = aEntry;
161
161
  const { type: rType, callee: rCallee, capture: rCapture, listener: rListener, phase: rPhase } = rEntry;
162
- if (!isInversePhase(aPhase, rPhase)) {
162
+ if (!ER4.isInversePhase(aPhase, rPhase)) {
163
163
  return false;
164
164
  }
165
165
  return isSameObject(aCallee, rCallee) && AST.isNodeEqual(aListener, rListener) && VAR.isNodeValueEqual(aType, rType, [
@@ -194,7 +194,7 @@ function create(context) {
194
194
  if (fKind == null) {
195
195
  return;
196
196
  }
197
- if (!ERPhaseRelevance.has(fKind)) {
197
+ if (!ER4.ComponentPhaseRelevance.has(fKind)) {
198
198
  return;
199
199
  }
200
200
  match(getCallKind(node)).with("addEventListener", (callKind) => {
@@ -305,7 +305,7 @@ function create2(context) {
305
305
  const sEntries = [];
306
306
  const cEntries = [];
307
307
  function isInverseEntry(a, b) {
308
- return isInstanceIdEqual(context, a.timerId, b.timerId);
308
+ return ER4.isInstanceIdEqual(context, a.timerId, b.timerId);
309
309
  }
310
310
  return {
311
311
  [":function"](node) {
@@ -322,7 +322,7 @@ function create2(context) {
322
322
  if (fEntry == null) {
323
323
  break;
324
324
  }
325
- if (!ERPhaseRelevance.has(fEntry.kind)) {
325
+ if (!ER4.ComponentPhaseRelevance.has(fEntry.kind)) {
326
326
  break;
327
327
  }
328
328
  const intervalIdNode = VAR.getVariableDeclaratorId(node);
@@ -347,7 +347,7 @@ function create2(context) {
347
347
  if (fEntry == null) {
348
348
  break;
349
349
  }
350
- if (!ERPhaseRelevance.has(fEntry.kind)) {
350
+ if (!ER4.ComponentPhaseRelevance.has(fEntry.kind)) {
351
351
  break;
352
352
  }
353
353
  const [intervalIdNode] = node.arguments;
@@ -467,7 +467,7 @@ function create3(context) {
467
467
  return;
468
468
  }
469
469
  const fKind = fEntries.findLast((x) => x.kind !== "other")?.kind;
470
- if (fKind == null || !ERPhaseRelevance.has(fKind)) {
470
+ if (fKind == null || !ER4.ComponentPhaseRelevance.has(fKind)) {
471
471
  return;
472
472
  }
473
473
  const { object } = node.callee;
@@ -513,13 +513,13 @@ function create3(context) {
513
513
  ["NewExpression"](node) {
514
514
  const fEntry = fEntries.findLast((x) => x.kind !== "other");
515
515
  if (fEntry == null) return;
516
- if (!ERPhaseRelevance.has(fEntry.kind)) {
516
+ if (!ER4.ComponentPhaseRelevance.has(fEntry.kind)) {
517
517
  return;
518
518
  }
519
519
  if (!isNewResizeObserver(node)) {
520
520
  return;
521
521
  }
522
- const id = getInstanceId(node);
522
+ const id = ER4.getInstanceId(node);
523
523
  if (id == null) {
524
524
  context.report({
525
525
  messageId: "unexpectedFloatingInstance",
@@ -536,11 +536,11 @@ function create3(context) {
536
536
  },
537
537
  ["Program:exit"]() {
538
538
  for (const { id, node, phaseNode } of observers) {
539
- if (dEntries.some((e) => isInstanceIdEqual(context, e.observer, id))) {
539
+ if (dEntries.some((e) => ER4.isInstanceIdEqual(context, e.observer, id))) {
540
540
  continue;
541
541
  }
542
- const oentries = oEntries.filter((e) => isInstanceIdEqual(context, e.observer, id));
543
- const uentries = uEntries.filter((e) => isInstanceIdEqual(context, e.observer, id));
542
+ const oentries = oEntries.filter((e) => ER4.isInstanceIdEqual(context, e.observer, id));
543
+ const uentries = uEntries.filter((e) => ER4.isInstanceIdEqual(context, e.observer, id));
544
544
  const isDynamic = (node2) => node2?.type === AST_NODE_TYPES.CallExpression || AST.isConditional(node2);
545
545
  const isPhaseNode = (node2) => node2 === phaseNode;
546
546
  const hasDynamicallyAdded = oentries.some((e) => !isPhaseNode(AST.findParentNode(e.node, or(isDynamic, isPhaseNode))));
@@ -549,7 +549,7 @@ function create3(context) {
549
549
  continue;
550
550
  }
551
551
  for (const oEntry of oentries) {
552
- if (uentries.some((uEntry) => isInstanceIdEqual(context, uEntry.element, oEntry.element))) {
552
+ if (uentries.some((uEntry) => ER4.isInstanceIdEqual(context, uEntry.element, oEntry.element))) {
553
553
  continue;
554
554
  }
555
555
  context.report({ messageId: "expectedDisconnectOrUnobserveInCleanup", node: oEntry.node });
@@ -596,7 +596,7 @@ function create4(context) {
596
596
  const sEntries = [];
597
597
  const rEntries = [];
598
598
  function isInverseEntry(a, b) {
599
- return isInstanceIdEqual(context, a.timerId, b.timerId);
599
+ return ER4.isInstanceIdEqual(context, a.timerId, b.timerId);
600
600
  }
601
601
  return {
602
602
  [":function"](node) {
@@ -608,7 +608,7 @@ function create4(context) {
608
608
  },
609
609
  ["CallExpression"](node) {
610
610
  const fEntry = fEntries.findLast((f) => f.kind !== "other");
611
- if (!ERPhaseRelevance.has(fEntry?.kind)) {
611
+ if (!ER4.ComponentPhaseRelevance.has(fEntry?.kind)) {
612
612
  return;
613
613
  }
614
614
  switch (getCallKind4(node)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-web-api",
3
- "version": "1.38.5-next.2",
3
+ "version": "1.39.0-beta.1",
4
4
  "description": "ESLint React's ESLint plugin for interacting with Web APIs",
5
5
  "keywords": [
6
6
  "react",
@@ -48,13 +48,13 @@
48
48
  "@typescript-eslint/utils": "^8.28.0",
49
49
  "string-ts": "^2.2.1",
50
50
  "ts-pattern": "^5.7.0",
51
- "@eslint-react/core": "1.38.5-next.2",
52
- "@eslint-react/ast": "1.38.5-next.2",
53
- "@eslint-react/eff": "1.38.5-next.2",
54
- "@eslint-react/kit": "1.38.5-next.2",
55
- "@eslint-react/shared": "1.38.5-next.2",
56
- "@eslint-react/jsx": "1.38.5-next.2",
57
- "@eslint-react/var": "1.38.5-next.2"
51
+ "@eslint-react/ast": "1.39.0-beta.1",
52
+ "@eslint-react/core": "1.39.0-beta.1",
53
+ "@eslint-react/jsx": "1.39.0-beta.1",
54
+ "@eslint-react/eff": "1.39.0-beta.1",
55
+ "@eslint-react/kit": "1.39.0-beta.1",
56
+ "@eslint-react/var": "1.39.0-beta.1",
57
+ "@eslint-react/shared": "1.39.0-beta.1"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/react": "^19.0.12",