eslint-plugin-react-web-api 3.0.0-next.61 → 3.0.0-next.63
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 +20 -32
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener } from "
|
|
|
2
2
|
import * as ast from "@eslint-react/ast";
|
|
3
3
|
import * as core from "@eslint-react/core";
|
|
4
4
|
import { dual, or, unit } from "@eslint-react/eff";
|
|
5
|
-
import { findEnclosingAssignmentTarget,
|
|
5
|
+
import { findEnclosingAssignmentTarget, isAssignmentTargetEqual, isValueEqual } from "@eslint-react/var";
|
|
6
6
|
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
7
|
-
import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
|
|
7
|
+
import { findVariable, getStaticValue } from "@typescript-eslint/utils/ast-utils";
|
|
8
8
|
import { P, isMatching, match } from "ts-pattern";
|
|
9
9
|
import birecord from "birecord";
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region package.json
|
|
29
29
|
var name$1 = "eslint-plugin-react-web-api";
|
|
30
|
-
var version = "3.0.0-next.
|
|
30
|
+
var version = "3.0.0-next.63";
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/types/component-phase.ts
|
|
@@ -67,16 +67,7 @@ function getFunctionKind$1(node) {
|
|
|
67
67
|
function getSignalValueExpression(node, initialScope) {
|
|
68
68
|
if (node == null) return unit;
|
|
69
69
|
switch (node.type) {
|
|
70
|
-
case AST_NODE_TYPES.Identifier:
|
|
71
|
-
function resolve(v) {
|
|
72
|
-
if (v == null) return unit;
|
|
73
|
-
const def = v.defs.at(0);
|
|
74
|
-
if (def == null) return unit;
|
|
75
|
-
if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
|
|
76
|
-
return unit;
|
|
77
|
-
}
|
|
78
|
-
return getSignalValueExpression(resolve(findVariable(node, initialScope)), initialScope);
|
|
79
|
-
}
|
|
70
|
+
case AST_NODE_TYPES.Identifier: return getSignalValueExpression(resolve$1(findVariable(initialScope, node)), initialScope);
|
|
80
71
|
case AST_NODE_TYPES.MemberExpression: return node;
|
|
81
72
|
default: return unit;
|
|
82
73
|
}
|
|
@@ -85,14 +76,7 @@ function getOptions(node, initialScope) {
|
|
|
85
76
|
function getOpts(node) {
|
|
86
77
|
switch (node.type) {
|
|
87
78
|
case AST_NODE_TYPES.Identifier: {
|
|
88
|
-
|
|
89
|
-
if (v == null) return unit;
|
|
90
|
-
const def = v.defs.at(0);
|
|
91
|
-
if (def == null) return unit;
|
|
92
|
-
if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
|
|
93
|
-
return unit;
|
|
94
|
-
}
|
|
95
|
-
const variableNode = resolve(findVariable(node, initialScope));
|
|
79
|
+
const variableNode = resolve$1(findVariable(initialScope, node));
|
|
96
80
|
if (variableNode?.type === AST_NODE_TYPES.ObjectExpression) return getOpts(variableNode);
|
|
97
81
|
return defaultOptions;
|
|
98
82
|
}
|
|
@@ -238,6 +222,13 @@ function create$3(context) {
|
|
|
238
222
|
}
|
|
239
223
|
});
|
|
240
224
|
}
|
|
225
|
+
function resolve$1(v) {
|
|
226
|
+
if (v == null) return unit;
|
|
227
|
+
const def = v.defs.at(0);
|
|
228
|
+
if (def == null) return unit;
|
|
229
|
+
if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
|
|
230
|
+
return unit;
|
|
231
|
+
}
|
|
241
232
|
|
|
242
233
|
//#endregion
|
|
243
234
|
//#region src/rules/no-leaked-interval/no-leaked-interval.ts
|
|
@@ -357,17 +348,7 @@ function isNewResizeObserver(node) {
|
|
|
357
348
|
}
|
|
358
349
|
function isFromObserver(context, node) {
|
|
359
350
|
switch (true) {
|
|
360
|
-
case node.type === AST_NODE_TYPES.Identifier:
|
|
361
|
-
const variable = findVariable(node, context.sourceCode.getScope(node));
|
|
362
|
-
function resolve(v) {
|
|
363
|
-
if (v == null) return unit;
|
|
364
|
-
const def = v.defs.at(0);
|
|
365
|
-
if (def == null) return unit;
|
|
366
|
-
if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
|
|
367
|
-
return unit;
|
|
368
|
-
}
|
|
369
|
-
return isNewResizeObserver(resolve(variable));
|
|
370
|
-
}
|
|
351
|
+
case node.type === AST_NODE_TYPES.Identifier: return isNewResizeObserver(resolve(findVariable(context.sourceCode.getScope(node), node)));
|
|
371
352
|
case node.type === AST_NODE_TYPES.MemberExpression: return isFromObserver(context, node.object);
|
|
372
353
|
default: return false;
|
|
373
354
|
}
|
|
@@ -500,6 +481,13 @@ function create$1(context) {
|
|
|
500
481
|
}
|
|
501
482
|
});
|
|
502
483
|
}
|
|
484
|
+
function resolve(v) {
|
|
485
|
+
if (v == null) return unit;
|
|
486
|
+
const def = v.defs.at(0);
|
|
487
|
+
if (def == null) return unit;
|
|
488
|
+
if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
|
|
489
|
+
return unit;
|
|
490
|
+
}
|
|
503
491
|
|
|
504
492
|
//#endregion
|
|
505
493
|
//#region src/rules/no-leaked-timeout/no-leaked-timeout.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.63",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@typescript-eslint/utils": "canary",
|
|
44
44
|
"birecord": "^0.1.1",
|
|
45
45
|
"ts-pattern": "^5.9.0",
|
|
46
|
-
"@eslint-react/ast": "3.0.0-next.
|
|
47
|
-
"@eslint-react/core": "3.0.0-next.
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
46
|
+
"@eslint-react/ast": "3.0.0-next.63",
|
|
47
|
+
"@eslint-react/core": "3.0.0-next.63",
|
|
48
|
+
"@eslint-react/eff": "3.0.0-next.63",
|
|
49
|
+
"@eslint-react/var": "3.0.0-next.63",
|
|
50
|
+
"@eslint-react/shared": "3.0.0-next.63"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/react": "^19.2.14",
|