eslint-plugin-react-web-api 5.14.8 → 5.14.10
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 +23 -37
- package/package.json +9 -9
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.
|
|
31
|
+
var version = "5.14.10";
|
|
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 &&
|
|
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
|
|
113
|
-
|
|
114
|
-
|
|
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 &&
|
|
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
|
-
|
|
266
|
-
|
|
267
|
-
case
|
|
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
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
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
|
|
700
|
-
|
|
701
|
-
|
|
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
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
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
|
|
971
|
-
|
|
972
|
-
|
|
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.
|
|
3
|
+
"version": "5.14.10",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,21 +41,21 @@
|
|
|
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.
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/shared": "5.14.
|
|
47
|
-
"@eslint-react/var": "5.14.
|
|
48
|
-
"@eslint-react/
|
|
44
|
+
"@eslint-react/ast": "5.14.10",
|
|
45
|
+
"@eslint-react/eslint": "5.14.10",
|
|
46
|
+
"@eslint-react/shared": "5.14.10",
|
|
47
|
+
"@eslint-react/var": "5.14.10",
|
|
48
|
+
"@eslint-react/core": "5.14.10"
|
|
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.
|
|
55
|
+
"tsdown": "^0.22.7",
|
|
56
56
|
"typescript": "6.0.3",
|
|
57
|
-
"@local/
|
|
58
|
-
"@local/
|
|
57
|
+
"@local/eff": "0.0.0",
|
|
58
|
+
"@local/configs": "0.0.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"eslint": "*",
|