eslint-plugin-react-web-api 3.0.0-next.0 → 3.0.0-next.12
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 +17 -25
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, getConfigAdapters } from "@eslint-react/shared";
|
|
1
|
+
import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener, getConfigAdapters } from "@eslint-react/shared";
|
|
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";
|
|
@@ -43,7 +43,7 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
|
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region package.json
|
|
45
45
|
var name = "eslint-plugin-react-web-api";
|
|
46
|
-
var version = "3.0.0-next.
|
|
46
|
+
var version = "3.0.0-next.12";
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/types/component-phase.ts
|
|
@@ -92,20 +92,6 @@ function getOptions(node, initialScope) {
|
|
|
92
92
|
function findProp(properties, propName) {
|
|
93
93
|
return findProperty(propName, properties, initialScope);
|
|
94
94
|
}
|
|
95
|
-
function getPropValue(prop, filter = (a) => true) {
|
|
96
|
-
if (prop?.type !== AST_NODE_TYPES.Property) return unit;
|
|
97
|
-
const { value } = prop;
|
|
98
|
-
let v = value;
|
|
99
|
-
switch (value.type) {
|
|
100
|
-
case AST_NODE_TYPES.Literal:
|
|
101
|
-
v = value.value;
|
|
102
|
-
break;
|
|
103
|
-
default:
|
|
104
|
-
v = getStaticValue(value, initialScope)?.value;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
return filter(v) ? v : unit;
|
|
108
|
-
}
|
|
109
95
|
function getOpts(node) {
|
|
110
96
|
switch (node.type) {
|
|
111
97
|
case AST_NODE_TYPES.Identifier: {
|
|
@@ -118,7 +104,13 @@ function getOptions(node, initialScope) {
|
|
|
118
104
|
capture: Boolean(node.value)
|
|
119
105
|
};
|
|
120
106
|
case AST_NODE_TYPES.ObjectExpression: {
|
|
121
|
-
const vCapture =
|
|
107
|
+
const vCapture = match(findProp(node.properties, "capture")).with(P.nullish, () => false).with({ type: AST_NODE_TYPES.Property }, (prop) => {
|
|
108
|
+
const value = prop.value;
|
|
109
|
+
switch (value.type) {
|
|
110
|
+
case AST_NODE_TYPES.Literal: return Boolean(value.value);
|
|
111
|
+
default: return Boolean(getStaticValue(value, initialScope)?.value);
|
|
112
|
+
}
|
|
113
|
+
}).otherwise(() => false);
|
|
122
114
|
const pSignal = findProp(node.properties, "signal");
|
|
123
115
|
return {
|
|
124
116
|
capture: vCapture,
|
|
@@ -174,7 +166,7 @@ function create$3(context) {
|
|
|
174
166
|
data: { eventMethodKind: callKind }
|
|
175
167
|
});
|
|
176
168
|
}
|
|
177
|
-
return {
|
|
169
|
+
return defineRuleListener({
|
|
178
170
|
[":function"](node) {
|
|
179
171
|
const kind = getFunctionKind$1(node);
|
|
180
172
|
fEntries.push({
|
|
@@ -247,7 +239,7 @@ function create$3(context) {
|
|
|
247
239
|
}
|
|
248
240
|
}
|
|
249
241
|
}
|
|
250
|
-
};
|
|
242
|
+
});
|
|
251
243
|
}
|
|
252
244
|
|
|
253
245
|
//#endregion
|
|
@@ -283,7 +275,7 @@ function create$2(context) {
|
|
|
283
275
|
function isInverseEntry(a, b) {
|
|
284
276
|
return isAssignmentTargetEqual(context, a.timerId, b.timerId);
|
|
285
277
|
}
|
|
286
|
-
return {
|
|
278
|
+
return defineRuleListener({
|
|
287
279
|
[":function"](node) {
|
|
288
280
|
const kind = getPhaseKindOfFunction(node) ?? "other";
|
|
289
281
|
fEntries.push({
|
|
@@ -357,7 +349,7 @@ function create$2(context) {
|
|
|
357
349
|
}
|
|
358
350
|
}
|
|
359
351
|
}
|
|
360
|
-
};
|
|
352
|
+
});
|
|
361
353
|
}
|
|
362
354
|
|
|
363
355
|
//#endregion
|
|
@@ -405,7 +397,7 @@ function create$1(context) {
|
|
|
405
397
|
const oEntries = [];
|
|
406
398
|
const uEntries = [];
|
|
407
399
|
const dEntries = [];
|
|
408
|
-
return {
|
|
400
|
+
return defineRuleListener({
|
|
409
401
|
[":function"](node) {
|
|
410
402
|
const kind = getFunctionKind(node);
|
|
411
403
|
fEntries.push({
|
|
@@ -499,7 +491,7 @@ function create$1(context) {
|
|
|
499
491
|
}
|
|
500
492
|
}
|
|
501
493
|
}
|
|
502
|
-
};
|
|
494
|
+
});
|
|
503
495
|
}
|
|
504
496
|
|
|
505
497
|
//#endregion
|
|
@@ -535,7 +527,7 @@ function create(context) {
|
|
|
535
527
|
function isInverseEntry(a, b) {
|
|
536
528
|
return isAssignmentTargetEqual(context, a.timerId, b.timerId);
|
|
537
529
|
}
|
|
538
|
-
return {
|
|
530
|
+
return defineRuleListener({
|
|
539
531
|
[":function"](node) {
|
|
540
532
|
const kind = getPhaseKindOfFunction(node) ?? "other";
|
|
541
533
|
fEntries.push({
|
|
@@ -605,7 +597,7 @@ function create(context) {
|
|
|
605
597
|
}
|
|
606
598
|
}
|
|
607
599
|
}
|
|
608
|
-
};
|
|
600
|
+
});
|
|
609
601
|
}
|
|
610
602
|
|
|
611
603
|
//#endregion
|
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.12",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"./package.json"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@typescript-eslint/scope-manager": "
|
|
42
|
-
"@typescript-eslint/types": "
|
|
43
|
-
"@typescript-eslint/utils": "
|
|
41
|
+
"@typescript-eslint/scope-manager": "canary",
|
|
42
|
+
"@typescript-eslint/types": "canary",
|
|
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/eff": "3.0.0-next.
|
|
49
|
-
"@eslint-react/shared": "3.0.0-next.
|
|
50
|
-
"@eslint-react/var": "3.0.0-next.
|
|
46
|
+
"@eslint-react/ast": "3.0.0-next.12",
|
|
47
|
+
"@eslint-react/core": "3.0.0-next.12",
|
|
48
|
+
"@eslint-react/eff": "3.0.0-next.12",
|
|
49
|
+
"@eslint-react/shared": "3.0.0-next.12",
|
|
50
|
+
"@eslint-react/var": "3.0.0-next.12"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/react": "^19.2.14",
|