MCPcopy Index your code
hub / github.com/reactjs/react-codemod / hasNoRefsToAPIsThatWillBeRemoved

Function hasNoRefsToAPIsThatWillBeRemoved

transforms/class.js:216–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 = (

Callers 1

class.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected