eslint-plugin-react-web-api 2.0.0-next.5 → 2.0.0-next.51
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 -8
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getDocsUrl, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
|
|
2
2
|
import * as AST from '@eslint-react/ast';
|
|
3
3
|
import * as ER4 from '@eslint-react/core';
|
|
4
|
-
import {
|
|
4
|
+
import { unit, or } from '@eslint-react/eff';
|
|
5
5
|
import * as VAR from '@eslint-react/var';
|
|
6
6
|
import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
7
7
|
import { match, isMatching, P } from 'ts-pattern';
|
|
@@ -33,7 +33,7 @@ var settings = {
|
|
|
33
33
|
|
|
34
34
|
// package.json
|
|
35
35
|
var name2 = "eslint-plugin-react-web-api";
|
|
36
|
-
var version = "2.0.0-next.
|
|
36
|
+
var version = "2.0.0-next.51";
|
|
37
37
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("web-api"));
|
|
38
38
|
function getPhaseKindOfFunction(node) {
|
|
39
39
|
return match(node).when(isFunctionOfUseEffectSetup, () => "setup").when(isFunctionOfUseEffectCleanup, () => "cleanup").when(isFunctionOfComponentDidMount, () => "mount").when(isFunctionOfComponentWillUnmount, () => "unmount").otherwise(() => null);
|
|
@@ -63,7 +63,7 @@ var RULE_FEATURES = [];
|
|
|
63
63
|
var defaultOptions = {
|
|
64
64
|
capture: false,
|
|
65
65
|
// once: false,
|
|
66
|
-
signal:
|
|
66
|
+
signal: unit
|
|
67
67
|
};
|
|
68
68
|
function getCallKind(node) {
|
|
69
69
|
switch (true) {
|
|
@@ -79,7 +79,7 @@ function getFunctionKind(node) {
|
|
|
79
79
|
return getPhaseKindOfFunction(node) ?? "other";
|
|
80
80
|
}
|
|
81
81
|
function getSignalValueExpression(node, initialScope) {
|
|
82
|
-
if (node == null) return
|
|
82
|
+
if (node == null) return unit;
|
|
83
83
|
switch (node.type) {
|
|
84
84
|
case AST_NODE_TYPES.Identifier: {
|
|
85
85
|
return getSignalValueExpression(VAR.getVariableInitNode(VAR.findVariable(node, initialScope), 0), initialScope);
|
|
@@ -87,7 +87,7 @@ function getSignalValueExpression(node, initialScope) {
|
|
|
87
87
|
case AST_NODE_TYPES.MemberExpression:
|
|
88
88
|
return node;
|
|
89
89
|
default:
|
|
90
|
-
return
|
|
90
|
+
return unit;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
function getOptions(node, initialScope) {
|
|
@@ -95,7 +95,7 @@ function getOptions(node, initialScope) {
|
|
|
95
95
|
return VAR.findPropertyInProperties(propName, properties, initialScope);
|
|
96
96
|
}
|
|
97
97
|
function getPropValue(prop, filter = (a) => true) {
|
|
98
|
-
if (prop?.type !== AST_NODE_TYPES.Property) return
|
|
98
|
+
if (prop?.type !== AST_NODE_TYPES.Property) return unit;
|
|
99
99
|
const { value } = prop;
|
|
100
100
|
let v = value;
|
|
101
101
|
switch (value.type) {
|
|
@@ -108,7 +108,7 @@ function getOptions(node, initialScope) {
|
|
|
108
108
|
break;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
return filter(v) ? v :
|
|
111
|
+
return filter(v) ? v : unit;
|
|
112
112
|
}
|
|
113
113
|
function getOpts(node2) {
|
|
114
114
|
switch (node2.type) {
|
|
@@ -127,7 +127,7 @@ function getOptions(node, initialScope) {
|
|
|
127
127
|
const pCapture = findProp(node2.properties, "capture");
|
|
128
128
|
const vCapture = !!getPropValue(pCapture);
|
|
129
129
|
const pSignal = findProp(node2.properties, "signal");
|
|
130
|
-
const vSignal = pSignal?.type === AST_NODE_TYPES.Property ? getSignalValueExpression(pSignal.value, initialScope) :
|
|
130
|
+
const vSignal = pSignal?.type === AST_NODE_TYPES.Property ? getSignalValueExpression(pSignal.value, initialScope) : unit;
|
|
131
131
|
return { capture: vCapture, signal: vSignal };
|
|
132
132
|
}
|
|
133
133
|
default: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.51",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -35,26 +35,26 @@
|
|
|
35
35
|
"./package.json"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
39
|
-
"@typescript-eslint/types": "^8.
|
|
40
|
-
"@typescript-eslint/utils": "^8.
|
|
38
|
+
"@typescript-eslint/scope-manager": "^8.34.1",
|
|
39
|
+
"@typescript-eslint/types": "^8.34.1",
|
|
40
|
+
"@typescript-eslint/utils": "^8.34.1",
|
|
41
41
|
"string-ts": "^2.2.1",
|
|
42
|
-
"ts-pattern": "^5.7.
|
|
43
|
-
"@eslint-react/ast": "2.0.0-next.
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
42
|
+
"ts-pattern": "^5.7.1",
|
|
43
|
+
"@eslint-react/ast": "2.0.0-next.51",
|
|
44
|
+
"@eslint-react/core": "2.0.0-next.51",
|
|
45
|
+
"@eslint-react/eff": "2.0.0-next.51",
|
|
46
|
+
"@eslint-react/shared": "2.0.0-next.51",
|
|
47
|
+
"@eslint-react/kit": "2.0.0-next.51",
|
|
48
|
+
"@eslint-react/var": "2.0.0-next.51"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@types/react": "^19.1.
|
|
52
|
-
"@types/react-dom": "^19.1.
|
|
53
|
-
"tsup": "^8.
|
|
51
|
+
"@types/react": "^19.1.8",
|
|
52
|
+
"@types/react-dom": "^19.1.6",
|
|
53
|
+
"tsup": "^8.5.0",
|
|
54
54
|
"@local/configs": "0.0.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"eslint": "^9.
|
|
57
|
+
"eslint": "^9.29.0",
|
|
58
58
|
"typescript": "^4.9.5 || ^5.4.5"
|
|
59
59
|
},
|
|
60
60
|
"peerDependenciesMeta": {
|