eslint-plugin-react-web-api 1.23.3-next.5 → 1.23.3-next.7
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 +17 -17
- package/dist/index.mjs +17 -17
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var VAR2__namespace = /*#__PURE__*/_interopNamespace(VAR2);
|
|
|
34
34
|
|
|
35
35
|
// package.json
|
|
36
36
|
var name = "eslint-plugin-react-web-api";
|
|
37
|
-
var version = "1.23.3-next.
|
|
37
|
+
var version = "1.23.3-next.7";
|
|
38
38
|
var createRule = shared.createRuleForPlugin("web-api");
|
|
39
39
|
function getInstanceID(node, prev) {
|
|
40
40
|
switch (true) {
|
|
@@ -127,7 +127,7 @@ function getOptions(node, initialScope) {
|
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
case utils.AST_NODE_TYPES.Literal: {
|
|
130
|
-
return { ...defaultOptions, capture: eff.O.some(
|
|
130
|
+
return { ...defaultOptions, capture: eff.O.some(Boolean(node2.value)) };
|
|
131
131
|
}
|
|
132
132
|
case utils.AST_NODE_TYPES.ObjectExpression: {
|
|
133
133
|
const pOnce = findProp(node2.properties, "once");
|
|
@@ -221,7 +221,7 @@ var no_leaked_event_listener_default = createRule({
|
|
|
221
221
|
},
|
|
222
222
|
["CallExpression"](node) {
|
|
223
223
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
224
|
-
if (
|
|
224
|
+
if (fNode == null || fKind == null) {
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
if (!core.ERPhaseRelevance.has(fKind)) {
|
|
@@ -229,10 +229,10 @@ var no_leaked_event_listener_default = createRule({
|
|
|
229
229
|
}
|
|
230
230
|
tsPattern.match(getCallKind(node)).with("addEventListener", (callKind) => {
|
|
231
231
|
const [type, listener, options] = node.arguments;
|
|
232
|
-
if (
|
|
232
|
+
if (type == null || listener == null) {
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
|
-
const opts = options ? getOptions(options, context.sourceCode.getScope(options))
|
|
235
|
+
const opts = options == null ? defaultOptions : getOptions(options, context.sourceCode.getScope(options));
|
|
236
236
|
const { callee } = node;
|
|
237
237
|
eff.O.map(checkInlineFunction(node, callKind, opts), context.report);
|
|
238
238
|
aEntries.push({
|
|
@@ -246,10 +246,10 @@ var no_leaked_event_listener_default = createRule({
|
|
|
246
246
|
});
|
|
247
247
|
}).with("removeEventListener", (callKind) => {
|
|
248
248
|
const [type, listener, options] = node.arguments;
|
|
249
|
-
if (
|
|
249
|
+
if (type == null || listener == null) {
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
252
|
-
const opts = options ? getOptions(options, context.sourceCode.getScope(options))
|
|
252
|
+
const opts = options == null ? defaultOptions : getOptions(options, context.sourceCode.getScope(options));
|
|
253
253
|
const { callee } = node;
|
|
254
254
|
eff.O.map(checkInlineFunction(node, callKind, opts), context.report);
|
|
255
255
|
rEntries.push({
|
|
@@ -349,14 +349,14 @@ var no_leaked_interval_default = createRule({
|
|
|
349
349
|
switch (getCallKind2(node)) {
|
|
350
350
|
case "setInterval": {
|
|
351
351
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
352
|
-
if (
|
|
352
|
+
if (fNode == null || fKind == null) {
|
|
353
353
|
break;
|
|
354
354
|
}
|
|
355
355
|
if (!core.ERPhaseRelevance.has(fKind)) {
|
|
356
356
|
break;
|
|
357
357
|
}
|
|
358
358
|
const intervalIdNode = eff.O.getOrNull(VAR2__namespace.getVariableDeclaratorID(node));
|
|
359
|
-
if (
|
|
359
|
+
if (intervalIdNode == null) {
|
|
360
360
|
context.report({
|
|
361
361
|
messageId: "noLeakedIntervalNoIntervalId",
|
|
362
362
|
node
|
|
@@ -374,14 +374,14 @@ var no_leaked_interval_default = createRule({
|
|
|
374
374
|
}
|
|
375
375
|
case "clearInterval": {
|
|
376
376
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
377
|
-
if (
|
|
377
|
+
if (fNode == null || fKind == null) {
|
|
378
378
|
break;
|
|
379
379
|
}
|
|
380
380
|
if (!core.ERPhaseRelevance.has(fKind)) {
|
|
381
381
|
break;
|
|
382
382
|
}
|
|
383
383
|
const [intervalIdNode] = node.arguments;
|
|
384
|
-
if (
|
|
384
|
+
if (intervalIdNode == null) {
|
|
385
385
|
break;
|
|
386
386
|
}
|
|
387
387
|
cEntries.push({
|
|
@@ -514,7 +514,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
514
514
|
});
|
|
515
515
|
}).with("observe", () => {
|
|
516
516
|
const [element] = node.arguments;
|
|
517
|
-
if (
|
|
517
|
+
if (element == null) {
|
|
518
518
|
return;
|
|
519
519
|
}
|
|
520
520
|
oEntries.push({
|
|
@@ -528,7 +528,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
528
528
|
});
|
|
529
529
|
}).with("unobserve", () => {
|
|
530
530
|
const [element] = node.arguments;
|
|
531
|
-
if (
|
|
531
|
+
if (element == null) {
|
|
532
532
|
return;
|
|
533
533
|
}
|
|
534
534
|
uEntries.push({
|
|
@@ -544,7 +544,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
544
544
|
},
|
|
545
545
|
["NewExpression"](node) {
|
|
546
546
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
547
|
-
if (
|
|
547
|
+
if (fNode == null || !core.ERPhaseRelevance.has(fKind)) {
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
550
550
|
if (!isNewResizeObserver(node)) {
|
|
@@ -635,7 +635,7 @@ var no_leaked_timeout_default = createRule({
|
|
|
635
635
|
},
|
|
636
636
|
["CallExpression"](node) {
|
|
637
637
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
638
|
-
if (
|
|
638
|
+
if (fNode == null || fKind == null) {
|
|
639
639
|
return;
|
|
640
640
|
}
|
|
641
641
|
if (!core.ERPhaseRelevance.has(fKind)) {
|
|
@@ -644,7 +644,7 @@ var no_leaked_timeout_default = createRule({
|
|
|
644
644
|
switch (getCallKind4(node)) {
|
|
645
645
|
case "setTimeout": {
|
|
646
646
|
const timeoutIdNode = eff.O.getOrNull(VAR2__namespace.getVariableDeclaratorID(node));
|
|
647
|
-
if (
|
|
647
|
+
if (timeoutIdNode == null) {
|
|
648
648
|
context.report({
|
|
649
649
|
messageId: "noLeakedTimeoutNoTimeoutId",
|
|
650
650
|
node
|
|
@@ -662,7 +662,7 @@ var no_leaked_timeout_default = createRule({
|
|
|
662
662
|
}
|
|
663
663
|
case "clearTimeout": {
|
|
664
664
|
const [timeoutIdNode] = node.arguments;
|
|
665
|
-
if (
|
|
665
|
+
if (timeoutIdNode == null) {
|
|
666
666
|
break;
|
|
667
667
|
}
|
|
668
668
|
rEntries.push({
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from '@typescript-eslint/types';
|
|
|
10
10
|
|
|
11
11
|
// package.json
|
|
12
12
|
var name = "eslint-plugin-react-web-api";
|
|
13
|
-
var version = "1.23.3-next.
|
|
13
|
+
var version = "1.23.3-next.7";
|
|
14
14
|
var createRule = createRuleForPlugin("web-api");
|
|
15
15
|
function getInstanceID(node, prev) {
|
|
16
16
|
switch (true) {
|
|
@@ -103,7 +103,7 @@ function getOptions(node, initialScope) {
|
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
case AST_NODE_TYPES.Literal: {
|
|
106
|
-
return { ...defaultOptions, capture: O.some(
|
|
106
|
+
return { ...defaultOptions, capture: O.some(Boolean(node2.value)) };
|
|
107
107
|
}
|
|
108
108
|
case AST_NODE_TYPES.ObjectExpression: {
|
|
109
109
|
const pOnce = findProp(node2.properties, "once");
|
|
@@ -197,7 +197,7 @@ var no_leaked_event_listener_default = createRule({
|
|
|
197
197
|
},
|
|
198
198
|
["CallExpression"](node) {
|
|
199
199
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
200
|
-
if (
|
|
200
|
+
if (fNode == null || fKind == null) {
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
if (!ERPhaseRelevance.has(fKind)) {
|
|
@@ -205,10 +205,10 @@ var no_leaked_event_listener_default = createRule({
|
|
|
205
205
|
}
|
|
206
206
|
match(getCallKind(node)).with("addEventListener", (callKind) => {
|
|
207
207
|
const [type, listener, options] = node.arguments;
|
|
208
|
-
if (
|
|
208
|
+
if (type == null || listener == null) {
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
|
-
const opts = options ? getOptions(options, context.sourceCode.getScope(options))
|
|
211
|
+
const opts = options == null ? defaultOptions : getOptions(options, context.sourceCode.getScope(options));
|
|
212
212
|
const { callee } = node;
|
|
213
213
|
O.map(checkInlineFunction(node, callKind, opts), context.report);
|
|
214
214
|
aEntries.push({
|
|
@@ -222,10 +222,10 @@ var no_leaked_event_listener_default = createRule({
|
|
|
222
222
|
});
|
|
223
223
|
}).with("removeEventListener", (callKind) => {
|
|
224
224
|
const [type, listener, options] = node.arguments;
|
|
225
|
-
if (
|
|
225
|
+
if (type == null || listener == null) {
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
|
-
const opts = options ? getOptions(options, context.sourceCode.getScope(options))
|
|
228
|
+
const opts = options == null ? defaultOptions : getOptions(options, context.sourceCode.getScope(options));
|
|
229
229
|
const { callee } = node;
|
|
230
230
|
O.map(checkInlineFunction(node, callKind, opts), context.report);
|
|
231
231
|
rEntries.push({
|
|
@@ -325,14 +325,14 @@ var no_leaked_interval_default = createRule({
|
|
|
325
325
|
switch (getCallKind2(node)) {
|
|
326
326
|
case "setInterval": {
|
|
327
327
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
328
|
-
if (
|
|
328
|
+
if (fNode == null || fKind == null) {
|
|
329
329
|
break;
|
|
330
330
|
}
|
|
331
331
|
if (!ERPhaseRelevance.has(fKind)) {
|
|
332
332
|
break;
|
|
333
333
|
}
|
|
334
334
|
const intervalIdNode = O.getOrNull(VAR2.getVariableDeclaratorID(node));
|
|
335
|
-
if (
|
|
335
|
+
if (intervalIdNode == null) {
|
|
336
336
|
context.report({
|
|
337
337
|
messageId: "noLeakedIntervalNoIntervalId",
|
|
338
338
|
node
|
|
@@ -350,14 +350,14 @@ var no_leaked_interval_default = createRule({
|
|
|
350
350
|
}
|
|
351
351
|
case "clearInterval": {
|
|
352
352
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
353
|
-
if (
|
|
353
|
+
if (fNode == null || fKind == null) {
|
|
354
354
|
break;
|
|
355
355
|
}
|
|
356
356
|
if (!ERPhaseRelevance.has(fKind)) {
|
|
357
357
|
break;
|
|
358
358
|
}
|
|
359
359
|
const [intervalIdNode] = node.arguments;
|
|
360
|
-
if (
|
|
360
|
+
if (intervalIdNode == null) {
|
|
361
361
|
break;
|
|
362
362
|
}
|
|
363
363
|
cEntries.push({
|
|
@@ -490,7 +490,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
490
490
|
});
|
|
491
491
|
}).with("observe", () => {
|
|
492
492
|
const [element] = node.arguments;
|
|
493
|
-
if (
|
|
493
|
+
if (element == null) {
|
|
494
494
|
return;
|
|
495
495
|
}
|
|
496
496
|
oEntries.push({
|
|
@@ -504,7 +504,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
504
504
|
});
|
|
505
505
|
}).with("unobserve", () => {
|
|
506
506
|
const [element] = node.arguments;
|
|
507
|
-
if (
|
|
507
|
+
if (element == null) {
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
510
|
uEntries.push({
|
|
@@ -520,7 +520,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
520
520
|
},
|
|
521
521
|
["NewExpression"](node) {
|
|
522
522
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
523
|
-
if (
|
|
523
|
+
if (fNode == null || !ERPhaseRelevance.has(fKind)) {
|
|
524
524
|
return;
|
|
525
525
|
}
|
|
526
526
|
if (!isNewResizeObserver(node)) {
|
|
@@ -611,7 +611,7 @@ var no_leaked_timeout_default = createRule({
|
|
|
611
611
|
},
|
|
612
612
|
["CallExpression"](node) {
|
|
613
613
|
const [fNode, fKind] = fStack.findLast((f) => f.at(1) !== "other") ?? [];
|
|
614
|
-
if (
|
|
614
|
+
if (fNode == null || fKind == null) {
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
617
|
if (!ERPhaseRelevance.has(fKind)) {
|
|
@@ -620,7 +620,7 @@ var no_leaked_timeout_default = createRule({
|
|
|
620
620
|
switch (getCallKind4(node)) {
|
|
621
621
|
case "setTimeout": {
|
|
622
622
|
const timeoutIdNode = O.getOrNull(VAR2.getVariableDeclaratorID(node));
|
|
623
|
-
if (
|
|
623
|
+
if (timeoutIdNode == null) {
|
|
624
624
|
context.report({
|
|
625
625
|
messageId: "noLeakedTimeoutNoTimeoutId",
|
|
626
626
|
node
|
|
@@ -638,7 +638,7 @@ var no_leaked_timeout_default = createRule({
|
|
|
638
638
|
}
|
|
639
639
|
case "clearTimeout": {
|
|
640
640
|
const [timeoutIdNode] = node.arguments;
|
|
641
|
-
if (
|
|
641
|
+
if (timeoutIdNode == null) {
|
|
642
642
|
break;
|
|
643
643
|
}
|
|
644
644
|
rEntries.push({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "1.23.3-next.
|
|
3
|
+
"version": "1.23.3-next.7",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"@typescript-eslint/utils": "^8.19.1",
|
|
47
47
|
"string-ts": "^2.2.0",
|
|
48
48
|
"ts-pattern": "^5.6.0",
|
|
49
|
-
"@eslint-react/ast": "1.23.3-next.
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
49
|
+
"@eslint-react/ast": "1.23.3-next.7",
|
|
50
|
+
"@eslint-react/core": "1.23.3-next.7",
|
|
51
|
+
"@eslint-react/jsx": "1.23.3-next.7",
|
|
52
|
+
"@eslint-react/eff": "1.23.3-next.7",
|
|
53
|
+
"@eslint-react/types": "1.23.3-next.7",
|
|
54
|
+
"@eslint-react/shared": "1.23.3-next.7",
|
|
55
|
+
"@eslint-react/var": "1.23.3-next.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/react": "^19.0.4",
|