mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-25 06:04:54 +00:00
21 lines
574 B
Plaintext
21 lines
574 B
Plaintext
/**
|
|
* @name Custom hook usage in components
|
|
* @description Flags calls to hooks (useX) inside src/components files to guide hook extraction.
|
|
* @kind problem
|
|
* @severity warning
|
|
* @id custom/component-custom-hook-usage
|
|
*/
|
|
import javascript
|
|
|
|
predicate isComponentFile(File f) {
|
|
f.getRelativePath().regexpMatch("^(src/)?components/.*\\.tsx$")
|
|
}
|
|
|
|
from CallExpr call, File f, VarRef ref
|
|
where
|
|
f = call.getFile() and
|
|
isComponentFile(f) and
|
|
ref = call.getCallee() and
|
|
ref.getName().regexpMatch("^use[A-Z].*")
|
|
select call, "Hook call in component: " + ref.getName()
|