eslint-plugin-react-web-api 2.0.0-next.193 → 2.0.0-next.194

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 +5 -29
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -38,36 +38,12 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
38
38
  //#endregion
39
39
  //#region package.json
40
40
  var name = "eslint-plugin-react-web-api";
41
- var version = "2.0.0-next.193";
41
+ var version = "2.0.0-next.194";
42
42
 
43
43
  //#endregion
44
44
  //#region src/utils/create-rule.ts
45
45
  const createRule = ESLintUtils.RuleCreator(getDocsUrl("web-api"));
46
46
 
47
- //#endregion
48
- //#region src/utils/get-phase-kind-of-function.ts
49
- function getPhaseKindOfFunction(node) {
50
- return match(node).when(isFunctionOfUseEffectSetup, () => "setup").when(isFunctionOfUseEffectCleanup, () => "cleanup").when(isFunctionOfComponentDidMount, () => "mount").when(isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => null);
51
- }
52
- function isFunctionOfUseEffectSetup(node) {
53
- if (node == null) return false;
54
- return node.parent?.type === AST_NODE_TYPES$1.CallExpression && node.parent.arguments.at(0) === node && ER.isUseEffectLikeCall(node.parent);
55
- }
56
- function isFunctionOfUseEffectCleanup(node) {
57
- if (node == null) return false;
58
- const pReturn = AST.findParentNode(node, AST.is(AST_NODE_TYPES$1.ReturnStatement));
59
- const pFunction = AST.findParentNode(node, AST.isFunction);
60
- const pFunctionOfReturn = AST.findParentNode(pReturn, AST.isFunction);
61
- if (pFunction !== pFunctionOfReturn) return false;
62
- return isFunctionOfUseEffectSetup(pFunction);
63
- }
64
- function isFunctionOfComponentDidMount(node) {
65
- return AST.isFunction(node) && ER.isComponentDidMount(node.parent) && node.parent.value === node;
66
- }
67
- function isFunctionOfComponentWillUnmount(node) {
68
- return AST.isFunction(node) && ER.isComponentWillUnmount(node.parent) && node.parent.value === node;
69
- }
70
-
71
47
  //#endregion
72
48
  //#region src/utils/is-conditional.ts
73
49
  const isControlFlow = or(AST.isLoop, AST.isOneOf([AST_NODE_TYPES$1.IfStatement, AST_NODE_TYPES$1.SwitchStatement]));
@@ -89,7 +65,7 @@ function getCallKind$3(node) {
89
65
  }
90
66
  }
91
67
  function getFunctionKind$1(node) {
92
- return getPhaseKindOfFunction(node) ?? "other";
68
+ return ER.getPhaseKindOfFunction(node) ?? "other";
93
69
  }
94
70
  function getSignalValueExpression(node, initialScope) {
95
71
  if (node == null) return unit;
@@ -306,7 +282,7 @@ function create$2(context) {
306
282
  }
307
283
  return {
308
284
  [":function"](node) {
309
- const kind = getPhaseKindOfFunction(node) ?? "other";
285
+ const kind = ER.getPhaseKindOfFunction(node) ?? "other";
310
286
  fEntries.push({
311
287
  kind,
312
288
  node
@@ -407,7 +383,7 @@ function getCallKind$1(context, node) {
407
383
  }
408
384
  }
409
385
  function getFunctionKind(node) {
410
- return getPhaseKindOfFunction(node) ?? "other";
386
+ return ER.getPhaseKindOfFunction(node) ?? "other";
411
387
  }
412
388
  var no_leaked_resize_observer_default = createRule({
413
389
  meta: {
@@ -570,7 +546,7 @@ function create(context) {
570
546
  }
571
547
  return {
572
548
  [":function"](node) {
573
- const kind = getPhaseKindOfFunction(node) ?? "other";
549
+ const kind = ER.getPhaseKindOfFunction(node) ?? "other";
574
550
  fEntries.push({
575
551
  kind,
576
552
  node
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-web-api",
3
- "version": "2.0.0-next.193",
3
+ "version": "2.0.0-next.194",
4
4
  "description": "ESLint React's ESLint plugin for interacting with Web APIs",
5
5
  "keywords": [
6
6
  "react",
@@ -40,12 +40,12 @@
40
40
  "@typescript-eslint/utils": "^8.44.1",
41
41
  "string-ts": "^2.2.1",
42
42
  "ts-pattern": "^5.8.0",
43
- "@eslint-react/ast": "2.0.0-next.193",
44
- "@eslint-react/core": "2.0.0-next.193",
45
- "@eslint-react/kit": "2.0.0-next.193",
46
- "@eslint-react/shared": "2.0.0-next.193",
47
- "@eslint-react/var": "2.0.0-next.193",
48
- "@eslint-react/eff": "2.0.0-next.193"
43
+ "@eslint-react/ast": "2.0.0-next.194",
44
+ "@eslint-react/core": "2.0.0-next.194",
45
+ "@eslint-react/eff": "2.0.0-next.194",
46
+ "@eslint-react/kit": "2.0.0-next.194",
47
+ "@eslint-react/shared": "2.0.0-next.194",
48
+ "@eslint-react/var": "2.0.0-next.194"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/react": "^19.1.13",