mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
detect uses of jsxFactory and jsxFragmentFactory in js/unused-local-variable
This commit is contained in:
@@ -58,6 +58,16 @@ predicate isReactForJSX(UnusedLocal v) {
|
||||
plugin.getJsxFactoryVariableName() = v.getName()
|
||||
)
|
||||
)
|
||||
or
|
||||
exists(JSONObject tsconfig |
|
||||
tsconfig.isTopLevel() and tsconfig.getFile().getBaseName() = "tsconfig.json"
|
||||
|
|
||||
v.getName() =
|
||||
tsconfig
|
||||
.getPropValue("compilerOptions")
|
||||
.(JSONObject)
|
||||
.getPropStringValue(["jsxFactory", "jsxFragmentFactory"])
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsx": "react",
|
||||
"jsxFactory": "m"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import {m} from 'some-react-library';
|
||||
|
||||
export default function doAThing() {
|
||||
return <span>foo</span>;
|
||||
}
|
||||
Reference in New Issue
Block a user