eslint-plugin-react-web-api 5.14.7 → 5.14.9

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 +23 -37
  2. package/package.json +7 -7
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.14.7";
31
+ var version = "5.14.9";
32
32
 
33
33
  //#endregion
34
34
  //#region src/types/component-phase.ts
@@ -48,7 +48,7 @@ const createRule = ESLintUtils.RuleCreator(getDocsUrl);
48
48
  //#region src/rules/no-leaked-event-listener/lib.ts
49
49
  function findProperty$1(node, name) {
50
50
  for (const property of node) {
51
- if (property.type === AST_NODE_TYPES.Property && Extract.getPropertyName(property.key, (n) => property.computed ? null : n.name) === name) return property;
51
+ if (property.type === AST_NODE_TYPES.Property && !property.computed && property.key.type === AST_NODE_TYPES.Identifier && property.key.name === name) return property;
52
52
  if (property.type === AST_NODE_TYPES.SpreadElement && property.argument.type === AST_NODE_TYPES.ObjectExpression) {
53
53
  const found = findProperty$1(property.argument.properties, name);
54
54
  if (found != null) return found;
@@ -109,12 +109,9 @@ function getOptions(context, node) {
109
109
  //#region src/rules/no-leaked-event-listener/no-leaked-event-listener.ts
110
110
  const RULE_NAME$5 = "no-leaked-event-listener";
111
111
  function getCallKind$5(node) {
112
- const callee = Extract.unwrap(node.callee);
113
- switch (true) {
114
- case callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("addEventListener", "removeEventListener", "abort"))(callee.name): return callee.name;
115
- 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
- default: return "other";
117
- }
112
+ const name = Extract.getCalleeName(node);
113
+ if (name != null && isMatching(P.union("addEventListener", "removeEventListener", "abort"))(name)) return name;
114
+ return "other";
118
115
  }
119
116
  function getFunctionKind$2(node) {
120
117
  return getPhaseKindOfFunction(node) ?? "other";
@@ -236,7 +233,7 @@ function create$5(context) {
236
233
  //#region src/rules/no-leaked-fetch/lib.ts
237
234
  function findProperty(node, name) {
238
235
  for (const property of node) {
239
- if (property.type === AST_NODE_TYPES.Property && Extract.getPropertyName(property.key, (n) => property.computed ? null : n.name) === name) return property;
236
+ if (property.type === AST_NODE_TYPES.Property && !property.computed && property.key.type === AST_NODE_TYPES.Identifier && property.key.name === name) return property;
240
237
  if (property.type === AST_NODE_TYPES.SpreadElement && property.argument.type === AST_NODE_TYPES.ObjectExpression) {
241
238
  const found = findProperty(property.argument.properties, name);
242
239
  if (found != null) return found;
@@ -262,12 +259,9 @@ function resolveToObjectExpression(context, node) {
262
259
  //#region src/rules/no-leaked-fetch/no-leaked-fetch.ts
263
260
  const RULE_NAME$4 = "no-leaked-fetch";
264
261
  function getCallKind$4(node) {
265
- const callee = Extract.unwrap(node.callee);
266
- switch (true) {
267
- case callee.type === AST_NODE_TYPES.Identifier && callee.name === "fetch": return "fetch";
268
- case callee.type === AST_NODE_TYPES.MemberExpression && Extract.getPropertyName(callee.property) === "fetch": return "fetch";
269
- case callee.type === AST_NODE_TYPES.Identifier && callee.name === "abort": return "abort";
270
- case callee.type === AST_NODE_TYPES.MemberExpression && Extract.getPropertyName(callee.property) === "abort": return "abort";
262
+ switch (Extract.getCalleeName(node)) {
263
+ case "fetch": return "fetch";
264
+ case "abort": return "abort";
271
265
  default: return "other";
272
266
  }
273
267
  }
@@ -562,11 +556,10 @@ function isFromObserver$1(context, node) {
562
556
  const RULE_NAME$3 = "no-leaked-intersection-observer";
563
557
  function getCallKind$3(context, node) {
564
558
  const callee = Extract.unwrap(node.callee);
565
- switch (true) {
566
- case callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(callee.name) && isFromObserver$1(context, callee): return callee.name;
567
- case callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(callee.property.name) && isFromObserver$1(context, callee): return callee.property.name;
568
- default: return "other";
569
- }
559
+ if (callee.type !== AST_NODE_TYPES.Identifier && callee.type !== AST_NODE_TYPES.MemberExpression) return "other";
560
+ const name = Extract.getCalleeName(node);
561
+ if (name != null && isMatching(P.union("observe", "unobserve", "disconnect"))(name) && isFromObserver$1(context, callee)) return name;
562
+ return "other";
570
563
  }
571
564
  function getFunctionKind$1(node) {
572
565
  return getPhaseKindOfFunction(node) ?? "other";
@@ -696,12 +689,9 @@ function create$3(context) {
696
689
  //#region src/rules/no-leaked-interval/no-leaked-interval.ts
697
690
  const RULE_NAME$2 = "no-leaked-interval";
698
691
  function getCallKind$2(node) {
699
- const callee = Extract.unwrap(node.callee);
700
- switch (true) {
701
- case callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setInterval", "clearInterval"))(callee.name): return callee.name;
702
- 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;
703
- default: return "other";
704
- }
692
+ const name = Extract.getCalleeName(node);
693
+ if (name != null && isMatching(P.union("setInterval", "clearInterval"))(name)) return name;
694
+ return "other";
705
695
  }
706
696
  var no_leaked_interval_default = createRule({
707
697
  meta: {
@@ -833,11 +823,10 @@ function isFromObserver(context, node) {
833
823
  const RULE_NAME$1 = "no-leaked-resize-observer";
834
824
  function getCallKind$1(context, node) {
835
825
  const callee = Extract.unwrap(node.callee);
836
- switch (true) {
837
- case callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(callee.name) && isFromObserver(context, callee): return callee.name;
838
- 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;
839
- default: return "other";
840
- }
826
+ if (callee.type !== AST_NODE_TYPES.Identifier && callee.type !== AST_NODE_TYPES.MemberExpression) return "other";
827
+ const name = Extract.getCalleeName(node);
828
+ if (name != null && isMatching(P.union("observe", "unobserve", "disconnect"))(name) && isFromObserver(context, callee)) return name;
829
+ return "other";
841
830
  }
842
831
  function getFunctionKind(node) {
843
832
  return getPhaseKindOfFunction(node) ?? "other";
@@ -967,12 +956,9 @@ function create$1(context) {
967
956
  //#region src/rules/no-leaked-timeout/no-leaked-timeout.ts
968
957
  const RULE_NAME = "no-leaked-timeout";
969
958
  function getCallKind(node) {
970
- const callee = Extract.unwrap(node.callee);
971
- switch (true) {
972
- case callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setTimeout", "clearTimeout"))(callee.name): return callee.name;
973
- 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;
974
- default: return "other";
975
- }
959
+ const name = Extract.getCalleeName(node);
960
+ if (name != null && isMatching(P.union("setTimeout", "clearTimeout"))(name)) return name;
961
+ return "other";
976
962
  }
977
963
  var no_leaked_timeout_default = createRule({
978
964
  meta: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-web-api",
3
- "version": "5.14.7",
3
+ "version": "5.14.9",
4
4
  "description": "ESLint React's ESLint plugin for interacting with Web APIs",
5
5
  "keywords": [
6
6
  "react",
@@ -41,18 +41,18 @@
41
41
  "@typescript-eslint/utils": "^8.63.0",
42
42
  "birecord": "^0.1.2",
43
43
  "ts-pattern": "^5.9.0",
44
- "@eslint-react/ast": "5.14.7",
45
- "@eslint-react/core": "5.14.7",
46
- "@eslint-react/eslint": "5.14.7",
47
- "@eslint-react/var": "5.14.7",
48
- "@eslint-react/shared": "5.14.7"
44
+ "@eslint-react/ast": "5.14.9",
45
+ "@eslint-react/var": "5.14.9",
46
+ "@eslint-react/shared": "5.14.9",
47
+ "@eslint-react/core": "5.14.9",
48
+ "@eslint-react/eslint": "5.14.9"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/react": "^19.2.17",
52
52
  "@types/react-dom": "^19.2.3",
53
53
  "dedent": "^1.7.2",
54
54
  "eslint": "^10.7.0",
55
- "tsdown": "^0.22.4",
55
+ "tsdown": "^0.22.7",
56
56
  "typescript": "6.0.3",
57
57
  "@local/configs": "0.0.0",
58
58
  "@local/eff": "0.0.0"