fixtures/legacy-jsx-runtimes/react-14/cjs/react-jsx-dev-runtime.development.js JAVASCRIPT 862 lines View on github.com → Search inside
1/** @license React v0.14.102 * react-jsx-dev-runtime.development.js3 *4 * Copyright (c) Meta Platforms, Inc. and affiliates.5 *6 * This source code is licensed under the MIT license found in the7 * LICENSE file in the root directory of this source tree.8 */910'use strict';1112if (process.env.NODE_ENV !== "production") {13  (function() {14'use strict';1516var React = require('react');1718// ATTENTION19// When adding new symbols to this file,20// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'21// The Symbol used to tag the ReactElement-like types. If there is no native Symbol22// nor polyfill, then a plain number is used for performance.23var REACT_ELEMENT_TYPE = 0xeac7;24var REACT_PORTAL_TYPE = 0xeaca;25exports.Fragment = 0xeacb;26var REACT_STRICT_MODE_TYPE = 0xeacc;27var REACT_PROFILER_TYPE = 0xead2;28var REACT_PROVIDER_TYPE = 0xeacd;29var REACT_CONTEXT_TYPE = 0xeace;30var REACT_FORWARD_REF_TYPE = 0xead0;31var REACT_SUSPENSE_TYPE = 0xead1;32var REACT_SUSPENSE_LIST_TYPE = 0xead8;33var REACT_MEMO_TYPE = 0xead3;34var REACT_LAZY_TYPE = 0xead4;35var REACT_BLOCK_TYPE = 0xead9;36var REACT_SERVER_BLOCK_TYPE = 0xeada;37var REACT_FUNDAMENTAL_TYPE = 0xead5;38var REACT_SCOPE_TYPE = 0xead7;39var REACT_OPAQUE_ID_TYPE = 0xeae0;40var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;41var REACT_OFFSCREEN_TYPE = 0xeae2;42var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;4344if (typeof Symbol === 'function' && Symbol.for) {45  var symbolFor = Symbol.for;46  REACT_ELEMENT_TYPE = symbolFor('react.element');47  REACT_PORTAL_TYPE = symbolFor('react.portal');48  exports.Fragment = symbolFor('react.fragment');49  REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');50  REACT_PROFILER_TYPE = symbolFor('react.profiler');51  REACT_PROVIDER_TYPE = symbolFor('react.provider');52  REACT_CONTEXT_TYPE = symbolFor('react.context');53  REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');54  REACT_SUSPENSE_TYPE = symbolFor('react.suspense');55  REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');56  REACT_MEMO_TYPE = symbolFor('react.memo');57  REACT_LAZY_TYPE = symbolFor('react.lazy');58  REACT_BLOCK_TYPE = symbolFor('react.block');59  REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');60  REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');61  REACT_SCOPE_TYPE = symbolFor('react.scope');62  REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');63  REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');64  REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');65  REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');66}6768var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;69var FAUX_ITERATOR_SYMBOL = '@@iterator';70function getIteratorFn(maybeIterable) {71  if (maybeIterable === null || typeof maybeIterable !== 'object') {72    return null;73  }7475  var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];7677  if (typeof maybeIterator === 'function') {78    return maybeIterator;79  }8081  return null;82}8384function error(format) {85  {86    for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {87      args[_key2 - 1] = arguments[_key2];88    }8990    printWarning('error', format, args);91  }92}9394function printWarning(level, format, args) {95  // When changing this logic, you might want to also96  // update consoleWithStackDev.www.js as well.97  {98    var stack = '';99100101    if (stack !== '') {102      format += '%s';103      args = args.concat([stack]);104    }105106    var argsWithFormat = args.map(function (item) {107      return '' + item;108    }); // Careful: RN currently depends on this prefix109110    argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it111    // breaks IE9: https://github.com/facebook/react/issues/13610112    // eslint-disable-next-line react-internal/no-production-logging113114    Function.prototype.apply.call(console[level], console, argsWithFormat);115  }116}117118// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.119120var enableScopeAPI = false; // Experimental Create Event Handle API.121122function isValidElementType(type) {123  if (typeof type === 'string' || typeof type === 'function') {124    return true;125  } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).126127128  if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {129    return true;130  }131132  if (typeof type === 'object' && type !== null) {133    if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {134      return true;135    }136  }137138  return false;139}140var BEFORE_SLASH_RE = /^(.*)[\\\/]/;141function describeComponentFrame (name, source, ownerName) {142  var sourceInfo = '';143144  if (source) {145    var path = source.fileName;146    var fileName = path.replace(BEFORE_SLASH_RE, '');147148    {149      // In DEV, include code for a common special case:150      // prefer "folder/index.js" instead of just "index.js".151      if (/^index\./.test(fileName)) {152        var match = path.match(BEFORE_SLASH_RE);153154        if (match) {155          var pathBeforeSlash = match[1];156157          if (pathBeforeSlash) {158            var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');159            fileName = folderName + '/' + fileName;160          }161        }162      }163    }164165    sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';166  } else if (ownerName) {167    sourceInfo = ' (created by ' + ownerName + ')';168  }169170  return '\n    in ' + (name || 'Unknown') + sourceInfo;171}172173var Resolved = 1;174function refineResolvedLazyComponent(lazyComponent) {175  return lazyComponent._status === Resolved ? lazyComponent._result : null;176}177178function getWrappedName(outerType, innerType, wrapperName) {179  var functionName = innerType.displayName || innerType.name || '';180  return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);181}182183function getComponentName(type) {184  if (type == null) {185    // Host root, text node or just invalid type.186    return null;187  }188189  {190    if (typeof type.tag === 'number') {191      error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');192    }193  }194195  if (typeof type === 'function') {196    return type.displayName || type.name || null;197  }198199  if (typeof type === 'string') {200    return type;201  }202203  switch (type) {204    case exports.Fragment:205      return 'Fragment';206207    case REACT_PORTAL_TYPE:208      return 'Portal';209210    case REACT_PROFILER_TYPE:211      return "Profiler";212213    case REACT_STRICT_MODE_TYPE:214      return 'StrictMode';215216    case REACT_SUSPENSE_TYPE:217      return 'Suspense';218219    case REACT_SUSPENSE_LIST_TYPE:220      return 'SuspenseList';221  }222223  if (typeof type === 'object') {224    switch (type.$$typeof) {225      case REACT_CONTEXT_TYPE:226        return 'Context.Consumer';227228      case REACT_PROVIDER_TYPE:229        return 'Context.Provider';230231      case REACT_FORWARD_REF_TYPE:232        return getWrappedName(type, type.render, 'ForwardRef');233234      case REACT_MEMO_TYPE:235        return getComponentName(type.type);236237      case REACT_BLOCK_TYPE:238        return getComponentName(type.render);239240      case REACT_LAZY_TYPE:241        {242          var thenable = type;243          var resolvedThenable = refineResolvedLazyComponent(thenable);244245          if (resolvedThenable) {246            return getComponentName(resolvedThenable);247          }248249          break;250        }251    }252  }253254  return null;255}256var loggedTypeFailures = {};257var currentlyValidatingElement = null;258259function setCurrentlyValidatingElement(element) {260  currentlyValidatingElement = element;261}262263function checkPropTypes(typeSpecs, values, location, componentName, element) {264  {265    // $FlowFixMe This is okay but Flow doesn't know it.266    var has = Function.call.bind(Object.prototype.hasOwnProperty);267268    for (var typeSpecName in typeSpecs) {269      if (has(typeSpecs, typeSpecName)) {270        var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to271        // fail the render phase where it didn't fail before. So we log it.272        // After these have been cleaned up, we'll let them throw.273274        try {275          // This is intentionally an invariant that gets caught. It's the same276          // behavior as without this statement except with a better message.277          if (typeof typeSpecs[typeSpecName] !== 'function') {278            var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');279            err.name = 'Invariant Violation';280            throw err;281          }282283          error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');284        } catch (ex) {285          error$1 = ex;286        }287288        if (error$1 && !(error$1 instanceof Error)) {289          setCurrentlyValidatingElement(element);290291          error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);292293          setCurrentlyValidatingElement(null);294        }295296        if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {297          // Only monitor this failure once because there tends to be a lot of the298          // same error.299          loggedTypeFailures[error$1.message] = true;300          setCurrentlyValidatingElement(element);301302          error('Failed %s type: %s', location, error$1.message);303304          setCurrentlyValidatingElement(null);305        }306      }307    }308  }309}310311var ReactCurrentOwner = require('react/lib/ReactCurrentOwner');312var hasOwnProperty = Object.prototype.hasOwnProperty;313var RESERVED_PROPS = {314  key: true,315  ref: true,316  __self: true,317  __source: true318};319var specialPropKeyWarningShown;320var specialPropRefWarningShown;321var didWarnAboutStringRefs;322323{324  didWarnAboutStringRefs = {};325}326327function hasValidRef(config) {328  {329    if (hasOwnProperty.call(config, 'ref')) {330      var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;331332      if (getter && getter.isReactWarning) {333        return false;334      }335    }336  }337338  return config.ref !== undefined;339}340341function hasValidKey(config) {342  {343    if (hasOwnProperty.call(config, 'key')) {344      var getter = Object.getOwnPropertyDescriptor(config, 'key').get;345346      if (getter && getter.isReactWarning) {347        return false;348      }349    }350  }351352  return config.key !== undefined;353}354355function defineKeyPropWarningGetter(props, displayName) {356  {357    var warnAboutAccessingKey = function () {358      if (!specialPropKeyWarningShown) {359        specialPropKeyWarningShown = true;360361        error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);362      }363    };364365    warnAboutAccessingKey.isReactWarning = true;366    Object.defineProperty(props, 'key', {367      get: warnAboutAccessingKey,368      configurable: true369    });370  }371}372373function defineRefPropWarningGetter(props, displayName) {374  {375    var warnAboutAccessingRef = function () {376      if (!specialPropRefWarningShown) {377        specialPropRefWarningShown = true;378379        error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);380      }381    };382383    warnAboutAccessingRef.isReactWarning = true;384    Object.defineProperty(props, 'ref', {385      get: warnAboutAccessingRef,386      configurable: true387    });388  }389}390/**391 * Factory method to create a new React element. This no longer adheres to392 * the class pattern, so do not use new to call it. Also, instanceof check393 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check394 * if something is a React Element.395 *396 * @param {*} type397 * @param {*} props398 * @param {*} key399 * @param {string|object} ref400 * @param {*} owner401 * @param {*} self A *temporary* helper to detect places where `this` is402 * different from the `owner` when React.createElement is called, so that we403 * can warn. We want to get rid of owner and replace string `ref`s with arrow404 * functions, and as long as `this` and owner are the same, there will be no405 * change in behavior.406 * @param {*} source An annotation object (added by a transpiler or otherwise)407 * indicating filename, line number, and/or other information.408 * @internal409 */410411412var ReactElement = function (type, key, ref, self, source, owner, props) {413  var element = {414    // This tag allows us to uniquely identify this as a React Element415    $$typeof: REACT_ELEMENT_TYPE,416    // Built-in properties that belong on the element417    type: type,418    key: key,419    ref: ref,420    props: props,421    // Record the component responsible for creating this element.422    _owner: owner423  };424425  {426    // The validation flag is currently mutative. We put it on427    // an external backing store so that we can freeze the whole object.428    // This can be replaced with a WeakMap once they are implemented in429    // commonly used development environments.430    element._store = {}; // To make comparing ReactElements easier for testing purposes, we make431    // the validation flag non-enumerable (where possible, which should432    // include every environment we run tests in), so the test framework433    // ignores it.434435    Object.defineProperty(element._store, 'validated', {436      configurable: false,437      enumerable: false,438      writable: true,439      value: false440    }); // self and source are DEV only properties.441442    Object.defineProperty(element, '_self', {443      configurable: false,444      enumerable: false,445      writable: false,446      value: self447    }); // Two elements created in two different places should be considered448    // equal for testing purposes and therefore we hide it from enumeration.449450    Object.defineProperty(element, '_source', {451      configurable: false,452      enumerable: false,453      writable: false,454      value: source455    });456457    if (Object.freeze) {458      Object.freeze(element.props);459      Object.freeze(element);460    }461  }462463  return element;464};465/**466 * https://github.com/reactjs/rfcs/pull/107467 * @param {*} type468 * @param {object} props469 * @param {string} key470 */471472function jsxDEV(type, config, maybeKey, source, self) {473  {474    var propName; // Reserved names are extracted475476    var props = {};477    var key = null;478    var ref = null; // Currently, key can be spread in as a prop. This causes a potential479    // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />480    // or <div key="Hi" {...props} /> ). We want to deprecate key spread,481    // but as an intermediary step, we will use jsxDEV for everything except482    // <div {...props} key="Hi" />, because we aren't currently able to tell if483    // key is explicitly declared to be undefined or not.484485    if (maybeKey !== undefined) {486      key = '' + maybeKey;487    }488489    if (hasValidKey(config)) {490      key = '' + config.key;491    }492493    if (hasValidRef(config)) {494      ref = config.ref;495    } // Remaining properties are added to a new props object496497498    for (propName in config) {499      if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {500        props[propName] = config[propName];501      }502    } // Resolve default props503504505    if (type && type.defaultProps) {506      var defaultProps = type.defaultProps;507508      for (propName in defaultProps) {509        if (props[propName] === undefined) {510          props[propName] = defaultProps[propName];511        }512      }513    }514515    if (key || ref) {516      var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;517518      if (key) {519        defineKeyPropWarningGetter(props, displayName);520      }521522      if (ref) {523        defineRefPropWarningGetter(props, displayName);524      }525    }526527    return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);528  }529}530531var ReactCurrentOwner$1 = require('react/lib/ReactCurrentOwner');532533function setCurrentlyValidatingElement$1(element) {534  currentlyValidatingElement = element;535}536537var propTypesMisspellWarningShown;538539{540  propTypesMisspellWarningShown = false;541}542/**543 * Verifies the object is a ReactElement.544 * See https://reactjs.org/docs/react-api.html#isvalidelement545 * @param {?object} object546 * @return {boolean} True if `object` is a ReactElement.547 * @final548 */549550function isValidElement(object) {551  {552    return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;553  }554}555556function getDeclarationErrorAddendum() {557  {558    if (ReactCurrentOwner$1.current) {559      var name = ReactCurrentOwner$1.current.getName();560561      if (name) {562        return '\n\nCheck the render method of `' + name + '`.';563      }564    }565566    return '';567  }568}569570function getSourceInfoErrorAddendum(source) {571  {572    if (source !== undefined) {573      var fileName = source.fileName.replace(/^.*[\\\/]/, '');574      var lineNumber = source.lineNumber;575      return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';576    }577578    return '';579  }580}581/**582 * Warn if there's no key explicitly set on dynamic arrays of children or583 * object keys are not valid. This allows us to keep track of children between584 * updates.585 */586587588var ownerHasKeyUseWarning = {};589590function getCurrentComponentErrorInfo(parentType) {591  {592    var info = getDeclarationErrorAddendum();593594    if (!info) {595      var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;596597      if (parentName) {598        info = "\n\nCheck the top-level render call using <" + parentName + ">.";599      }600    }601602    return info;603  }604}605/**606 * Warn if the element doesn't have an explicit key assigned to it.607 * This element is in an array. The array could grow and shrink or be608 * reordered. All children that haven't already been validated are required to609 * have a "key" property assigned to it. Error statuses are cached so a warning610 * will only be shown once.611 *612 * @internal613 * @param {ReactElement} element Element that requires a key.614 * @param {*} parentType element's parent's type.615 */616617618function validateExplicitKey(element, parentType) {619  {620    if (!element._store || element._store.validated || element.key != null) {621      return;622    }623624    element._store.validated = true;625    var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);626627    if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {628      return;629    }630631    ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a632    // property, it may be the creator of the child that's responsible for633    // assigning it a key.634635    var childOwner = '';636637    if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {638      // Give the component that originally created this child.639      childOwner = " It was passed a child from " + element._owner.getName() + ".";640    }641642    setCurrentlyValidatingElement$1(element);643644    error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);645646    setCurrentlyValidatingElement$1(null);647  }648}649/**650 * Ensure that every element either is passed in a static location, in an651 * array with an explicit keys property defined, or in an object literal652 * with valid key property.653 *654 * @internal655 * @param {ReactNode} node Statically passed child of any type.656 * @param {*} parentType node's parent's type.657 */658659660function validateChildKeys(node, parentType) {661  {662    if (typeof node !== 'object') {663      return;664    }665666    if (Array.isArray(node)) {667      for (var i = 0; i < node.length; i++) {668        var child = node[i];669670        if (isValidElement(child)) {671          validateExplicitKey(child, parentType);672        }673      }674    } else if (isValidElement(node)) {675      // This element was passed in a valid location.676      if (node._store) {677        node._store.validated = true;678      }679    } else if (node) {680      var iteratorFn = getIteratorFn(node);681682      if (typeof iteratorFn === 'function') {683        // Entry iterators used to provide implicit keys,684        // but now we print a separate warning for them later.685        if (iteratorFn !== node.entries) {686          var iterator = iteratorFn.call(node);687          var step;688689          while (!(step = iterator.next()).done) {690            if (isValidElement(step.value)) {691              validateExplicitKey(step.value, parentType);692            }693          }694        }695      }696    }697  }698}699/**700 * Given an element, validate that its props follow the propTypes definition,701 * provided by the type.702 *703 * @param {ReactElement} element704 */705706707function validatePropTypes(element) {708  {709    var type = element.type;710711    if (type === null || type === undefined || typeof type === 'string') {712      return;713    }714715    var propTypes;716717    if (typeof type === 'function') {718      propTypes = type.propTypes;719    } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.720    // Inner props are checked in the reconciler.721    type.$$typeof === REACT_MEMO_TYPE)) {722      propTypes = type.propTypes;723    } else {724      return;725    }726727    if (propTypes) {728      // Intentionally inside to avoid triggering lazy initializers:729      var name = getComponentName(type);730      checkPropTypes(propTypes, element.props, 'prop', name, element);731    } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {732      propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:733734      var _name = getComponentName(type);735736      error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');737    }738739    if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {740      error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');741    }742  }743}744/**745 * Given a fragment, validate that it can only be provided with fragment props746 * @param {ReactElement} fragment747 */748749750function validateFragmentProps(fragment) {751  {752    var keys = Object.keys(fragment.props);753754    for (var i = 0; i < keys.length; i++) {755      var key = keys[i];756757      if (key !== 'children' && key !== 'key') {758        setCurrentlyValidatingElement$1(fragment);759760        error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);761762        setCurrentlyValidatingElement$1(null);763        break;764      }765    }766767    if (fragment.ref !== null) {768      setCurrentlyValidatingElement$1(fragment);769770      error('Invalid attribute `ref` supplied to `React.Fragment`.');771772      setCurrentlyValidatingElement$1(null);773    }774  }775}776777function jsxWithValidation(type, props, key, isStaticChildren, source, self) {778  {779    var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to780    // succeed and there will likely be errors in render.781782    if (!validType) {783      var info = '';784785      if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {786        info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";787      }788789      var sourceInfo = getSourceInfoErrorAddendum(source);790791      if (sourceInfo) {792        info += sourceInfo;793      } else {794        info += getDeclarationErrorAddendum();795      }796797      var typeString;798799      if (type === null) {800        typeString = 'null';801      } else if (Array.isArray(type)) {802        typeString = 'array';803      } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {804        typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";805        info = ' Did you accidentally export a JSX literal instead of a component?';806      } else {807        typeString = typeof type;808      }809810      error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);811    }812813    var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.814    // TODO: Drop this when these are no longer allowed as the type argument.815816    if (element == null) {817      return element;818    } // Skip key warning if the type isn't valid since our key validation logic819    // doesn't expect a non-string/function type and can throw confusing errors.820    // We don't want exception behavior to differ between dev and prod.821    // (Rendering will throw with a helpful message and as soon as the type is822    // fixed, the key warnings will appear.)823824825    if (validType) {826      var children = props.children;827828      if (children !== undefined) {829        if (isStaticChildren) {830          if (Array.isArray(children)) {831            for (var i = 0; i < children.length; i++) {832              validateChildKeys(children[i], type);833            }834835            if (Object.freeze) {836              Object.freeze(children);837            }838          } else {839            error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');840          }841        } else {842          validateChildKeys(children, type);843        }844      }845    }846847    if (type === exports.Fragment) {848      validateFragmentProps(element);849    } else {850      validatePropTypes(element);851    }852853    return element;854  }855} // These two functions exist to still get child warnings in dev856857var jsxDEV$1 =  jsxWithValidation ;858859exports.jsxDEV = jsxDEV$1;860  })();861}

Code quality findings 100

Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (process.env.NODE_ENV !== "production") {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var React = require('react');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_ELEMENT_TYPE = 0xeac7;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_PORTAL_TYPE = 0xeaca;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_STRICT_MODE_TYPE = 0xeacc;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_PROFILER_TYPE = 0xead2;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_PROVIDER_TYPE = 0xeacd;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_CONTEXT_TYPE = 0xeace;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_FORWARD_REF_TYPE = 0xead0;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SUSPENSE_TYPE = 0xead1;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_MEMO_TYPE = 0xead3;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_LAZY_TYPE = 0xead4;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_BLOCK_TYPE = 0xead9;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SERVER_BLOCK_TYPE = 0xeada;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_FUNDAMENTAL_TYPE = 0xead5;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SCOPE_TYPE = 0xead7;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_OPAQUE_ID_TYPE = 0xeae0;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_OFFSCREEN_TYPE = 0xeae2;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof Symbol === 'function' && Symbol.for) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof Symbol === 'function' && Symbol.for) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var symbolFor = Symbol.for;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var FAUX_ITERATOR_SYMBOL = '@@iterator';
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (maybeIterable === null || typeof maybeIterable !== 'object') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (maybeIterable === null || typeof maybeIterable !== 'object') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof maybeIterator === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof maybeIterator === 'function') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
Use let instead of var in loops to avoid scope issues
info correctness var-in-loop
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var stack = '';
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (stack !== '') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var argsWithFormat = args.map(function (item) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var enableScopeAPI = false; // Experimental Create Event Handle API.
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'string' || typeof type === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'string' || typeof type === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'object' && type !== null) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'object' && type !== null) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var sourceInfo = '';
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var path = source.fileName;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var fileName = path.replace(BEFORE_SLASH_RE, '');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var match = path.match(BEFORE_SLASH_RE);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var pathBeforeSlash = match[1];
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var Resolved = 1;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return lazyComponent._status === Resolved ? lazyComponent._result : null;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var functionName = innerType.displayName || innerType.name || '';
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (type == null) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type.tag === 'number') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type.tag === 'number') {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'function') {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'string') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'string') {
Ensure all cases are handled or a default case is present
info correctness switch-without-default
switch (type) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'object') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'object') {
Ensure all cases are handled or a default case is present
info correctness switch-without-default
switch (type.$$typeof) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var thenable = type;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var resolvedThenable = refineResolvedLazyComponent(thenable);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var loggedTypeFailures = {};
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var currentlyValidatingElement = null;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var has = Function.call.bind(Object.prototype.hasOwnProperty);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
for (var typeSpecName in typeSpecs) {
Use let instead of var in loops to avoid scope issues
info correctness var-in-loop
for (var typeSpecName in typeSpecs) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof typeSpecs[typeSpecName] !== 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof typeSpecs[typeSpecName] !== 'function') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var ReactCurrentOwner = require('react/lib/ReactCurrentOwner');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var hasOwnProperty = Object.prototype.hasOwnProperty;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var RESERVED_PROPS = {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var specialPropKeyWarningShown;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var specialPropRefWarningShown;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var didWarnAboutStringRefs;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return config.ref !== undefined;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return config.key !== undefined;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var warnAboutAccessingKey = function () {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var warnAboutAccessingRef = function () {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var ReactElement = function (type, key, ref, self, source, owner, props) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var element = {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var propName; // Reserved names are extracted
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var props = {};
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var key = null;

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.