Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit d3d971c

Browse files
Archmongerrmorshea
authored andcommitted
Remove reliance on CamelCase component names
1 parent a229cd3 commit d3d971c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

flake8_idom_hooks/utils.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ def is_hook_def(node: ast.FunctionDef) -> bool:
2828

2929

3030
def is_component_def(node: ast.FunctionDef) -> bool:
31-
return is_component_function_name(node.name)
32-
33-
34-
def is_component_function_name(name: str) -> bool:
35-
return name[0].upper() == name[0] and "_" not in name
31+
return any(decorator.value.id == "idom" for decorator in node.decorator_list)
3632

3733

3834
def is_hook_function_name(name: str) -> bool:
39-
return name.lstrip("_").startswith("use_")
35+
return name.lstrip("_") in {
36+
"use_state",
37+
"use_effect",
38+
"use_memo",
39+
"use_reducer",
40+
"use_callback",
41+
"use_ref",
42+
}

0 commit comments

Comments
 (0)