eslint-plugin-react-web-api 5.2.2-next.0 → 5.2.3-beta.0

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 +18 -4
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_ESLINT_REACT_SETTINGS } from "@eslint-react/shared";
2
- import { Check, Compare, Traverse, isOneOf } from "@eslint-react/ast";
2
+ import { Check, Compare, Extract, Traverse, isOneOf } from "@eslint-react/ast";
3
3
  import * as core from "@eslint-react/core";
4
4
  import { merge } from "@eslint-react/eslint";
5
5
  import { isAssignmentTargetEqual, isValueEqual, resolve, resolveEnclosingAssignmentTarget } from "@eslint-react/var";
@@ -7,6 +7,7 @@ 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";
9
9
  import birecord from "birecord";
10
+ import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from "@typescript-eslint/types";
10
11
 
11
12
  //#region \0rolldown/runtime.js
12
13
  var __defProp = Object.defineProperty;
@@ -27,7 +28,7 @@ var __exportAll = (all, no_symbols) => {
27
28
  //#endregion
28
29
  //#region package.json
29
30
  var name$1 = "eslint-plugin-react-web-api";
30
- var version = "5.2.2-next.0";
31
+ var version = "5.2.3-beta.0";
31
32
 
32
33
  //#endregion
33
34
  //#region src/types/component-phase.ts
@@ -43,6 +44,19 @@ function getDocsUrl(ruleName) {
43
44
  }
44
45
  const createRule = ESLintUtils.RuleCreator(getDocsUrl);
45
46
 
47
+ //#endregion
48
+ //#region src/rules/no-leaked-event-listener/lib.ts
49
+ function findProperty(of, named) {
50
+ for (const property of of) {
51
+ if (property.type === AST_NODE_TYPES$1.Property && Extract.propertyName(property.key) === named) return property;
52
+ if (property.type === AST_NODE_TYPES$1.SpreadElement && property.argument.type === AST_NODE_TYPES$1.ObjectExpression) {
53
+ const found = findProperty(property.argument.properties, named);
54
+ if (found != null) return found;
55
+ }
56
+ }
57
+ return null;
58
+ }
59
+
46
60
  //#endregion
47
61
  //#region src/rules/no-leaked-event-listener/no-leaked-event-listener.ts
48
62
  const RULE_NAME$3 = "no-leaked-event-listener";
@@ -86,14 +100,14 @@ function getOptions(context, node) {
86
100
  capture: Boolean(node.value)
87
101
  };
88
102
  case AST_NODE_TYPES.ObjectExpression: {
89
- const vCapture = match(Traverse.findProperty(node.properties, "capture")).with(P.nullish, () => false).with({ type: AST_NODE_TYPES.Property }, (prop) => {
103
+ const vCapture = match(findProperty(node.properties, "capture")).with(P.nullish, () => false).with({ type: AST_NODE_TYPES.Property }, (prop) => {
90
104
  const value = prop.value;
91
105
  switch (value.type) {
92
106
  case AST_NODE_TYPES.Literal: return Boolean(value.value);
93
107
  default: return Boolean(getStaticValue(value, initialScope)?.value);
94
108
  }
95
109
  }).otherwise(() => false);
96
- const pSignal = Traverse.findProperty(node.properties, "signal");
110
+ const pSignal = findProperty(node.properties, "signal");
97
111
  return {
98
112
  capture: vCapture,
99
113
  signal: pSignal?.type === AST_NODE_TYPES.Property ? getSignalValueExpression(context, pSignal.value) : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-web-api",
3
- "version": "5.2.2-next.0",
3
+ "version": "5.2.3-beta.0",
4
4
  "description": "ESLint React's ESLint plugin for interacting with Web APIs",
5
5
  "keywords": [
6
6
  "react",
@@ -38,22 +38,22 @@
38
38
  "./package.json"
39
39
  ],
40
40
  "dependencies": {
41
- "@typescript-eslint/scope-manager": "^8.58.1",
42
- "@typescript-eslint/types": "^8.58.1",
43
- "@typescript-eslint/utils": "^8.58.1",
41
+ "@typescript-eslint/scope-manager": "^8.58.2",
42
+ "@typescript-eslint/types": "^8.58.2",
43
+ "@typescript-eslint/utils": "^8.58.2",
44
44
  "birecord": "^0.1.1",
45
45
  "ts-pattern": "^5.9.0",
46
- "@eslint-react/core": "5.2.2-next.0",
47
- "@eslint-react/ast": "5.2.2-next.0",
48
- "@eslint-react/eslint": "5.2.2-next.0",
49
- "@eslint-react/shared": "5.2.2-next.0",
50
- "@eslint-react/var": "5.2.2-next.0"
46
+ "@eslint-react/core": "5.2.3-beta.0",
47
+ "@eslint-react/eslint": "5.2.3-beta.0",
48
+ "@eslint-react/shared": "5.2.3-beta.0",
49
+ "@eslint-react/ast": "5.2.3-beta.0",
50
+ "@eslint-react/var": "5.2.3-beta.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "^19.2.14",
54
54
  "@types/react-dom": "^19.2.3",
55
55
  "eslint": "^10.2.0",
56
- "tsdown": "^0.21.7",
56
+ "tsdown": "^0.21.8",
57
57
  "@local/configs": "0.0.0",
58
58
  "@local/eff": "3.0.0-beta.72"
59
59
  },