eslint-plugin-react-web-api 3.0.0-next.60 → 3.0.0-next.62

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 +19 -5
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener } from "
2
2
  import * as ast from "@eslint-react/ast";
3
3
  import * as core from "@eslint-react/core";
4
4
  import { dual, or, unit } from "@eslint-react/eff";
5
- import { findEnclosingAssignmentTarget, findVariable, getVariableInitializer, isAssignmentTargetEqual, isValueEqual } from "@eslint-react/var";
5
+ import { findEnclosingAssignmentTarget, findVariable, isAssignmentTargetEqual, isValueEqual } from "@eslint-react/var";
6
6
  import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
7
7
  import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
8
8
  import { P, isMatching, match } from "ts-pattern";
@@ -27,7 +27,7 @@ var __exportAll = (all, no_symbols) => {
27
27
  //#endregion
28
28
  //#region package.json
29
29
  var name$1 = "eslint-plugin-react-web-api";
30
- var version = "3.0.0-next.60";
30
+ var version = "3.0.0-next.62";
31
31
 
32
32
  //#endregion
33
33
  //#region src/types/component-phase.ts
@@ -67,7 +67,7 @@ function getFunctionKind$1(node) {
67
67
  function getSignalValueExpression(node, initialScope) {
68
68
  if (node == null) return unit;
69
69
  switch (node.type) {
70
- case AST_NODE_TYPES.Identifier: return getSignalValueExpression(getVariableInitializer(findVariable(node, initialScope), 0), initialScope);
70
+ case AST_NODE_TYPES.Identifier: return getSignalValueExpression(resolve$1(findVariable(node, initialScope)), initialScope);
71
71
  case AST_NODE_TYPES.MemberExpression: return node;
72
72
  default: return unit;
73
73
  }
@@ -76,7 +76,7 @@ function getOptions(node, initialScope) {
76
76
  function getOpts(node) {
77
77
  switch (node.type) {
78
78
  case AST_NODE_TYPES.Identifier: {
79
- const variableNode = getVariableInitializer(findVariable(node, initialScope), 0);
79
+ const variableNode = resolve$1(findVariable(node, initialScope));
80
80
  if (variableNode?.type === AST_NODE_TYPES.ObjectExpression) return getOpts(variableNode);
81
81
  return defaultOptions;
82
82
  }
@@ -222,6 +222,13 @@ function create$3(context) {
222
222
  }
223
223
  });
224
224
  }
225
+ function resolve$1(v) {
226
+ if (v == null) return unit;
227
+ const def = v.defs.at(0);
228
+ if (def == null) return unit;
229
+ if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
230
+ return unit;
231
+ }
225
232
 
226
233
  //#endregion
227
234
  //#region src/rules/no-leaked-interval/no-leaked-interval.ts
@@ -341,7 +348,7 @@ function isNewResizeObserver(node) {
341
348
  }
342
349
  function isFromObserver(context, node) {
343
350
  switch (true) {
344
- case node.type === AST_NODE_TYPES.Identifier: return isNewResizeObserver(getVariableInitializer(findVariable(node, context.sourceCode.getScope(node)), 0));
351
+ case node.type === AST_NODE_TYPES.Identifier: return isNewResizeObserver(resolve(findVariable(node, context.sourceCode.getScope(node))));
345
352
  case node.type === AST_NODE_TYPES.MemberExpression: return isFromObserver(context, node.object);
346
353
  default: return false;
347
354
  }
@@ -474,6 +481,13 @@ function create$1(context) {
474
481
  }
475
482
  });
476
483
  }
484
+ function resolve(v) {
485
+ if (v == null) return unit;
486
+ const def = v.defs.at(0);
487
+ if (def == null) return unit;
488
+ if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
489
+ return unit;
490
+ }
477
491
 
478
492
  //#endregion
479
493
  //#region src/rules/no-leaked-timeout/no-leaked-timeout.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-web-api",
3
- "version": "3.0.0-next.60",
3
+ "version": "3.0.0-next.62",
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": "canary",
44
44
  "birecord": "^0.1.1",
45
45
  "ts-pattern": "^5.9.0",
46
- "@eslint-react/ast": "3.0.0-next.60",
47
- "@eslint-react/shared": "3.0.0-next.60",
48
- "@eslint-react/eff": "3.0.0-next.60",
49
- "@eslint-react/var": "3.0.0-next.60",
50
- "@eslint-react/core": "3.0.0-next.60"
46
+ "@eslint-react/ast": "3.0.0-next.62",
47
+ "@eslint-react/shared": "3.0.0-next.62",
48
+ "@eslint-react/eff": "3.0.0-next.62",
49
+ "@eslint-react/core": "3.0.0-next.62",
50
+ "@eslint-react/var": "3.0.0-next.62"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "^19.2.14",