Merge pull request #4593 from asgerf/js/react-hot

Approved by erik-krogh
This commit is contained in:
CodeQL CI
2020-11-25 12:01:38 +00:00
committed by GitHub
3 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
lgtm,codescanning
* Hot-reloading React component are now recognized. Affects the package `react-hot-loader`.

View File

@@ -742,6 +742,8 @@ private DataFlow::SourceNode higherOrderComponentBuilder() {
or
result = DataFlow::moduleMember("react-redux", "connect").getACall()
or
result = DataFlow::moduleMember(["react-hot-loader", "react-hot-loader/root"], "hot").getACall()
or
result = reactRouterDom().getAPropertyRead("withRouter")
or
exists(FunctionCompositionCall compose |

View File

@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';
import styled from 'styled-components';
import unknownFunction from 'somewhere';
import { hot } from 'react-hot-loader';
import { MyComponent } from './exportedComponent';
@@ -21,4 +22,4 @@ const withConnect = connect(mapStateToProps, mapDispatchToProps);
const ConnectedComponent = compose(withConnect, unknownFunction)(StyledComponent);
export default memo(ConnectedComponent);
export default hot(module)(memo(ConnectedComponent));