eslint-plugin-react-x 1.24.0-next.1 → 1.24.0-next.2
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/dist/index.mjs +8 -8
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
|
42
42
|
|
|
43
43
|
// package.json
|
|
44
44
|
var name = "eslint-plugin-react-x";
|
|
45
|
-
var version = "1.24.0-next.
|
|
45
|
+
var version = "1.24.0-next.2";
|
|
46
46
|
var createRule = shared.createRuleForPlugin("x");
|
|
47
47
|
|
|
48
48
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1171,7 +1171,7 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1171
1171
|
if (!isAssignmentToThisState(node)) {
|
|
1172
1172
|
return;
|
|
1173
1173
|
}
|
|
1174
|
-
const parentClass = AST11__namespace.
|
|
1174
|
+
const parentClass = AST11__namespace.findParentNode(
|
|
1175
1175
|
node,
|
|
1176
1176
|
AST11__namespace.isOneOf([
|
|
1177
1177
|
types.AST_NODE_TYPES.ClassDeclaration,
|
|
@@ -1179,7 +1179,7 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1179
1179
|
])
|
|
1180
1180
|
);
|
|
1181
1181
|
if (parentClass == null) return;
|
|
1182
|
-
if (core.isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST11__namespace.
|
|
1182
|
+
if (core.isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST11__namespace.findParentNode(node, isConstructorFunction)) {
|
|
1183
1183
|
context.report({
|
|
1184
1184
|
messageId: "noDirectMutationState",
|
|
1185
1185
|
node
|
|
@@ -1280,7 +1280,7 @@ var no_duplicate_key_default = createRule({
|
|
|
1280
1280
|
break;
|
|
1281
1281
|
}
|
|
1282
1282
|
default: {
|
|
1283
|
-
const call = AST11__namespace.
|
|
1283
|
+
const call = AST11__namespace.findParentNode(jsxElement, AST11__namespace.isMapCallLoose);
|
|
1284
1284
|
const iter = AST11__namespace.findParentNode(jsxElement, (n) => n === call || AST11__namespace.isFunction(n));
|
|
1285
1285
|
if (!AST11__namespace.isFunction(iter)) return;
|
|
1286
1286
|
const arg0 = call?.arguments[0];
|
|
@@ -1884,7 +1884,7 @@ var no_nested_components_default = createRule({
|
|
|
1884
1884
|
});
|
|
1885
1885
|
continue;
|
|
1886
1886
|
}
|
|
1887
|
-
const parentComponent = AST11__namespace.
|
|
1887
|
+
const parentComponent = AST11__namespace.findParentNode(component, isFunctionComponent);
|
|
1888
1888
|
const isParnetComponentNotDirectValueOfRenderProperty = parentComponent != null && !core.isDirectValueOfRenderPropertyLoose(parentComponent);
|
|
1889
1889
|
if (isParnetComponentNotDirectValueOfRenderProperty) {
|
|
1890
1890
|
context.report({
|
|
@@ -2058,7 +2058,7 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
2058
2058
|
if (!core.isThisSetState(node)) {
|
|
2059
2059
|
return;
|
|
2060
2060
|
}
|
|
2061
|
-
const clazz = AST11__namespace.
|
|
2061
|
+
const clazz = AST11__namespace.findParentNode(node, core.isClassComponent);
|
|
2062
2062
|
const method = AST11__namespace.findParentNode(node, (n) => n === clazz || isComponentDidMount(n));
|
|
2063
2063
|
if (clazz == null || method == null || method === clazz) return;
|
|
2064
2064
|
const methodScope = context.sourceCode.getScope(method);
|
|
@@ -2103,7 +2103,7 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
2103
2103
|
if (!core.isThisSetState(node)) {
|
|
2104
2104
|
return;
|
|
2105
2105
|
}
|
|
2106
|
-
const clazz = AST11__namespace.
|
|
2106
|
+
const clazz = AST11__namespace.findParentNode(node, core.isClassComponent);
|
|
2107
2107
|
const method = AST11__namespace.findParentNode(node, (n) => n === clazz || isComponentDidUpdate(n));
|
|
2108
2108
|
if (clazz == null || method == null || method === clazz) return;
|
|
2109
2109
|
const methodScope = context.sourceCode.getScope(method);
|
|
@@ -2148,7 +2148,7 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
2148
2148
|
if (!core.isThisSetState(node)) {
|
|
2149
2149
|
return;
|
|
2150
2150
|
}
|
|
2151
|
-
const clazz = AST11__namespace.
|
|
2151
|
+
const clazz = AST11__namespace.findParentNode(node, core.isClassComponent);
|
|
2152
2152
|
const method = AST11__namespace.findParentNode(node, (n) => n === clazz || isComponentWillUpdate3(n));
|
|
2153
2153
|
if (clazz == null || method == null || method === clazz) return;
|
|
2154
2154
|
const methodScope = context.sourceCode.getScope(method);
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReado
|
|
|
15
15
|
|
|
16
16
|
// package.json
|
|
17
17
|
var name = "eslint-plugin-react-x";
|
|
18
|
-
var version = "1.24.0-next.
|
|
18
|
+
var version = "1.24.0-next.2";
|
|
19
19
|
var createRule = createRuleForPlugin("x");
|
|
20
20
|
|
|
21
21
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1144,7 +1144,7 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1144
1144
|
if (!isAssignmentToThisState(node)) {
|
|
1145
1145
|
return;
|
|
1146
1146
|
}
|
|
1147
|
-
const parentClass = AST11.
|
|
1147
|
+
const parentClass = AST11.findParentNode(
|
|
1148
1148
|
node,
|
|
1149
1149
|
AST11.isOneOf([
|
|
1150
1150
|
AST_NODE_TYPES.ClassDeclaration,
|
|
@@ -1152,7 +1152,7 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1152
1152
|
])
|
|
1153
1153
|
);
|
|
1154
1154
|
if (parentClass == null) return;
|
|
1155
|
-
if (isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST11.
|
|
1155
|
+
if (isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST11.findParentNode(node, isConstructorFunction)) {
|
|
1156
1156
|
context.report({
|
|
1157
1157
|
messageId: "noDirectMutationState",
|
|
1158
1158
|
node
|
|
@@ -1253,7 +1253,7 @@ var no_duplicate_key_default = createRule({
|
|
|
1253
1253
|
break;
|
|
1254
1254
|
}
|
|
1255
1255
|
default: {
|
|
1256
|
-
const call = AST11.
|
|
1256
|
+
const call = AST11.findParentNode(jsxElement, AST11.isMapCallLoose);
|
|
1257
1257
|
const iter = AST11.findParentNode(jsxElement, (n) => n === call || AST11.isFunction(n));
|
|
1258
1258
|
if (!AST11.isFunction(iter)) return;
|
|
1259
1259
|
const arg0 = call?.arguments[0];
|
|
@@ -1857,7 +1857,7 @@ var no_nested_components_default = createRule({
|
|
|
1857
1857
|
});
|
|
1858
1858
|
continue;
|
|
1859
1859
|
}
|
|
1860
|
-
const parentComponent = AST11.
|
|
1860
|
+
const parentComponent = AST11.findParentNode(component, isFunctionComponent);
|
|
1861
1861
|
const isParnetComponentNotDirectValueOfRenderProperty = parentComponent != null && !isDirectValueOfRenderPropertyLoose(parentComponent);
|
|
1862
1862
|
if (isParnetComponentNotDirectValueOfRenderProperty) {
|
|
1863
1863
|
context.report({
|
|
@@ -2031,7 +2031,7 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
2031
2031
|
if (!isThisSetState(node)) {
|
|
2032
2032
|
return;
|
|
2033
2033
|
}
|
|
2034
|
-
const clazz = AST11.
|
|
2034
|
+
const clazz = AST11.findParentNode(node, isClassComponent);
|
|
2035
2035
|
const method = AST11.findParentNode(node, (n) => n === clazz || isComponentDidMount(n));
|
|
2036
2036
|
if (clazz == null || method == null || method === clazz) return;
|
|
2037
2037
|
const methodScope = context.sourceCode.getScope(method);
|
|
@@ -2076,7 +2076,7 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
2076
2076
|
if (!isThisSetState(node)) {
|
|
2077
2077
|
return;
|
|
2078
2078
|
}
|
|
2079
|
-
const clazz = AST11.
|
|
2079
|
+
const clazz = AST11.findParentNode(node, isClassComponent);
|
|
2080
2080
|
const method = AST11.findParentNode(node, (n) => n === clazz || isComponentDidUpdate(n));
|
|
2081
2081
|
if (clazz == null || method == null || method === clazz) return;
|
|
2082
2082
|
const methodScope = context.sourceCode.getScope(method);
|
|
@@ -2121,7 +2121,7 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
2121
2121
|
if (!isThisSetState(node)) {
|
|
2122
2122
|
return;
|
|
2123
2123
|
}
|
|
2124
|
-
const clazz = AST11.
|
|
2124
|
+
const clazz = AST11.findParentNode(node, isClassComponent);
|
|
2125
2125
|
const method = AST11.findParentNode(node, (n) => n === clazz || isComponentWillUpdate3(n));
|
|
2126
2126
|
if (clazz == null || method == null || method === clazz) return;
|
|
2127
2127
|
const methodScope = context.sourceCode.getScope(method);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.24.0-next.
|
|
3
|
+
"version": "1.24.0-next.2",
|
|
4
4
|
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"is-immutable-type": "^5.0.1",
|
|
49
49
|
"string-ts": "^2.2.0",
|
|
50
50
|
"ts-pattern": "^5.6.0",
|
|
51
|
-
"@eslint-react/ast": "1.24.0-next.
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/shared": "1.24.0-next.
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
51
|
+
"@eslint-react/ast": "1.24.0-next.2",
|
|
52
|
+
"@eslint-react/core": "1.24.0-next.2",
|
|
53
|
+
"@eslint-react/eff": "1.24.0-next.2",
|
|
54
|
+
"@eslint-react/jsx": "1.24.0-next.2",
|
|
55
|
+
"@eslint-react/shared": "1.24.0-next.2",
|
|
56
|
+
"@eslint-react/var": "1.24.0-next.2",
|
|
57
|
+
"@eslint-react/types": "1.24.0-next.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@types/react": "^19.0.
|
|
60
|
+
"@types/react": "^19.0.6",
|
|
61
61
|
"@types/react-dom": "^19.0.3",
|
|
62
62
|
"ts-api-utils": "^2.0.0",
|
|
63
63
|
"tsup": "^8.3.5",
|