We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39c204a commit 472b41fCopy full SHA for 472b41f
javascript/ql/src/semmle/javascript/frameworks/React.qll
@@ -248,7 +248,11 @@ abstract class ReactComponent extends ASTNode {
248
* Holds if `f` always returns a JSX element or fragment, or a React element.
249
*/
250
private predicate alwaysReturnsJSXOrReactElements(Function f) {
251
- forex(Expr e | e.flow().(DataFlow::SourceNode).flowsToExpr(f.getAReturnedExpr()) |
+ forex(Expr e |
252
+ e.flow().(DataFlow::SourceNode).flowsToExpr(f.getAReturnedExpr()) and
253
+ // Allow returning string constants in addition to JSX/React elemnts.
254
+ not exists(e.getStringValue())
255
+ |
256
e instanceof JSXNode or
257
e instanceof ReactElementDefinition
258
)
0 commit comments