<commit_before>import React from 'react';
import PropTypes from 'prop-types';

import SPELLS from './SPELLS';
import SpellIcon from './SpellIcon';

const SpellLink = ({ id, children, category = undefined, icon, iconStyle, ...other }) => {
  if (process.env.NODE_ENV === 'development' && !children && !SPELLS[id]) {
    throw new Error(`Unknown spell: ${id}`);
  }

  return (
    <a href={`http://www.wowhead.com/spell=${id}`} target="_blank" rel="noopener noreferrer" className={category} {...other}>
      {icon && <SpellIcon id={id} noLink style={iconStyle} />}{' '}
      {children || SPELLS[id].name}
    </a>
  );
};
SpellLink.propTypes = {
  id: PropTypes.number.isRequired,
  children: PropTypes.node,
  category: PropTypes.string,
  icon: PropTypes.bool,
  iconStyle: PropTypes.object,
};
SpellLink.defaultProps = {
  icon: true,
};

export default SpellLink;
<commit_msg>Don't crash in production when a spell is unknown<commit_after>import React from 'react';
import PropTypes from 'prop-types';

import SPELLS from './SPELLS';
import SpellIcon from './SpellIcon';

const SpellLink = ({ id, children, category = undefined, icon, iconStyle, ...other }) => {
  if (process.env.NODE_ENV === 'development' && !children && !SPELLS[id]) {
    throw new Error(`Unknown spell: ${id}`);
  }

  return (
    <a href={`http://www.wowhead.com/spell=${id}`} target="_blank" rel="noopener noreferrer" className={category} {...other}>
      {icon && <SpellIcon id={id} noLink style={iconStyle} />}{' '}
      {children || (SPELLS[id] ? SPELLS[id].name : `Unknown spell: ${id}`)}
    </a>
  );
};
SpellLink.propTypes = {
  id: PropTypes.number.isRequired,
  children: PropTypes.node,
  category: PropTypes.string,
  icon: PropTypes.bool,
  iconStyle: PropTypes.object,
};
SpellLink.defaultProps = {
  icon: true,
};

export default SpellLink;

{'fraction_non_alphanumeric': 0.1779107725788901, 'fraction_numerical': 0.0, 'mean_word_length': 4.209631728045326, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1323962', 'n_tokens_mistral': 607, 'n_tokens_neox': 626, 'n_words': 148}