eslint-plugin-react-x 5.18.0 → 5.18.1
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 +3 -24
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -145,7 +145,7 @@ const rules$6 = {
|
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region package.json
|
|
147
147
|
var name$6 = "eslint-plugin-react-x";
|
|
148
|
-
var version = "5.18.
|
|
148
|
+
var version = "5.18.1";
|
|
149
149
|
|
|
150
150
|
//#endregion
|
|
151
151
|
//#region src/utils/create-rule.ts
|
|
@@ -171,27 +171,6 @@ var error_boundaries_default = createRule({
|
|
|
171
171
|
create: create$50,
|
|
172
172
|
defaultOptions: []
|
|
173
173
|
});
|
|
174
|
-
/**
|
|
175
|
-
* Finds the nearest TryStatement whose `try` block (not catch/finally)
|
|
176
|
-
* encloses the given node.
|
|
177
|
-
* @param node The node to check.
|
|
178
|
-
* @returns The enclosing TryStatement, or null if none is found.
|
|
179
|
-
*/
|
|
180
|
-
function getEnclosingTryBlock(node) {
|
|
181
|
-
let current = node.parent;
|
|
182
|
-
while (current != null) {
|
|
183
|
-
if (current.type === AST_NODE_TYPES.TryStatement) {
|
|
184
|
-
let n = node;
|
|
185
|
-
while (n != null && n !== current) {
|
|
186
|
-
if (n === current.block) return current;
|
|
187
|
-
n = n.parent;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (current.type === AST_NODE_TYPES.Program) return null;
|
|
191
|
-
current = current.parent;
|
|
192
|
-
}
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
174
|
function create$50(context) {
|
|
196
175
|
if (!context.sourceCode.text.includes("try")) return {};
|
|
197
176
|
const hint = core.JsxDetectionHint.DoNotIncludeJsxWithNullValue | core.JsxDetectionHint.DoNotIncludeJsxWithNumberValue | core.JsxDetectionHint.DoNotIncludeJsxWithBigIntValue | core.JsxDetectionHint.DoNotIncludeJsxWithStringValue | core.JsxDetectionHint.DoNotIncludeJsxWithBooleanValue | core.JsxDetectionHint.DoNotIncludeJsxWithUndefinedValue | core.JsxDetectionHint.DoNotIncludeJsxWithEmptyArrayValue;
|
|
@@ -209,7 +188,7 @@ function create$50(context) {
|
|
|
209
188
|
const hooks = hc.api.getAllHooks(node);
|
|
210
189
|
const funcs = [...comps, ...hooks];
|
|
211
190
|
for (const call of useCalls) {
|
|
212
|
-
const stmt =
|
|
191
|
+
const stmt = Traverse.findEnclosingTryBlock(call);
|
|
213
192
|
const func = Traverse.findParent(stmt, (n) => funcs.some((f) => f.node === n));
|
|
214
193
|
if (stmt != null && func != null && !reported.has(stmt)) {
|
|
215
194
|
context.report({
|
|
@@ -222,7 +201,7 @@ function create$50(context) {
|
|
|
222
201
|
for (const { rets } of funcs) for (const ret of rets) {
|
|
223
202
|
if (ret == null) continue;
|
|
224
203
|
if (!core.isJsxLike(context, ret, hint)) continue;
|
|
225
|
-
const stmt =
|
|
204
|
+
const stmt = Traverse.findEnclosingTryBlock(ret);
|
|
226
205
|
if (stmt != null && !reported.has(stmt)) {
|
|
227
206
|
context.report({
|
|
228
207
|
messageId: "tryCatchWithJsx",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.18.
|
|
3
|
+
"version": "5.18.1",
|
|
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",
|
|
@@ -45,21 +45,21 @@
|
|
|
45
45
|
"string-ts": "^2.3.1",
|
|
46
46
|
"ts-api-utils": "^2.5.0",
|
|
47
47
|
"ts-pattern": "^5.9.0",
|
|
48
|
-
"@eslint-react/ast": "5.18.
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/var": "5.18.
|
|
48
|
+
"@eslint-react/ast": "5.18.1",
|
|
49
|
+
"@eslint-react/core": "5.18.1",
|
|
50
|
+
"@eslint-react/jsx": "5.18.1",
|
|
51
|
+
"@eslint-react/shared": "5.18.1",
|
|
52
|
+
"@eslint-react/eslint": "5.18.1",
|
|
53
|
+
"@eslint-react/var": "5.18.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/react": "^19.2.17",
|
|
57
57
|
"@types/react-dom": "^19.2.3",
|
|
58
58
|
"dedent": "^1.7.2",
|
|
59
|
-
"eslint": "^10.
|
|
59
|
+
"eslint": "^10.8.0",
|
|
60
60
|
"react": "^19.2.8",
|
|
61
61
|
"react-dom": "^19.2.8",
|
|
62
|
-
"tsdown": "^0.22.
|
|
62
|
+
"tsdown": "^0.22.14",
|
|
63
63
|
"tsl": "^1.0.30",
|
|
64
64
|
"tsl-dx": "^0.13.3",
|
|
65
65
|
"typescript": "6.0.3",
|