eslint-plugin-react-web-api 1.15.0-next.9 → 1.15.1-beta.2
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 +38 -38
- package/dist/index.mjs +38 -38
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var VAR2__namespace = /*#__PURE__*/_interopNamespace(VAR2);
|
|
|
35
35
|
|
|
36
36
|
// package.json
|
|
37
37
|
var name = "eslint-plugin-react-web-api";
|
|
38
|
-
var version = "1.15.
|
|
38
|
+
var version = "1.15.1-beta.2";
|
|
39
39
|
var createRule = shared.createRuleForPlugin("web-api");
|
|
40
40
|
function getInstanceID(node, prev) {
|
|
41
41
|
switch (true) {
|
|
@@ -95,6 +95,15 @@ function getOptions(node, initialScope) {
|
|
|
95
95
|
};
|
|
96
96
|
function getOpts(node2) {
|
|
97
97
|
switch (node2.type) {
|
|
98
|
+
case utils.AST_NODE_TYPES.Identifier: {
|
|
99
|
+
return tools.F.pipe(
|
|
100
|
+
VAR2__namespace.findVariable(node2, initialScope),
|
|
101
|
+
tools.O.flatMap(VAR2__namespace.getVariableNode(0)),
|
|
102
|
+
tools.O.filter(AST2__namespace.is(utils.AST_NODE_TYPES.ObjectExpression)),
|
|
103
|
+
tools.O.map(getOpts),
|
|
104
|
+
tools.O.getOrElse(() => defaultOptions)
|
|
105
|
+
);
|
|
106
|
+
}
|
|
98
107
|
case utils.AST_NODE_TYPES.Literal: {
|
|
99
108
|
return tools.Data.struct({ ...defaultOptions, capture: tools.O.some(!!node2.value) });
|
|
100
109
|
}
|
|
@@ -109,14 +118,14 @@ function getOptions(node, initialScope) {
|
|
|
109
118
|
const { value } = prop;
|
|
110
119
|
const getSignalExp = (node3) => {
|
|
111
120
|
switch (node3.type) {
|
|
112
|
-
case utils.AST_NODE_TYPES.MemberExpression:
|
|
113
|
-
return tools.O.some(node3);
|
|
114
121
|
case utils.AST_NODE_TYPES.Identifier:
|
|
115
122
|
return tools.F.pipe(
|
|
116
123
|
VAR2__namespace.findVariable(node3, initialScope),
|
|
117
124
|
tools.O.flatMap(VAR2__namespace.getVariableNode(0)),
|
|
118
125
|
tools.O.flatMap(getSignalExp)
|
|
119
126
|
);
|
|
127
|
+
case utils.AST_NODE_TYPES.MemberExpression:
|
|
128
|
+
return tools.O.some(node3);
|
|
120
129
|
default:
|
|
121
130
|
return tools.O.none();
|
|
122
131
|
}
|
|
@@ -125,15 +134,6 @@ function getOptions(node, initialScope) {
|
|
|
125
134
|
});
|
|
126
135
|
return tools.Data.struct({ capture: vCapture, once: vOnce, signal: vSignal });
|
|
127
136
|
}
|
|
128
|
-
case utils.AST_NODE_TYPES.Identifier: {
|
|
129
|
-
return tools.F.pipe(
|
|
130
|
-
VAR2__namespace.findVariable(node2, initialScope),
|
|
131
|
-
tools.O.flatMap(VAR2__namespace.getVariableNode(0)),
|
|
132
|
-
tools.O.filter(AST2__namespace.is(utils.AST_NODE_TYPES.ObjectExpression)),
|
|
133
|
-
tools.O.map(getOpts),
|
|
134
|
-
tools.O.getOrElse(() => defaultOptions)
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
137
|
default: {
|
|
138
138
|
return defaultOptions;
|
|
139
139
|
}
|
|
@@ -306,19 +306,13 @@ var no_leaked_interval_default = createRule({
|
|
|
306
306
|
},
|
|
307
307
|
["CallExpression"](node) {
|
|
308
308
|
switch (getCallKind2(node)) {
|
|
309
|
-
case "
|
|
309
|
+
case "clearInterval": {
|
|
310
310
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
311
311
|
if (!fNode || !fKind) break;
|
|
312
312
|
if (!core.PHASE_RELEVANCE.has(fKind)) break;
|
|
313
|
-
const intervalIdNode =
|
|
314
|
-
if (!intervalIdNode)
|
|
315
|
-
|
|
316
|
-
messageId: "noLeakedIntervalNoIntervalId",
|
|
317
|
-
node
|
|
318
|
-
});
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
sEntries.push({
|
|
313
|
+
const [intervalIdNode] = node.arguments;
|
|
314
|
+
if (!intervalIdNode) break;
|
|
315
|
+
cEntries.push({
|
|
322
316
|
kind: "interval",
|
|
323
317
|
node,
|
|
324
318
|
callee: node.callee,
|
|
@@ -327,13 +321,19 @@ var no_leaked_interval_default = createRule({
|
|
|
327
321
|
});
|
|
328
322
|
break;
|
|
329
323
|
}
|
|
330
|
-
case "
|
|
324
|
+
case "setInterval": {
|
|
331
325
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
332
326
|
if (!fNode || !fKind) break;
|
|
333
327
|
if (!core.PHASE_RELEVANCE.has(fKind)) break;
|
|
334
|
-
const
|
|
335
|
-
if (!intervalIdNode)
|
|
336
|
-
|
|
328
|
+
const intervalIdNode = tools.O.getOrNull(VAR2__namespace.getVariableDeclaratorID(node));
|
|
329
|
+
if (!intervalIdNode) {
|
|
330
|
+
context.report({
|
|
331
|
+
messageId: "noLeakedIntervalNoIntervalId",
|
|
332
|
+
node
|
|
333
|
+
});
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
sEntries.push({
|
|
337
337
|
kind: "interval",
|
|
338
338
|
node,
|
|
339
339
|
callee: node.callee,
|
|
@@ -560,6 +560,18 @@ var no_leaked_timeout_default = createRule({
|
|
|
560
560
|
if (!fNode || !fKind) return;
|
|
561
561
|
if (!core.PHASE_RELEVANCE.has(fKind)) return;
|
|
562
562
|
switch (getCallKind4(node)) {
|
|
563
|
+
case "clearTimeout": {
|
|
564
|
+
const [timeoutIdNode] = node.arguments;
|
|
565
|
+
if (!timeoutIdNode) break;
|
|
566
|
+
rEntries.push({
|
|
567
|
+
kind: "timeout",
|
|
568
|
+
node,
|
|
569
|
+
callee: node.callee,
|
|
570
|
+
phase: fKind,
|
|
571
|
+
timerID: timeoutIdNode
|
|
572
|
+
});
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
563
575
|
case "setTimeout": {
|
|
564
576
|
const timeoutIdNode = tools.O.getOrNull(VAR2__namespace.getVariableDeclaratorID(node));
|
|
565
577
|
if (!timeoutIdNode) {
|
|
@@ -578,18 +590,6 @@ var no_leaked_timeout_default = createRule({
|
|
|
578
590
|
});
|
|
579
591
|
break;
|
|
580
592
|
}
|
|
581
|
-
case "clearTimeout": {
|
|
582
|
-
const [timeoutIdNode] = node.arguments;
|
|
583
|
-
if (!timeoutIdNode) break;
|
|
584
|
-
rEntries.push({
|
|
585
|
-
kind: "timeout",
|
|
586
|
-
node,
|
|
587
|
-
callee: node.callee,
|
|
588
|
-
phase: fKind,
|
|
589
|
-
timerID: timeoutIdNode
|
|
590
|
-
});
|
|
591
|
-
break;
|
|
592
|
-
}
|
|
593
593
|
}
|
|
594
594
|
},
|
|
595
595
|
["Program:exit"]() {
|
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from '@typescript-eslint/types';
|
|
|
11
11
|
|
|
12
12
|
// package.json
|
|
13
13
|
var name = "eslint-plugin-react-web-api";
|
|
14
|
-
var version = "1.15.
|
|
14
|
+
var version = "1.15.1-beta.2";
|
|
15
15
|
var createRule = createRuleForPlugin("web-api");
|
|
16
16
|
function getInstanceID(node, prev) {
|
|
17
17
|
switch (true) {
|
|
@@ -71,6 +71,15 @@ function getOptions(node, initialScope) {
|
|
|
71
71
|
};
|
|
72
72
|
function getOpts(node2) {
|
|
73
73
|
switch (node2.type) {
|
|
74
|
+
case AST_NODE_TYPES.Identifier: {
|
|
75
|
+
return F.pipe(
|
|
76
|
+
VAR2.findVariable(node2, initialScope),
|
|
77
|
+
O.flatMap(VAR2.getVariableNode(0)),
|
|
78
|
+
O.filter(AST2.is(AST_NODE_TYPES.ObjectExpression)),
|
|
79
|
+
O.map(getOpts),
|
|
80
|
+
O.getOrElse(() => defaultOptions)
|
|
81
|
+
);
|
|
82
|
+
}
|
|
74
83
|
case AST_NODE_TYPES.Literal: {
|
|
75
84
|
return Data.struct({ ...defaultOptions, capture: O.some(!!node2.value) });
|
|
76
85
|
}
|
|
@@ -85,14 +94,14 @@ function getOptions(node, initialScope) {
|
|
|
85
94
|
const { value } = prop;
|
|
86
95
|
const getSignalExp = (node3) => {
|
|
87
96
|
switch (node3.type) {
|
|
88
|
-
case AST_NODE_TYPES.MemberExpression:
|
|
89
|
-
return O.some(node3);
|
|
90
97
|
case AST_NODE_TYPES.Identifier:
|
|
91
98
|
return F.pipe(
|
|
92
99
|
VAR2.findVariable(node3, initialScope),
|
|
93
100
|
O.flatMap(VAR2.getVariableNode(0)),
|
|
94
101
|
O.flatMap(getSignalExp)
|
|
95
102
|
);
|
|
103
|
+
case AST_NODE_TYPES.MemberExpression:
|
|
104
|
+
return O.some(node3);
|
|
96
105
|
default:
|
|
97
106
|
return O.none();
|
|
98
107
|
}
|
|
@@ -101,15 +110,6 @@ function getOptions(node, initialScope) {
|
|
|
101
110
|
});
|
|
102
111
|
return Data.struct({ capture: vCapture, once: vOnce, signal: vSignal });
|
|
103
112
|
}
|
|
104
|
-
case AST_NODE_TYPES.Identifier: {
|
|
105
|
-
return F.pipe(
|
|
106
|
-
VAR2.findVariable(node2, initialScope),
|
|
107
|
-
O.flatMap(VAR2.getVariableNode(0)),
|
|
108
|
-
O.filter(AST2.is(AST_NODE_TYPES.ObjectExpression)),
|
|
109
|
-
O.map(getOpts),
|
|
110
|
-
O.getOrElse(() => defaultOptions)
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
113
|
default: {
|
|
114
114
|
return defaultOptions;
|
|
115
115
|
}
|
|
@@ -282,19 +282,13 @@ var no_leaked_interval_default = createRule({
|
|
|
282
282
|
},
|
|
283
283
|
["CallExpression"](node) {
|
|
284
284
|
switch (getCallKind2(node)) {
|
|
285
|
-
case "
|
|
285
|
+
case "clearInterval": {
|
|
286
286
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
287
287
|
if (!fNode || !fKind) break;
|
|
288
288
|
if (!PHASE_RELEVANCE.has(fKind)) break;
|
|
289
|
-
const intervalIdNode =
|
|
290
|
-
if (!intervalIdNode)
|
|
291
|
-
|
|
292
|
-
messageId: "noLeakedIntervalNoIntervalId",
|
|
293
|
-
node
|
|
294
|
-
});
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
sEntries.push({
|
|
289
|
+
const [intervalIdNode] = node.arguments;
|
|
290
|
+
if (!intervalIdNode) break;
|
|
291
|
+
cEntries.push({
|
|
298
292
|
kind: "interval",
|
|
299
293
|
node,
|
|
300
294
|
callee: node.callee,
|
|
@@ -303,13 +297,19 @@ var no_leaked_interval_default = createRule({
|
|
|
303
297
|
});
|
|
304
298
|
break;
|
|
305
299
|
}
|
|
306
|
-
case "
|
|
300
|
+
case "setInterval": {
|
|
307
301
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
308
302
|
if (!fNode || !fKind) break;
|
|
309
303
|
if (!PHASE_RELEVANCE.has(fKind)) break;
|
|
310
|
-
const
|
|
311
|
-
if (!intervalIdNode)
|
|
312
|
-
|
|
304
|
+
const intervalIdNode = O.getOrNull(VAR2.getVariableDeclaratorID(node));
|
|
305
|
+
if (!intervalIdNode) {
|
|
306
|
+
context.report({
|
|
307
|
+
messageId: "noLeakedIntervalNoIntervalId",
|
|
308
|
+
node
|
|
309
|
+
});
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
sEntries.push({
|
|
313
313
|
kind: "interval",
|
|
314
314
|
node,
|
|
315
315
|
callee: node.callee,
|
|
@@ -536,6 +536,18 @@ var no_leaked_timeout_default = createRule({
|
|
|
536
536
|
if (!fNode || !fKind) return;
|
|
537
537
|
if (!PHASE_RELEVANCE.has(fKind)) return;
|
|
538
538
|
switch (getCallKind4(node)) {
|
|
539
|
+
case "clearTimeout": {
|
|
540
|
+
const [timeoutIdNode] = node.arguments;
|
|
541
|
+
if (!timeoutIdNode) break;
|
|
542
|
+
rEntries.push({
|
|
543
|
+
kind: "timeout",
|
|
544
|
+
node,
|
|
545
|
+
callee: node.callee,
|
|
546
|
+
phase: fKind,
|
|
547
|
+
timerID: timeoutIdNode
|
|
548
|
+
});
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
539
551
|
case "setTimeout": {
|
|
540
552
|
const timeoutIdNode = O.getOrNull(VAR2.getVariableDeclaratorID(node));
|
|
541
553
|
if (!timeoutIdNode) {
|
|
@@ -554,18 +566,6 @@ var no_leaked_timeout_default = createRule({
|
|
|
554
566
|
});
|
|
555
567
|
break;
|
|
556
568
|
}
|
|
557
|
-
case "clearTimeout": {
|
|
558
|
-
const [timeoutIdNode] = node.arguments;
|
|
559
|
-
if (!timeoutIdNode) break;
|
|
560
|
-
rEntries.push({
|
|
561
|
-
kind: "timeout",
|
|
562
|
-
node,
|
|
563
|
-
callee: node.callee,
|
|
564
|
-
phase: fKind,
|
|
565
|
-
timerID: timeoutIdNode
|
|
566
|
-
});
|
|
567
|
-
break;
|
|
568
|
-
}
|
|
569
569
|
}
|
|
570
570
|
},
|
|
571
571
|
["Program:exit"]() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.1-beta.2",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -42,22 +42,22 @@
|
|
|
42
42
|
"./package.json"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
46
|
-
"@typescript-eslint/types": "^8.
|
|
47
|
-
"@typescript-eslint/utils": "^8.
|
|
45
|
+
"@typescript-eslint/scope-manager": "^8.10.0",
|
|
46
|
+
"@typescript-eslint/types": "^8.10.0",
|
|
47
|
+
"@typescript-eslint/utils": "^8.10.0",
|
|
48
48
|
"birecord": "^0.1.1",
|
|
49
|
-
"ts-pattern": "^5.
|
|
50
|
-
"@eslint-react/ast": "1.15.
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/tools": "1.15.
|
|
54
|
-
"@eslint-react/types": "1.15.
|
|
55
|
-
"@eslint-react/var": "1.15.
|
|
56
|
-
"@eslint-react/
|
|
49
|
+
"ts-pattern": "^5.5.0",
|
|
50
|
+
"@eslint-react/ast": "1.15.1-beta.2",
|
|
51
|
+
"@eslint-react/core": "1.15.1-beta.2",
|
|
52
|
+
"@eslint-react/shared": "1.15.1-beta.2",
|
|
53
|
+
"@eslint-react/tools": "1.15.1-beta.2",
|
|
54
|
+
"@eslint-react/types": "1.15.1-beta.2",
|
|
55
|
+
"@eslint-react/var": "1.15.1-beta.2",
|
|
56
|
+
"@eslint-react/jsx": "1.15.1-beta.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/react": "^18.3.11",
|
|
60
|
-
"@types/react-dom": "^18.3.
|
|
60
|
+
"@types/react-dom": "^18.3.1",
|
|
61
61
|
"string-ts": "^2.2.0",
|
|
62
62
|
"tsup": "^8.3.0"
|
|
63
63
|
},
|