File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
src/semmle/javascript/frameworks
test/library-tests/frameworks/ReactJS Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,9 @@ abstract class ReactComponent extends ASTNode {
182182 )
183183 or
184184 result .flowsToExpr ( getStaticMethod ( "getDerivedStateFromProps" ) .getAReturnedExpr ( ) )
185+ or
186+ // shouldComponentUpdate: (nextProps, nextState)
187+ result = DataFlow:: parameterNode ( getInstanceMethod ( "shouldComponentUpdate" ) .getParameter ( 1 ) )
185188 }
186189
187190 /**
@@ -216,6 +219,9 @@ abstract class ReactComponent extends ASTNode {
216219 result .flowsTo ( getComponentCreatorSource ( ) .getAnInvocation ( ) .getArgument ( 0 ) )
217220 or
218221 result = getADefaultPropsSource ( )
222+ or
223+ // shouldComponentUpdate: (nextProps, nextState)
224+ result = DataFlow:: parameterNode ( getInstanceMethod ( "shouldComponentUpdate" ) .getParameter ( 0 ) )
219225 }
220226
221227 /**
Original file line number Diff line number Diff line change 11| es6.js:14:1:20:1 | class H ... }\\n} | es6.js:18:22:18:31 | { baz: 42} |
22| rare-lifecycle-methods.js:1:1:11:1 | class C ... }\\n} | rare-lifecycle-methods.js:3:16:3:17 | {} |
3+ | rare-lifecycle-methods.js:1:1:11:1 | class C ... }\\n} | rare-lifecycle-methods.js:5:38:5:46 | nextState |
34| statePropertyReads.js:1:1:13:1 | class R ... }\\n} | statePropertyReads.js:7:45:7:56 | prevState.p3 |
45| statePropertyWrites.js:1:1:34:1 | class W ... };\\n} | statePropertyWrites.js:8:18:8:19 | {} |
56| statePropertyWrites.js:1:1:34:1 | class W ... };\\n} | statePropertyWrites.js:12:18:12:19 | {} |
You can’t perform that action at this time.
0 commit comments