eslint-plugin-react-web-api 1.17.2-next.4 → 1.17.2-next.6
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 +8 -5
- package/dist/index.mjs +5 -2
- package/package.json +8 -8
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.17.2-next.
|
|
38
|
+
var version = "1.17.2-next.6";
|
|
39
39
|
var createRule = shared.createRuleForPlugin("web-api");
|
|
40
40
|
function getInstanceID(node, prev) {
|
|
41
41
|
switch (true) {
|
|
@@ -51,6 +51,9 @@ function getInstanceID(node, prev) {
|
|
|
51
51
|
return getInstanceID(node.parent, node);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
function getPhaseKindOfFunction(node) {
|
|
55
|
+
return tsPattern.match(node).when(core.isSetupFunction, () => tools.O.some("setup")).when(core.isCleanupFunction, () => tools.O.some("cleanup")).when(core.isComponentDidMountFunction, () => tools.O.some("mount")).when(core.isComponentWillUnmountFunction, () => tools.O.some("unmount")).otherwise(tools.O.none);
|
|
56
|
+
}
|
|
54
57
|
function isInstanceIDEqual(a, b, context) {
|
|
55
58
|
return AST2__namespace.isNodeEqual(a, b) || VAR2__namespace.isNodeValueEqual(a, b, [context.sourceCode.getScope(a), context.sourceCode.getScope(b)]);
|
|
56
59
|
}
|
|
@@ -75,7 +78,7 @@ function getCallKind(node) {
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
function getFunctionKind(node) {
|
|
78
|
-
return tools.O.getOrElse(
|
|
81
|
+
return tools.O.getOrElse(getPhaseKindOfFunction(node), tools.F.constant("other"));
|
|
79
82
|
}
|
|
80
83
|
function getOptions(node, initialScope) {
|
|
81
84
|
const findProp = (properties, propName) => {
|
|
@@ -298,7 +301,7 @@ var no_leaked_interval_default = createRule({
|
|
|
298
301
|
});
|
|
299
302
|
return {
|
|
300
303
|
[":function"](node) {
|
|
301
|
-
const fKind = tools.O.getOrElse(
|
|
304
|
+
const fKind = tools.O.getOrElse(getPhaseKindOfFunction(node), () => "other");
|
|
302
305
|
fStack.push([node, fKind]);
|
|
303
306
|
},
|
|
304
307
|
[":function:exit"]() {
|
|
@@ -404,7 +407,7 @@ function getCallKind3(node, context) {
|
|
|
404
407
|
}
|
|
405
408
|
}
|
|
406
409
|
function getFunctionKind2(node) {
|
|
407
|
-
return tools.O.getOrElse(
|
|
410
|
+
return tools.O.getOrElse(getPhaseKindOfFunction(node), tools.F.constant("other"));
|
|
408
411
|
}
|
|
409
412
|
var no_leaked_resize_observer_default = createRule({
|
|
410
413
|
meta: {
|
|
@@ -549,7 +552,7 @@ var no_leaked_timeout_default = createRule({
|
|
|
549
552
|
});
|
|
550
553
|
return {
|
|
551
554
|
[":function"](node) {
|
|
552
|
-
const fKind = tools.O.getOrElse(
|
|
555
|
+
const fKind = tools.O.getOrElse(getPhaseKindOfFunction(node), () => "other");
|
|
553
556
|
fStack.push([node, fKind]);
|
|
554
557
|
},
|
|
555
558
|
[":function:exit"]() {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as AST2 from '@eslint-react/ast';
|
|
2
|
-
import { isInversePhase, PHASE_RELEVANCE,
|
|
2
|
+
import { isInversePhase, PHASE_RELEVANCE, isSetupFunction, isCleanupFunction, isComponentDidMountFunction, isComponentWillUnmountFunction } from '@eslint-react/core';
|
|
3
3
|
import * as JSX from '@eslint-react/jsx';
|
|
4
4
|
import { Data, O, F, or, not, isBoolean } from '@eslint-react/tools';
|
|
5
5
|
import * as VAR2 from '@eslint-react/var';
|
|
@@ -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.17.2-next.
|
|
14
|
+
var version = "1.17.2-next.6";
|
|
15
15
|
var createRule = createRuleForPlugin("web-api");
|
|
16
16
|
function getInstanceID(node, prev) {
|
|
17
17
|
switch (true) {
|
|
@@ -27,6 +27,9 @@ function getInstanceID(node, prev) {
|
|
|
27
27
|
return getInstanceID(node.parent, node);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
function getPhaseKindOfFunction(node) {
|
|
31
|
+
return match(node).when(isSetupFunction, () => O.some("setup")).when(isCleanupFunction, () => O.some("cleanup")).when(isComponentDidMountFunction, () => O.some("mount")).when(isComponentWillUnmountFunction, () => O.some("unmount")).otherwise(O.none);
|
|
32
|
+
}
|
|
30
33
|
function isInstanceIDEqual(a, b, context) {
|
|
31
34
|
return AST2.isNodeEqual(a, b) || VAR2.isNodeValueEqual(a, b, [context.sourceCode.getScope(a), context.sourceCode.getScope(b)]);
|
|
32
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "1.17.2-next.
|
|
3
|
+
"version": "1.17.2-next.6",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@typescript-eslint/utils": "^8.16.0",
|
|
48
48
|
"birecord": "^0.1.1",
|
|
49
49
|
"ts-pattern": "^5.5.0",
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/core": "1.17.2-next.
|
|
54
|
-
"@eslint-react/tools": "1.17.2-next.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
50
|
+
"@eslint-react/ast": "1.17.2-next.6",
|
|
51
|
+
"@eslint-react/shared": "1.17.2-next.6",
|
|
52
|
+
"@eslint-react/jsx": "1.17.2-next.6",
|
|
53
|
+
"@eslint-react/core": "1.17.2-next.6",
|
|
54
|
+
"@eslint-react/tools": "1.17.2-next.6",
|
|
55
|
+
"@eslint-react/var": "1.17.2-next.6",
|
|
56
|
+
"@eslint-react/types": "1.17.2-next.6"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/react": "^18.3.12",
|