Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0753c8a + 99213b9 commit 4e116baCopy full SHA for 4e116ba
3 files changed
javascript/ql/src/Declarations/UnusedVariable.ql
@@ -58,6 +58,16 @@ predicate isReactForJSX(UnusedLocal v) {
58
plugin.getJsxFactoryVariableName() = v.getName()
59
)
60
61
+ or
62
+ exists(JSONObject tsconfig |
63
+ tsconfig.isTopLevel() and tsconfig.getFile().getBaseName() = "tsconfig.json"
64
+ |
65
+ v.getName() =
66
+ tsconfig
67
+ .getPropValue("compilerOptions")
68
+ .(JSONObject)
69
+ .getPropStringValue(["jsxFactory", "jsxFragmentFactory"])
70
+ )
71
72
}
73
javascript/ql/test/query-tests/Declarations/UnusedVariable/ts/tsconfig.json
@@ -0,0 +1,6 @@
1
+{
2
+ "compilerOptions": {
3
+ "jsx": "react",
4
+ "jsxFactory": "m"
5
+ }
6
+}
javascript/ql/test/query-tests/Declarations/UnusedVariable/ts/usesreact.tsx
@@ -0,0 +1,5 @@
+import {m} from 'some-react-library';
+
+export default function doAThing() {
+ return <span>foo</span>;
0 commit comments