eslint-plugin-react-web-api 2.7.4-next.2 → 2.7.4-next.4
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 +11 -11
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, getConfigAdapters } from "@eslint-react/shared";
|
|
2
2
|
import * as AST from "@eslint-react/ast";
|
|
3
|
-
import { ComponentPhaseRelevance,
|
|
3
|
+
import { ComponentPhaseRelevance, getPhaseKindOfFunction, isInitializedFromReactNative, isInversePhase } from "@eslint-react/core";
|
|
4
4
|
import { or, unit } from "@eslint-react/eff";
|
|
5
|
-
import {
|
|
5
|
+
import { findEnclosingAssignmentTarget, findProperty, findVariable, getVariableDefinitionNode, isAssignmentTargetEqual, isNodeValueEqual } from "@eslint-react/var";
|
|
6
6
|
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
7
7
|
import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
|
|
8
8
|
import { P, isMatching, match } from "ts-pattern";
|
|
@@ -42,7 +42,7 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
|
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region package.json
|
|
44
44
|
var name = "eslint-plugin-react-web-api";
|
|
45
|
-
var version = "2.7.4-next.
|
|
45
|
+
var version = "2.7.4-next.4";
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/utils/create-rule.ts
|
|
@@ -269,7 +269,7 @@ function create$2(context) {
|
|
|
269
269
|
const sEntries = [];
|
|
270
270
|
const cEntries = [];
|
|
271
271
|
function isInverseEntry(a, b) {
|
|
272
|
-
return
|
|
272
|
+
return isAssignmentTargetEqual(context, a.timerId, b.timerId);
|
|
273
273
|
}
|
|
274
274
|
return {
|
|
275
275
|
[":function"](node) {
|
|
@@ -288,7 +288,7 @@ function create$2(context) {
|
|
|
288
288
|
const fEntry = fEntries.findLast((x) => x.kind !== "other");
|
|
289
289
|
if (fEntry == null) break;
|
|
290
290
|
if (!ComponentPhaseRelevance.has(fEntry.kind)) break;
|
|
291
|
-
const intervalIdNode =
|
|
291
|
+
const intervalIdNode = findEnclosingAssignmentTarget(node);
|
|
292
292
|
if (intervalIdNode == null) {
|
|
293
293
|
context.report({
|
|
294
294
|
messageId: "expectedIntervalId",
|
|
@@ -466,9 +466,9 @@ function create$1(context) {
|
|
|
466
466
|
},
|
|
467
467
|
["Program:exit"]() {
|
|
468
468
|
for (const { id, node, phaseNode } of observers) {
|
|
469
|
-
if (dEntries.some((e) =>
|
|
470
|
-
const oentries = oEntries.filter((e) =>
|
|
471
|
-
const uentries = uEntries.filter((e) =>
|
|
469
|
+
if (dEntries.some((e) => isAssignmentTargetEqual(context, e.observer, id))) continue;
|
|
470
|
+
const oentries = oEntries.filter((e) => isAssignmentTargetEqual(context, e.observer, id));
|
|
471
|
+
const uentries = uEntries.filter((e) => isAssignmentTargetEqual(context, e.observer, id));
|
|
472
472
|
const isDynamic = (node$1) => node$1?.type === AST_NODE_TYPES.CallExpression || AST.isConditional(node$1);
|
|
473
473
|
const isPhaseNode = (node$1) => node$1 === phaseNode;
|
|
474
474
|
if (oentries.some((e) => !isPhaseNode(AST.findParentNode(e.node, or(isDynamic, isPhaseNode))))) {
|
|
@@ -479,7 +479,7 @@ function create$1(context) {
|
|
|
479
479
|
continue;
|
|
480
480
|
}
|
|
481
481
|
for (const oEntry of oentries) {
|
|
482
|
-
if (uentries.some((uEntry) =>
|
|
482
|
+
if (uentries.some((uEntry) => isAssignmentTargetEqual(context, uEntry.element, oEntry.element))) continue;
|
|
483
483
|
context.report({
|
|
484
484
|
messageId: "expectedDisconnectOrUnobserveInCleanup",
|
|
485
485
|
node: oEntry.node
|
|
@@ -521,7 +521,7 @@ function create(context) {
|
|
|
521
521
|
const sEntries = [];
|
|
522
522
|
const rEntries = [];
|
|
523
523
|
function isInverseEntry(a, b) {
|
|
524
|
-
return
|
|
524
|
+
return isAssignmentTargetEqual(context, a.timerId, b.timerId);
|
|
525
525
|
}
|
|
526
526
|
return {
|
|
527
527
|
[":function"](node) {
|
|
@@ -539,7 +539,7 @@ function create(context) {
|
|
|
539
539
|
if (!ComponentPhaseRelevance.has(fEntry?.kind)) return;
|
|
540
540
|
switch (getCallKind(node)) {
|
|
541
541
|
case "setTimeout": {
|
|
542
|
-
const timeoutIdNode =
|
|
542
|
+
const timeoutIdNode = findEnclosingAssignmentTarget(node);
|
|
543
543
|
if (timeoutIdNode == null) {
|
|
544
544
|
context.report({
|
|
545
545
|
messageId: "expectedTimeoutId",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "2.7.4-next.
|
|
3
|
+
"version": "2.7.4-next.4",
|
|
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": "^8.53.1",
|
|
44
44
|
"string-ts": "^2.3.1",
|
|
45
45
|
"ts-pattern": "^5.9.0",
|
|
46
|
-
"@eslint-react/ast": "2.7.4-next.
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/var": "2.7.4-next.
|
|
46
|
+
"@eslint-react/ast": "2.7.4-next.4",
|
|
47
|
+
"@eslint-react/eff": "2.7.4-next.4",
|
|
48
|
+
"@eslint-react/shared": "2.7.4-next.4",
|
|
49
|
+
"@eslint-react/core": "2.7.4-next.4",
|
|
50
|
+
"@eslint-react/var": "2.7.4-next.4"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/react": "^19.2.9",
|