eslint-plugin-react-web-api 1.24.0-next.0 → 1.24.0-next.11
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 +13 -15
- package/dist/index.mjs +14 -15
- package/package.json +12 -13
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var AST2 = require('@eslint-react/ast');
|
|
4
4
|
var core = require('@eslint-react/core');
|
|
5
5
|
var eff = require('@eslint-react/eff');
|
|
6
|
-
var JSX = require('@eslint-react/jsx');
|
|
7
6
|
var VAR2 = require('@eslint-react/var');
|
|
8
7
|
var utils = require('@typescript-eslint/utils');
|
|
9
8
|
var tsPattern = require('ts-pattern');
|
|
@@ -29,12 +28,11 @@ function _interopNamespace(e) {
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
var AST2__namespace = /*#__PURE__*/_interopNamespace(AST2);
|
|
32
|
-
var JSX__namespace = /*#__PURE__*/_interopNamespace(JSX);
|
|
33
31
|
var VAR2__namespace = /*#__PURE__*/_interopNamespace(VAR2);
|
|
34
32
|
|
|
35
33
|
// package.json
|
|
36
34
|
var name = "eslint-plugin-react-web-api";
|
|
37
|
-
var version = "1.24.0-next.
|
|
35
|
+
var version = "1.24.0-next.11";
|
|
38
36
|
var createRule = shared.createRuleForPlugin("web-api");
|
|
39
37
|
function getInstanceID(node, prev) {
|
|
40
38
|
switch (true) {
|
|
@@ -51,7 +49,7 @@ function getInstanceID(node, prev) {
|
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
function getPhaseKindOfFunction(node) {
|
|
54
|
-
return tsPattern.match(node).when(core.
|
|
52
|
+
return tsPattern.match(node).when(core.isFunctionOfUseEffectSetup, () => "setup").when(core.isFunctionOfUseEffectCleanup, () => "cleanup").when(core.isFunctionOfComponentDidMount, () => "mount").when(core.isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => eff._);
|
|
55
53
|
}
|
|
56
54
|
function isInstanceIDEqual(a, b, context) {
|
|
57
55
|
return AST2__namespace.isNodeEqual(a, b) || VAR2__namespace.isNodeValueEqual(a, b, [
|
|
@@ -84,7 +82,7 @@ function getFunctionKind(node) {
|
|
|
84
82
|
return getPhaseKindOfFunction(node) ?? "other";
|
|
85
83
|
}
|
|
86
84
|
function getSignalValueExpression(node, initialScope) {
|
|
87
|
-
if (node
|
|
85
|
+
if (node == null) return eff._;
|
|
88
86
|
switch (node.type) {
|
|
89
87
|
case utils.AST_NODE_TYPES.Identifier: {
|
|
90
88
|
return getSignalValueExpression(VAR2__namespace.getVariableNode(VAR2__namespace.findVariable(node, initialScope), 0), initialScope);
|
|
@@ -97,9 +95,9 @@ function getSignalValueExpression(node, initialScope) {
|
|
|
97
95
|
}
|
|
98
96
|
function getOptions(node, initialScope) {
|
|
99
97
|
function findProp(properties, propName) {
|
|
100
|
-
return
|
|
98
|
+
return VAR2__namespace.findPropertyInProperties(propName, properties, initialScope);
|
|
101
99
|
}
|
|
102
|
-
function getPropValue(prop, filter = (
|
|
100
|
+
function getPropValue(prop, filter = (a) => true) {
|
|
103
101
|
if (prop?.type !== utils.AST_NODE_TYPES.Property) return eff._;
|
|
104
102
|
const { value } = prop;
|
|
105
103
|
let v = value;
|
|
@@ -193,7 +191,7 @@ var no_leaked_event_listener_default = createRule({
|
|
|
193
191
|
if (!AST2__namespace.isFunction(listener)) {
|
|
194
192
|
return;
|
|
195
193
|
}
|
|
196
|
-
if (options.signal
|
|
194
|
+
if (options.signal != null) {
|
|
197
195
|
return;
|
|
198
196
|
}
|
|
199
197
|
context.report({
|
|
@@ -212,7 +210,7 @@ var no_leaked_event_listener_default = createRule({
|
|
|
212
210
|
},
|
|
213
211
|
["CallExpression"](node) {
|
|
214
212
|
const fKind = fEntries.findLast((x) => x.kind !== "other")?.kind;
|
|
215
|
-
if (fKind
|
|
213
|
+
if (fKind == null) {
|
|
216
214
|
return;
|
|
217
215
|
}
|
|
218
216
|
if (!core.ERPhaseRelevance.has(fKind)) {
|
|
@@ -259,7 +257,7 @@ var no_leaked_event_listener_default = createRule({
|
|
|
259
257
|
["Program:exit"]() {
|
|
260
258
|
for (const aEntry of aEntries) {
|
|
261
259
|
const signal = aEntry.signal;
|
|
262
|
-
if (signal
|
|
260
|
+
if (signal != null && abortedSignals.some((a) => isSameObject(a, signal))) {
|
|
263
261
|
continue;
|
|
264
262
|
}
|
|
265
263
|
if (rEntries.some((rEntry) => isInverseEntry(aEntry, rEntry))) {
|
|
@@ -341,7 +339,7 @@ var no_leaked_interval_default = createRule({
|
|
|
341
339
|
switch (getCallKind2(node)) {
|
|
342
340
|
case "setInterval": {
|
|
343
341
|
const fEntry = fEntries.findLast((x) => x.kind !== "other");
|
|
344
|
-
if (fEntry
|
|
342
|
+
if (fEntry == null) {
|
|
345
343
|
break;
|
|
346
344
|
}
|
|
347
345
|
if (!core.ERPhaseRelevance.has(fEntry.kind)) {
|
|
@@ -366,7 +364,7 @@ var no_leaked_interval_default = createRule({
|
|
|
366
364
|
}
|
|
367
365
|
case "clearInterval": {
|
|
368
366
|
const fEntry = fEntries.findLast((x) => x.kind !== "other");
|
|
369
|
-
if (fEntry
|
|
367
|
+
if (fEntry == null) {
|
|
370
368
|
break;
|
|
371
369
|
}
|
|
372
370
|
if (!core.ERPhaseRelevance.has(fEntry.kind)) {
|
|
@@ -490,7 +488,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
490
488
|
return;
|
|
491
489
|
}
|
|
492
490
|
const fKind = fEntries.findLast((x) => x.kind !== "other")?.kind;
|
|
493
|
-
if (fKind
|
|
491
|
+
if (fKind == null || !core.ERPhaseRelevance.has(fKind)) {
|
|
494
492
|
return;
|
|
495
493
|
}
|
|
496
494
|
const { object } = node.callee;
|
|
@@ -535,7 +533,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
535
533
|
},
|
|
536
534
|
["NewExpression"](node) {
|
|
537
535
|
const fEntry = fEntries.findLast((x) => x.kind !== "other");
|
|
538
|
-
if (fEntry
|
|
536
|
+
if (fEntry == null) return;
|
|
539
537
|
if (!core.ERPhaseRelevance.has(fEntry.kind)) {
|
|
540
538
|
return;
|
|
541
539
|
}
|
|
@@ -543,7 +541,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
543
541
|
return;
|
|
544
542
|
}
|
|
545
543
|
const id = getInstanceID(node);
|
|
546
|
-
if (id
|
|
544
|
+
if (id == null) {
|
|
547
545
|
context.report({
|
|
548
546
|
messageId: "noLeakedResizeObserverNoFloatingInstance",
|
|
549
547
|
node
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as AST2 from '@eslint-react/ast';
|
|
2
|
-
import { ERPhaseRelevance,
|
|
2
|
+
import { ERPhaseRelevance, isFunctionOfUseEffectSetup, isFunctionOfUseEffectCleanup, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isInversePhase } from '@eslint-react/core';
|
|
3
3
|
import { _, or } from '@eslint-react/eff';
|
|
4
|
-
import * as JSX from '@eslint-react/jsx';
|
|
5
4
|
import * as VAR2 from '@eslint-react/var';
|
|
6
5
|
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
7
6
|
import { match, isMatching, P } from 'ts-pattern';
|
|
@@ -10,7 +9,7 @@ import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from '@typescript-eslint/types';
|
|
|
10
9
|
|
|
11
10
|
// package.json
|
|
12
11
|
var name = "eslint-plugin-react-web-api";
|
|
13
|
-
var version = "1.24.0-next.
|
|
12
|
+
var version = "1.24.0-next.11";
|
|
14
13
|
var createRule = createRuleForPlugin("web-api");
|
|
15
14
|
function getInstanceID(node, prev) {
|
|
16
15
|
switch (true) {
|
|
@@ -27,7 +26,7 @@ function getInstanceID(node, prev) {
|
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
function getPhaseKindOfFunction(node) {
|
|
30
|
-
return match(node).when(
|
|
29
|
+
return match(node).when(isFunctionOfUseEffectSetup, () => "setup").when(isFunctionOfUseEffectCleanup, () => "cleanup").when(isFunctionOfComponentDidMount, () => "mount").when(isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => _);
|
|
31
30
|
}
|
|
32
31
|
function isInstanceIDEqual(a, b, context) {
|
|
33
32
|
return AST2.isNodeEqual(a, b) || VAR2.isNodeValueEqual(a, b, [
|
|
@@ -60,7 +59,7 @@ function getFunctionKind(node) {
|
|
|
60
59
|
return getPhaseKindOfFunction(node) ?? "other";
|
|
61
60
|
}
|
|
62
61
|
function getSignalValueExpression(node, initialScope) {
|
|
63
|
-
if (node
|
|
62
|
+
if (node == null) return _;
|
|
64
63
|
switch (node.type) {
|
|
65
64
|
case AST_NODE_TYPES.Identifier: {
|
|
66
65
|
return getSignalValueExpression(VAR2.getVariableNode(VAR2.findVariable(node, initialScope), 0), initialScope);
|
|
@@ -73,9 +72,9 @@ function getSignalValueExpression(node, initialScope) {
|
|
|
73
72
|
}
|
|
74
73
|
function getOptions(node, initialScope) {
|
|
75
74
|
function findProp(properties, propName) {
|
|
76
|
-
return
|
|
75
|
+
return VAR2.findPropertyInProperties(propName, properties, initialScope);
|
|
77
76
|
}
|
|
78
|
-
function getPropValue(prop, filter = (
|
|
77
|
+
function getPropValue(prop, filter = (a) => true) {
|
|
79
78
|
if (prop?.type !== AST_NODE_TYPES.Property) return _;
|
|
80
79
|
const { value } = prop;
|
|
81
80
|
let v = value;
|
|
@@ -169,7 +168,7 @@ var no_leaked_event_listener_default = createRule({
|
|
|
169
168
|
if (!AST2.isFunction(listener)) {
|
|
170
169
|
return;
|
|
171
170
|
}
|
|
172
|
-
if (options.signal
|
|
171
|
+
if (options.signal != null) {
|
|
173
172
|
return;
|
|
174
173
|
}
|
|
175
174
|
context.report({
|
|
@@ -188,7 +187,7 @@ var no_leaked_event_listener_default = createRule({
|
|
|
188
187
|
},
|
|
189
188
|
["CallExpression"](node) {
|
|
190
189
|
const fKind = fEntries.findLast((x) => x.kind !== "other")?.kind;
|
|
191
|
-
if (fKind
|
|
190
|
+
if (fKind == null) {
|
|
192
191
|
return;
|
|
193
192
|
}
|
|
194
193
|
if (!ERPhaseRelevance.has(fKind)) {
|
|
@@ -235,7 +234,7 @@ var no_leaked_event_listener_default = createRule({
|
|
|
235
234
|
["Program:exit"]() {
|
|
236
235
|
for (const aEntry of aEntries) {
|
|
237
236
|
const signal = aEntry.signal;
|
|
238
|
-
if (signal
|
|
237
|
+
if (signal != null && abortedSignals.some((a) => isSameObject(a, signal))) {
|
|
239
238
|
continue;
|
|
240
239
|
}
|
|
241
240
|
if (rEntries.some((rEntry) => isInverseEntry(aEntry, rEntry))) {
|
|
@@ -317,7 +316,7 @@ var no_leaked_interval_default = createRule({
|
|
|
317
316
|
switch (getCallKind2(node)) {
|
|
318
317
|
case "setInterval": {
|
|
319
318
|
const fEntry = fEntries.findLast((x) => x.kind !== "other");
|
|
320
|
-
if (fEntry
|
|
319
|
+
if (fEntry == null) {
|
|
321
320
|
break;
|
|
322
321
|
}
|
|
323
322
|
if (!ERPhaseRelevance.has(fEntry.kind)) {
|
|
@@ -342,7 +341,7 @@ var no_leaked_interval_default = createRule({
|
|
|
342
341
|
}
|
|
343
342
|
case "clearInterval": {
|
|
344
343
|
const fEntry = fEntries.findLast((x) => x.kind !== "other");
|
|
345
|
-
if (fEntry
|
|
344
|
+
if (fEntry == null) {
|
|
346
345
|
break;
|
|
347
346
|
}
|
|
348
347
|
if (!ERPhaseRelevance.has(fEntry.kind)) {
|
|
@@ -466,7 +465,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
466
465
|
return;
|
|
467
466
|
}
|
|
468
467
|
const fKind = fEntries.findLast((x) => x.kind !== "other")?.kind;
|
|
469
|
-
if (fKind
|
|
468
|
+
if (fKind == null || !ERPhaseRelevance.has(fKind)) {
|
|
470
469
|
return;
|
|
471
470
|
}
|
|
472
471
|
const { object } = node.callee;
|
|
@@ -511,7 +510,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
511
510
|
},
|
|
512
511
|
["NewExpression"](node) {
|
|
513
512
|
const fEntry = fEntries.findLast((x) => x.kind !== "other");
|
|
514
|
-
if (fEntry
|
|
513
|
+
if (fEntry == null) return;
|
|
515
514
|
if (!ERPhaseRelevance.has(fEntry.kind)) {
|
|
516
515
|
return;
|
|
517
516
|
}
|
|
@@ -519,7 +518,7 @@ var no_leaked_resize_observer_default = createRule({
|
|
|
519
518
|
return;
|
|
520
519
|
}
|
|
521
520
|
const id = getInstanceID(node);
|
|
522
|
-
if (id
|
|
521
|
+
if (id == null) {
|
|
523
522
|
context.report({
|
|
524
523
|
messageId: "noLeakedResizeObserverNoFloatingInstance",
|
|
525
524
|
node
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "1.24.0-next.
|
|
3
|
+
"version": "1.24.0-next.11",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,22 +41,21 @@
|
|
|
41
41
|
"./package.json"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
45
|
-
"@typescript-eslint/types": "^8.
|
|
46
|
-
"@typescript-eslint/utils": "^8.
|
|
44
|
+
"@typescript-eslint/scope-manager": "^8.20.0",
|
|
45
|
+
"@typescript-eslint/types": "^8.20.0",
|
|
46
|
+
"@typescript-eslint/utils": "^8.20.0",
|
|
47
47
|
"string-ts": "^2.2.0",
|
|
48
48
|
"ts-pattern": "^5.6.0",
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/ast": "1.24.0-next.0"
|
|
49
|
+
"@eslint-react/ast": "1.24.0-next.11",
|
|
50
|
+
"@eslint-react/core": "1.24.0-next.11",
|
|
51
|
+
"@eslint-react/eff": "1.24.0-next.11",
|
|
52
|
+
"@eslint-react/jsx": "1.24.0-next.11",
|
|
53
|
+
"@eslint-react/shared": "1.24.0-next.11",
|
|
54
|
+
"@eslint-react/var": "1.24.0-next.11"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@types/react": "^19.0.
|
|
59
|
-
"@types/react-dom": "^19.0.
|
|
57
|
+
"@types/react": "^19.0.7",
|
|
58
|
+
"@types/react-dom": "^19.0.3",
|
|
60
59
|
"tsup": "^8.3.5",
|
|
61
60
|
"@workspace/configs": "0.0.0"
|
|
62
61
|
},
|