mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 21:54:56 +00:00
stuff
This commit is contained in:
20
codeql/custom-queries/queries/ComponentCustomHookUsage.ql
Normal file
20
codeql/custom-queries/queries/ComponentCustomHookUsage.ql
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @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()
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @name Components in migration target folders
|
||||
* @description Lists TSX files under src/components/atoms|molecules|organisms (primary migration targets).
|
||||
* @kind problem
|
||||
* @severity warning
|
||||
* @id custom/components-in-migration-target-folders
|
||||
*/
|
||||
import javascript
|
||||
|
||||
predicate isTargetComponentFile(File f) {
|
||||
f.getRelativePath().regexpMatch("^(src/)?components/(atoms|molecules|organisms)/.*\\.tsx$")
|
||||
}
|
||||
|
||||
from File f
|
||||
where isTargetComponentFile(f)
|
||||
select f, "Component file in migration target folder"
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @name Imports of converted JSON components
|
||||
* @description Flags imports of components now in json-components to help update call sites.
|
||||
* @kind problem
|
||||
* @severity warning
|
||||
* @id custom/imports-converted-json-components
|
||||
*/
|
||||
import javascript
|
||||
|
||||
predicate isConvertedType(string name) {
|
||||
name = "NavigationMenu"
|
||||
}
|
||||
|
||||
from ImportDeclaration imp, ImportSpecifier spec, string name
|
||||
where
|
||||
spec = imp.getASpecifier() and
|
||||
name = spec.getImportedName() and
|
||||
isConvertedType(name) and
|
||||
imp.getRawImportPath().regexpMatch("^@/components/")
|
||||
select imp, "Import converted to JSON: " + name
|
||||
12
codeql/custom-queries/queries/ImportsJsonDefinitions.ql
Normal file
12
codeql/custom-queries/queries/ImportsJsonDefinitions.ql
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @name Direct JSON definition imports
|
||||
* @description Flags imports from '@/components/json-definitions' to enforce centralized exports.
|
||||
* @kind problem
|
||||
* @severity warning
|
||||
* @id custom/imports-json-definitions
|
||||
*/
|
||||
import javascript
|
||||
|
||||
from ImportDeclaration imp
|
||||
where imp.getRawImportPath().regexpMatch("^@/components/json-definitions/")
|
||||
select imp, "Direct JSON definition import: " + imp.getRawImportPath()
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @name Legacy component barrel imports
|
||||
* @description Flags imports from '@/components/atoms', '@/components/molecules', '@/components/organisms', or '@/components/ui'.
|
||||
* @kind problem
|
||||
* @severity warning
|
||||
* @id custom/legacy-component-barrel-imports
|
||||
*/
|
||||
import javascript
|
||||
|
||||
from ImportDeclaration imp
|
||||
where imp.getRawImportPath().regexpMatch("^@/components/(atoms|molecules|organisms|ui)(/.*)?$")
|
||||
select imp, "Legacy component barrel import: " + imp.getRawImportPath()
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @name Legacy imports in migration targets
|
||||
* @description Flags imports from '@/components/*' inside atoms/molecules/organisms.
|
||||
* @kind problem
|
||||
* @severity warning
|
||||
* @id custom/legacy-imports-in-migration-targets
|
||||
*/
|
||||
import javascript
|
||||
|
||||
predicate isTargetComponentFile(File f) {
|
||||
f.getRelativePath().regexpMatch("^(src/)?components/(atoms|molecules|organisms)/.*\\.tsx$")
|
||||
}
|
||||
|
||||
from ImportDeclaration imp, File f
|
||||
where
|
||||
f = imp.getFile() and
|
||||
isTargetComponentFile(f) and
|
||||
imp.getRawImportPath().regexpMatch("^@/components/")
|
||||
select imp, "Legacy import in migration target: " + imp.getRawImportPath()
|
||||
Reference in New Issue
Block a user