oxlint-plugin-react-doctor 0.5.0-dev.4aba728 → 0.5.0-dev.77a70ab
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 +0 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -432,7 +432,6 @@ const SETTER_PATTERN = /^set[A-Z]/;
|
|
|
432
432
|
const RENDER_FUNCTION_PATTERN = /^render[A-Z]/;
|
|
433
433
|
const UPPERCASE_PATTERN = /^[A-Z]/;
|
|
434
434
|
const REACT_HANDLER_PROP_PATTERN = /^on[A-Z]/;
|
|
435
|
-
const HANDLER_FUNCTION_NAME_PATTERN = /^(?:on|handle)[A-Z]/;
|
|
436
435
|
const EFFECT_HOOK_NAMES$1 = new Set(["useEffect", "useLayoutEffect"]);
|
|
437
436
|
const HOOKS_WITH_DEPS = new Set([
|
|
438
437
|
"useEffect",
|
|
@@ -34357,9 +34356,6 @@ const tanstackStartNoNavigateInRender = defineRule({
|
|
|
34357
34356
|
let eventHandlerDepth = 0;
|
|
34358
34357
|
const isDeferredHookCall = (node) => isHookCall$1(node, EFFECT_HOOK_NAMES$1) || isHookCall$1(node, "useCallback") || isHookCall$1(node, "useMemo");
|
|
34359
34358
|
const isEventHandlerAttribute = (node) => isNodeOfType(node, "JSXAttribute") && isNodeOfType(node.name, "JSXIdentifier") && typeof node.name.name === "string" && node.name.name.startsWith("on") && UPPERCASE_PATTERN.test(node.name.name.charAt(2));
|
|
34360
|
-
const isEventHandlerProperty = (node) => isNodeOfType(node, "Property") && isFunctionLike$2(node.value) && (isNodeOfType(node.key, "Identifier") && typeof node.key.name === "string" && REACT_HANDLER_PROP_PATTERN.test(node.key.name) || isNodeOfType(node.key, "Literal") && typeof node.key.value === "string" && REACT_HANDLER_PROP_PATTERN.test(node.key.value));
|
|
34361
|
-
const isHandlerNamedVariableDeclarator = (node) => isNodeOfType(node, "VariableDeclarator") && isNodeOfType(node.id, "Identifier") && typeof node.id.name === "string" && HANDLER_FUNCTION_NAME_PATTERN.test(node.id.name) && isFunctionLike$2(node.init);
|
|
34362
|
-
const isHandlerNamedFunctionDeclaration = (node) => isNodeOfType(node, "FunctionDeclaration") && isNodeOfType(node.id, "Identifier") && typeof node.id.name === "string" && HANDLER_FUNCTION_NAME_PATTERN.test(node.id.name);
|
|
34363
34359
|
return {
|
|
34364
34360
|
CallExpression(node) {
|
|
34365
34361
|
const filename = normalizeFilename$1(context.filename ?? "");
|
|
@@ -34385,36 +34381,6 @@ const tanstackStartNoNavigateInRender = defineRule({
|
|
|
34385
34381
|
const filename = normalizeFilename$1(context.filename ?? "");
|
|
34386
34382
|
if (!TANSTACK_ROUTE_FILE_PATTERN.test(filename)) return;
|
|
34387
34383
|
if (isEventHandlerAttribute(node)) eventHandlerDepth = Math.max(0, eventHandlerDepth - 1);
|
|
34388
|
-
},
|
|
34389
|
-
Property(node) {
|
|
34390
|
-
const filename = normalizeFilename$1(context.filename ?? "");
|
|
34391
|
-
if (!TANSTACK_ROUTE_FILE_PATTERN.test(filename)) return;
|
|
34392
|
-
if (isEventHandlerProperty(node)) eventHandlerDepth++;
|
|
34393
|
-
},
|
|
34394
|
-
"Property:exit"(node) {
|
|
34395
|
-
const filename = normalizeFilename$1(context.filename ?? "");
|
|
34396
|
-
if (!TANSTACK_ROUTE_FILE_PATTERN.test(filename)) return;
|
|
34397
|
-
if (isEventHandlerProperty(node)) eventHandlerDepth = Math.max(0, eventHandlerDepth - 1);
|
|
34398
|
-
},
|
|
34399
|
-
VariableDeclarator(node) {
|
|
34400
|
-
const filename = normalizeFilename$1(context.filename ?? "");
|
|
34401
|
-
if (!TANSTACK_ROUTE_FILE_PATTERN.test(filename)) return;
|
|
34402
|
-
if (isHandlerNamedVariableDeclarator(node)) eventHandlerDepth++;
|
|
34403
|
-
},
|
|
34404
|
-
"VariableDeclarator:exit"(node) {
|
|
34405
|
-
const filename = normalizeFilename$1(context.filename ?? "");
|
|
34406
|
-
if (!TANSTACK_ROUTE_FILE_PATTERN.test(filename)) return;
|
|
34407
|
-
if (isHandlerNamedVariableDeclarator(node)) eventHandlerDepth = Math.max(0, eventHandlerDepth - 1);
|
|
34408
|
-
},
|
|
34409
|
-
FunctionDeclaration(node) {
|
|
34410
|
-
const filename = normalizeFilename$1(context.filename ?? "");
|
|
34411
|
-
if (!TANSTACK_ROUTE_FILE_PATTERN.test(filename)) return;
|
|
34412
|
-
if (isHandlerNamedFunctionDeclaration(node)) eventHandlerDepth++;
|
|
34413
|
-
},
|
|
34414
|
-
"FunctionDeclaration:exit"(node) {
|
|
34415
|
-
const filename = normalizeFilename$1(context.filename ?? "");
|
|
34416
|
-
if (!TANSTACK_ROUTE_FILE_PATTERN.test(filename)) return;
|
|
34417
|
-
if (isHandlerNamedFunctionDeclaration(node)) eventHandlerDepth = Math.max(0, eventHandlerDepth - 1);
|
|
34418
34384
|
}
|
|
34419
34385
|
};
|
|
34420
34386
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxlint-plugin-react-doctor",
|
|
3
|
-
"version": "0.5.0-dev.
|
|
3
|
+
"version": "0.5.0-dev.77a70ab",
|
|
4
4
|
"description": "oxlint plugin for React Doctor: diagnose React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|