eslint-plugin-react-web-api 1.24.0-beta.1 → 1.24.0-beta.18
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 +12 -14
- package/dist/index.mjs +13 -14
- 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-beta.
|
|
35
|
+
var version = "1.24.0-beta.18";
|
|
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, [
|
|
@@ -72,9 +70,9 @@ var defaultOptions = {
|
|
|
72
70
|
};
|
|
73
71
|
function getCallKind(node) {
|
|
74
72
|
switch (true) {
|
|
75
|
-
case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("addEventListener", "removeEventListener", "abort")
|
|
73
|
+
case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("addEventListener", "removeEventListener", "abort"))(node.callee.name)):
|
|
76
74
|
return node.callee.name;
|
|
77
|
-
case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("addEventListener", "removeEventListener", "abort")
|
|
75
|
+
case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("addEventListener", "removeEventListener", "abort"))(node.callee.property.name)):
|
|
78
76
|
return node.callee.property.name;
|
|
79
77
|
default:
|
|
80
78
|
return "other";
|
|
@@ -97,7 +95,7 @@ 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
100
|
function getPropValue(prop, filter = (a) => true) {
|
|
103
101
|
if (prop?.type !== utils.AST_NODE_TYPES.Property) return eff._;
|
|
@@ -109,7 +107,7 @@ function getOptions(node, initialScope) {
|
|
|
109
107
|
break;
|
|
110
108
|
}
|
|
111
109
|
default: {
|
|
112
|
-
v = VAR2__namespace.
|
|
110
|
+
v = VAR2__namespace.toStaticValue({ kind: "lazy", node: value, initialScope }).value;
|
|
113
111
|
break;
|
|
114
112
|
}
|
|
115
113
|
}
|
|
@@ -296,9 +294,9 @@ var RULE_FEATURES2 = [
|
|
|
296
294
|
];
|
|
297
295
|
function getCallKind2(node) {
|
|
298
296
|
switch (true) {
|
|
299
|
-
case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("setInterval", "clearInterval")
|
|
297
|
+
case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("setInterval", "clearInterval"))(node.callee.name)):
|
|
300
298
|
return node.callee.name;
|
|
301
|
-
case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("setInterval", "clearInterval")
|
|
299
|
+
case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("setInterval", "clearInterval"))(node.callee.property.name)):
|
|
302
300
|
return node.callee.property.name;
|
|
303
301
|
default:
|
|
304
302
|
return "other";
|
|
@@ -442,9 +440,9 @@ function isFromObserver(node, context) {
|
|
|
442
440
|
}
|
|
443
441
|
function getCallKind3(node, context) {
|
|
444
442
|
switch (true) {
|
|
445
|
-
case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("observe", "unobserve", "disconnect")
|
|
443
|
+
case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("observe", "unobserve", "disconnect"))(node.callee.name) && isFromObserver(node.callee, context)):
|
|
446
444
|
return node.callee.name;
|
|
447
|
-
case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("observe", "unobserve", "disconnect")
|
|
445
|
+
case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("observe", "unobserve", "disconnect"))(node.callee.property.name) && isFromObserver(node.callee, context)):
|
|
448
446
|
return node.callee.property.name;
|
|
449
447
|
default:
|
|
450
448
|
return "other";
|
|
@@ -589,9 +587,9 @@ var RULE_FEATURES4 = [
|
|
|
589
587
|
];
|
|
590
588
|
function getCallKind4(node) {
|
|
591
589
|
switch (true) {
|
|
592
|
-
case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("setTimeout", "clearTimeout")
|
|
590
|
+
case (node.callee.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("setTimeout", "clearTimeout"))(node.callee.name)):
|
|
593
591
|
return node.callee.name;
|
|
594
|
-
case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("setTimeout", "clearTimeout")
|
|
592
|
+
case (node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.type === utils.AST_NODE_TYPES.Identifier && tsPattern.isMatching(tsPattern.P.union("setTimeout", "clearTimeout"))(node.callee.property.name)):
|
|
595
593
|
return node.callee.property.name;
|
|
596
594
|
default:
|
|
597
595
|
return "other";
|
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-beta.
|
|
12
|
+
var version = "1.24.0-beta.18";
|
|
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, [
|
|
@@ -48,9 +47,9 @@ var defaultOptions = {
|
|
|
48
47
|
};
|
|
49
48
|
function getCallKind(node) {
|
|
50
49
|
switch (true) {
|
|
51
|
-
case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("addEventListener", "removeEventListener", "abort")
|
|
50
|
+
case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("addEventListener", "removeEventListener", "abort"))(node.callee.name)):
|
|
52
51
|
return node.callee.name;
|
|
53
|
-
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("addEventListener", "removeEventListener", "abort")
|
|
52
|
+
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("addEventListener", "removeEventListener", "abort"))(node.callee.property.name)):
|
|
54
53
|
return node.callee.property.name;
|
|
55
54
|
default:
|
|
56
55
|
return "other";
|
|
@@ -73,7 +72,7 @@ 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
77
|
function getPropValue(prop, filter = (a) => true) {
|
|
79
78
|
if (prop?.type !== AST_NODE_TYPES.Property) return _;
|
|
@@ -85,7 +84,7 @@ function getOptions(node, initialScope) {
|
|
|
85
84
|
break;
|
|
86
85
|
}
|
|
87
86
|
default: {
|
|
88
|
-
v = VAR2.
|
|
87
|
+
v = VAR2.toStaticValue({ kind: "lazy", node: value, initialScope }).value;
|
|
89
88
|
break;
|
|
90
89
|
}
|
|
91
90
|
}
|
|
@@ -272,9 +271,9 @@ var RULE_FEATURES2 = [
|
|
|
272
271
|
];
|
|
273
272
|
function getCallKind2(node) {
|
|
274
273
|
switch (true) {
|
|
275
|
-
case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setInterval", "clearInterval")
|
|
274
|
+
case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setInterval", "clearInterval"))(node.callee.name)):
|
|
276
275
|
return node.callee.name;
|
|
277
|
-
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setInterval", "clearInterval")
|
|
276
|
+
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setInterval", "clearInterval"))(node.callee.property.name)):
|
|
278
277
|
return node.callee.property.name;
|
|
279
278
|
default:
|
|
280
279
|
return "other";
|
|
@@ -418,9 +417,9 @@ function isFromObserver(node, context) {
|
|
|
418
417
|
}
|
|
419
418
|
function getCallKind3(node, context) {
|
|
420
419
|
switch (true) {
|
|
421
|
-
case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect")
|
|
420
|
+
case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(node.callee.name) && isFromObserver(node.callee, context)):
|
|
422
421
|
return node.callee.name;
|
|
423
|
-
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect")
|
|
422
|
+
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("observe", "unobserve", "disconnect"))(node.callee.property.name) && isFromObserver(node.callee, context)):
|
|
424
423
|
return node.callee.property.name;
|
|
425
424
|
default:
|
|
426
425
|
return "other";
|
|
@@ -565,9 +564,9 @@ var RULE_FEATURES4 = [
|
|
|
565
564
|
];
|
|
566
565
|
function getCallKind4(node) {
|
|
567
566
|
switch (true) {
|
|
568
|
-
case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setTimeout", "clearTimeout")
|
|
567
|
+
case (node.callee.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setTimeout", "clearTimeout"))(node.callee.name)):
|
|
569
568
|
return node.callee.name;
|
|
570
|
-
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setTimeout", "clearTimeout")
|
|
569
|
+
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && isMatching(P.union("setTimeout", "clearTimeout"))(node.callee.property.name)):
|
|
571
570
|
return node.callee.property.name;
|
|
572
571
|
default:
|
|
573
572
|
return "other";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "1.24.0-beta.
|
|
3
|
+
"version": "1.24.0-beta.18",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,21 +41,20 @@
|
|
|
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
|
-
"ts-pattern": "^5.6.
|
|
49
|
-
"@eslint-react/ast": "1.24.0-beta.
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/var": "1.24.0-beta.1"
|
|
48
|
+
"ts-pattern": "^5.6.1",
|
|
49
|
+
"@eslint-react/ast": "1.24.0-beta.18",
|
|
50
|
+
"@eslint-react/eff": "1.24.0-beta.18",
|
|
51
|
+
"@eslint-react/core": "1.24.0-beta.18",
|
|
52
|
+
"@eslint-react/shared": "1.24.0-beta.18",
|
|
53
|
+
"@eslint-react/var": "1.24.0-beta.18",
|
|
54
|
+
"@eslint-react/jsx": "1.24.0-beta.18"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@types/react": "^19.0.
|
|
57
|
+
"@types/react": "^19.0.7",
|
|
59
58
|
"@types/react-dom": "^19.0.3",
|
|
60
59
|
"tsup": "^8.3.5",
|
|
61
60
|
"@workspace/configs": "0.0.0"
|