This commit is contained in:
2026-01-19 09:34:42 +00:00
parent 0210cb4d39
commit dae3f9fea5
28 changed files with 1575 additions and 2 deletions

View 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()

View File

@@ -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"

View File

@@ -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

View 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()

View File

@@ -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()

View File

@@ -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()