eslint-plugin-react-web-api 5.17.2 → 5.18.0
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 +5 -47
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region package.json
|
|
30
30
|
var name$1 = "eslint-plugin-react-web-api";
|
|
31
|
-
var version = "5.
|
|
31
|
+
var version = "5.18.0";
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region src/types/component-phase.ts
|
|
@@ -46,16 +46,6 @@ const createRule = ESLintUtils.RuleCreator(getDocsUrl);
|
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/rules/no-leaked-event-listener/lib.ts
|
|
49
|
-
function findProperty$1(node, name) {
|
|
50
|
-
for (const property of node) {
|
|
51
|
-
if (property.type === AST_NODE_TYPES.Property && !property.computed && property.key.type === AST_NODE_TYPES.Identifier && property.key.name === name) return property;
|
|
52
|
-
if (property.type === AST_NODE_TYPES.SpreadElement && property.argument.type === AST_NODE_TYPES.ObjectExpression) {
|
|
53
|
-
const found = findProperty$1(property.argument.properties, name);
|
|
54
|
-
if (found != null) return found;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
49
|
function getSignalValueExpression(context, node) {
|
|
60
50
|
if (node == null) return null;
|
|
61
51
|
switch (node.type) {
|
|
@@ -86,14 +76,14 @@ function getOptions(context, node) {
|
|
|
86
76
|
capture: Boolean(node.value)
|
|
87
77
|
};
|
|
88
78
|
case AST_NODE_TYPES.ObjectExpression: {
|
|
89
|
-
const vCapture = match(findProperty
|
|
79
|
+
const vCapture = match(Extract.findProperty(node.properties, "capture")).with(P.nullish, () => false).with({ type: AST_NODE_TYPES.Property }, (prop) => {
|
|
90
80
|
const value = prop.value;
|
|
91
81
|
switch (value.type) {
|
|
92
82
|
case AST_NODE_TYPES.Literal: return Boolean(value.value);
|
|
93
83
|
default: return Boolean(getStaticValue(value, context.sourceCode.getScope(node))?.value);
|
|
94
84
|
}
|
|
95
85
|
}).otherwise(() => false);
|
|
96
|
-
const pSignal = findProperty
|
|
86
|
+
const pSignal = Extract.findProperty(node.properties, "signal");
|
|
97
87
|
return {
|
|
98
88
|
capture: vCapture,
|
|
99
89
|
signal: pSignal?.type === AST_NODE_TYPES.Property ? getSignalValueExpression(context, pSignal.value) : null
|
|
@@ -875,22 +865,6 @@ const takeWhile = dual(2, (xs, pred) => {
|
|
|
875
865
|
|
|
876
866
|
//#endregion
|
|
877
867
|
//#region src/rules/no-leaked-intersection-observer/lib.ts
|
|
878
|
-
/**
|
|
879
|
-
* Check if a node is a conditional expression or control flow statement
|
|
880
|
-
* @param node The node to check
|
|
881
|
-
* @returns True if the node is conditional
|
|
882
|
-
*/
|
|
883
|
-
const isConditional$1 = Check.isOneOf([
|
|
884
|
-
AST_NODE_TYPES.DoWhileStatement,
|
|
885
|
-
AST_NODE_TYPES.ForInStatement,
|
|
886
|
-
AST_NODE_TYPES.ForOfStatement,
|
|
887
|
-
AST_NODE_TYPES.ForStatement,
|
|
888
|
-
AST_NODE_TYPES.WhileStatement,
|
|
889
|
-
AST_NODE_TYPES.IfStatement,
|
|
890
|
-
AST_NODE_TYPES.SwitchStatement,
|
|
891
|
-
AST_NODE_TYPES.LogicalExpression,
|
|
892
|
-
AST_NODE_TYPES.ConditionalExpression
|
|
893
|
-
]);
|
|
894
868
|
function isNewIntersectionObserver(node) {
|
|
895
869
|
if (node?.type !== AST_NODE_TYPES.NewExpression) return false;
|
|
896
870
|
const callee = Extract.unwrap(node.callee);
|
|
@@ -1020,7 +994,7 @@ function create$3(context) {
|
|
|
1020
994
|
if (dEntries.some((e) => !isInsideObserverCallback(e) && isAssignmentTargetEqual(context, e.observer, id))) continue;
|
|
1021
995
|
const oentries = oEntries.filter((e) => isAssignmentTargetEqual(context, e.observer, id));
|
|
1022
996
|
const uentries = uEntries.filter((e) => isAssignmentTargetEqual(context, e.observer, id));
|
|
1023
|
-
const isDynamic = (node) => node?.type === AST_NODE_TYPES.CallExpression || isConditional
|
|
997
|
+
const isDynamic = (node) => node?.type === AST_NODE_TYPES.CallExpression || Check.isConditional(node);
|
|
1024
998
|
const isPhaseNode = (node) => node === phaseNode;
|
|
1025
999
|
if (oentries.some((e) => !isPhaseNode(Traverse.findParent(e.node, or(isDynamic, isPhaseNode))))) {
|
|
1026
1000
|
context.report({
|
|
@@ -1142,22 +1116,6 @@ function create$2(context) {
|
|
|
1142
1116
|
|
|
1143
1117
|
//#endregion
|
|
1144
1118
|
//#region src/rules/no-leaked-resize-observer/lib.ts
|
|
1145
|
-
/**
|
|
1146
|
-
* Check if a node is a conditional expression or control flow statement
|
|
1147
|
-
* @param node The node to check
|
|
1148
|
-
* @returns True if the node is conditional
|
|
1149
|
-
*/
|
|
1150
|
-
const isConditional = Check.isOneOf([
|
|
1151
|
-
AST_NODE_TYPES.DoWhileStatement,
|
|
1152
|
-
AST_NODE_TYPES.ForInStatement,
|
|
1153
|
-
AST_NODE_TYPES.ForOfStatement,
|
|
1154
|
-
AST_NODE_TYPES.ForStatement,
|
|
1155
|
-
AST_NODE_TYPES.WhileStatement,
|
|
1156
|
-
AST_NODE_TYPES.IfStatement,
|
|
1157
|
-
AST_NODE_TYPES.SwitchStatement,
|
|
1158
|
-
AST_NODE_TYPES.LogicalExpression,
|
|
1159
|
-
AST_NODE_TYPES.ConditionalExpression
|
|
1160
|
-
]);
|
|
1161
1119
|
function isNewResizeObserver(node) {
|
|
1162
1120
|
if (node?.type !== AST_NODE_TYPES.NewExpression) return false;
|
|
1163
1121
|
const callee = Extract.unwrap(node.callee);
|
|
@@ -1287,7 +1245,7 @@ function create$1(context) {
|
|
|
1287
1245
|
if (dEntries.some((e) => !isInsideObserverCallback(e) && isAssignmentTargetEqual(context, e.observer, id))) continue;
|
|
1288
1246
|
const oentries = oEntries.filter((e) => isAssignmentTargetEqual(context, e.observer, id));
|
|
1289
1247
|
const uentries = uEntries.filter((e) => isAssignmentTargetEqual(context, e.observer, id));
|
|
1290
|
-
const isDynamic = (node) => node?.type === AST_NODE_TYPES.CallExpression || isConditional(node);
|
|
1248
|
+
const isDynamic = (node) => node?.type === AST_NODE_TYPES.CallExpression || Check.isConditional(node);
|
|
1291
1249
|
const isPhaseNode = (node) => node === phaseNode;
|
|
1292
1250
|
if (oentries.some((e) => !isPhaseNode(Traverse.findParent(e.node, or(isDynamic, isPhaseNode))))) {
|
|
1293
1251
|
context.report({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.18.0",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@typescript-eslint/types": "^8.
|
|
41
|
-
"@typescript-eslint/utils": "^8.
|
|
40
|
+
"@typescript-eslint/types": "^8.65.0",
|
|
41
|
+
"@typescript-eslint/utils": "^8.65.0",
|
|
42
42
|
"birecord": "^0.1.2",
|
|
43
43
|
"ts-pattern": "^5.9.0",
|
|
44
|
-
"@eslint-react/ast": "5.
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
44
|
+
"@eslint-react/ast": "5.18.0",
|
|
45
|
+
"@eslint-react/eslint": "5.18.0",
|
|
46
|
+
"@eslint-react/core": "5.18.0",
|
|
47
|
+
"@eslint-react/var": "5.18.0",
|
|
48
|
+
"@eslint-react/shared": "5.18.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/react": "^19.2.17",
|
|
52
52
|
"@types/react-dom": "^19.2.3",
|
|
53
53
|
"dedent": "^1.7.2",
|
|
54
54
|
"eslint": "^10.7.0",
|
|
55
|
-
"tsdown": "^0.22.
|
|
55
|
+
"tsdown": "^0.22.13",
|
|
56
56
|
"typescript": "6.0.3",
|
|
57
57
|
"@local/configs": "0.0.0",
|
|
58
58
|
"@local/eff": "0.0.0"
|