| 214 | }; |
| 215 | |
| 216 | const hasNoRefsToAPIsThatWillBeRemoved = classPath => { |
| 217 | const hasInvalidCalls = ( |
| 218 | j(classPath).find(j.MemberExpression, { |
| 219 | object: {type: 'ThisExpression'}, |
| 220 | property: {name: DEFAULT_PROPS_FIELD}, |
| 221 | }).size() > 0 || |
| 222 | j(classPath).find(j.MemberExpression, { |
| 223 | object: {type: 'ThisExpression'}, |
| 224 | property: {name: GET_INITIAL_STATE_FIELD}, |
| 225 | }).size() > 0 |
| 226 | ); |
| 227 | |
| 228 | if (hasInvalidCalls) { |
| 229 | console.warn( |
| 230 | file.path + ': `' + ReactUtils.directlyGetComponentName(classPath) + '` ' + |
| 231 | 'was skipped because of API calls that will be removed. Remove calls to `' + |
| 232 | DEFAULT_PROPS_FIELD + '` and/or `' + GET_INITIAL_STATE_FIELD + |
| 233 | '` in your React component and re-run this script.' |
| 234 | ); |
| 235 | return false; |
| 236 | } |
| 237 | return true; |
| 238 | }; |
| 239 | |
| 240 | const doesNotUseArguments = classPath => { |
| 241 | const hasArguments = ( |