eslint-plugin-react-x 1.52.2-next.1 → 1.52.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 +4 -13
- package/dist/index.mjs +4 -13
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -142,7 +142,7 @@ var settings3 = {
|
|
|
142
142
|
|
|
143
143
|
// package.json
|
|
144
144
|
var name4 = "eslint-plugin-react-x";
|
|
145
|
-
var version = "1.52.2
|
|
145
|
+
var version = "1.52.2";
|
|
146
146
|
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
|
|
147
147
|
|
|
148
148
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1362,17 +1362,8 @@ function create26(context) {
|
|
|
1362
1362
|
const variable = VAR2__namespace.findVariable(object.name, context.sourceCode.getScope(node));
|
|
1363
1363
|
const variableNode = VAR2__namespace.getVariableInitNode(variable, 0);
|
|
1364
1364
|
if (variableNode == null) return;
|
|
1365
|
-
if (!AST8__namespace.isFunction(variableNode)
|
|
1365
|
+
if (!AST8__namespace.isFunction(variableNode)) return;
|
|
1366
1366
|
context.report({ messageId: "noDefaultProps", node: property });
|
|
1367
|
-
},
|
|
1368
|
-
PropertyDefinition(node) {
|
|
1369
|
-
if (!ER25__namespace.isClassComponent(node.parent.parent)) {
|
|
1370
|
-
return;
|
|
1371
|
-
}
|
|
1372
|
-
if (!node.static || node.key.type !== types.AST_NODE_TYPES.Identifier || node.key.name !== "defaultProps") {
|
|
1373
|
-
return;
|
|
1374
|
-
}
|
|
1375
|
-
context.report({ messageId: "noDefaultProps", node });
|
|
1376
1367
|
}
|
|
1377
1368
|
};
|
|
1378
1369
|
}
|
|
@@ -2144,7 +2135,7 @@ function create36(context) {
|
|
|
2144
2135
|
const isFunctionComponent = (node) => {
|
|
2145
2136
|
return AST8__namespace.isFunction(node) && functionComponents.some((component) => component.node === node);
|
|
2146
2137
|
};
|
|
2147
|
-
const
|
|
2138
|
+
const isClassComponent11 = (node) => {
|
|
2148
2139
|
return AST8__namespace.isClass(node) && classComponents.some((component) => component.node === node);
|
|
2149
2140
|
};
|
|
2150
2141
|
for (const { name: name5, node: component } of functionComponents) {
|
|
@@ -2198,7 +2189,7 @@ function create36(context) {
|
|
|
2198
2189
|
}
|
|
2199
2190
|
}
|
|
2200
2191
|
for (const { name: name5 = "unknown", node: component } of classComponents) {
|
|
2201
|
-
if (AST8__namespace.findParentNode(component, (n) =>
|
|
2192
|
+
if (AST8__namespace.findParentNode(component, (n) => isClassComponent11(n) || isFunctionComponent(n)) == null) {
|
|
2202
2193
|
continue;
|
|
2203
2194
|
}
|
|
2204
2195
|
context.report({
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,7 @@ var settings3 = {
|
|
|
115
115
|
|
|
116
116
|
// package.json
|
|
117
117
|
var name4 = "eslint-plugin-react-x";
|
|
118
|
-
var version = "1.52.2
|
|
118
|
+
var version = "1.52.2";
|
|
119
119
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
|
|
120
120
|
|
|
121
121
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1335,17 +1335,8 @@ function create26(context) {
|
|
|
1335
1335
|
const variable = VAR2.findVariable(object.name, context.sourceCode.getScope(node));
|
|
1336
1336
|
const variableNode = VAR2.getVariableInitNode(variable, 0);
|
|
1337
1337
|
if (variableNode == null) return;
|
|
1338
|
-
if (!AST8.isFunction(variableNode)
|
|
1338
|
+
if (!AST8.isFunction(variableNode)) return;
|
|
1339
1339
|
context.report({ messageId: "noDefaultProps", node: property });
|
|
1340
|
-
},
|
|
1341
|
-
PropertyDefinition(node) {
|
|
1342
|
-
if (!ER25.isClassComponent(node.parent.parent)) {
|
|
1343
|
-
return;
|
|
1344
|
-
}
|
|
1345
|
-
if (!node.static || node.key.type !== AST_NODE_TYPES.Identifier || node.key.name !== "defaultProps") {
|
|
1346
|
-
return;
|
|
1347
|
-
}
|
|
1348
|
-
context.report({ messageId: "noDefaultProps", node });
|
|
1349
1340
|
}
|
|
1350
1341
|
};
|
|
1351
1342
|
}
|
|
@@ -2117,7 +2108,7 @@ function create36(context) {
|
|
|
2117
2108
|
const isFunctionComponent = (node) => {
|
|
2118
2109
|
return AST8.isFunction(node) && functionComponents.some((component) => component.node === node);
|
|
2119
2110
|
};
|
|
2120
|
-
const
|
|
2111
|
+
const isClassComponent11 = (node) => {
|
|
2121
2112
|
return AST8.isClass(node) && classComponents.some((component) => component.node === node);
|
|
2122
2113
|
};
|
|
2123
2114
|
for (const { name: name5, node: component } of functionComponents) {
|
|
@@ -2171,7 +2162,7 @@ function create36(context) {
|
|
|
2171
2162
|
}
|
|
2172
2163
|
}
|
|
2173
2164
|
for (const { name: name5 = "unknown", node: component } of classComponents) {
|
|
2174
|
-
if (AST8.findParentNode(component, (n) =>
|
|
2165
|
+
if (AST8.findParentNode(component, (n) => isClassComponent11(n) || isFunctionComponent(n)) == null) {
|
|
2175
2166
|
continue;
|
|
2176
2167
|
}
|
|
2177
2168
|
context.report({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.52.2
|
|
3
|
+
"version": "1.52.2",
|
|
4
4
|
"description": "A set of composable ESLint rules for for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"is-immutable-type": "^5.0.1",
|
|
51
51
|
"string-ts": "^2.2.1",
|
|
52
52
|
"ts-pattern": "^5.7.1",
|
|
53
|
-
"@eslint-react/ast": "1.52.2
|
|
54
|
-
"@eslint-react/eff": "1.52.2
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
53
|
+
"@eslint-react/ast": "1.52.2",
|
|
54
|
+
"@eslint-react/eff": "1.52.2",
|
|
55
|
+
"@eslint-react/shared": "1.52.2",
|
|
56
|
+
"@eslint-react/kit": "1.52.2",
|
|
57
|
+
"@eslint-react/var": "1.52.2",
|
|
58
|
+
"@eslint-react/core": "1.52.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.1.8",
|