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

const stylesheet = {
  propStyle: {},
  propNameStyle: {},
  propValueStyle: {},
};

export default function Props(props) {
  const { maxPropsIntoLine, maxPropArrayLength, maxPropObjectKeys, maxPropStringLength } = props;
  const nodeProps = props.node.props;
  const defaultProps = props.node.type.defaultProps;
  if (!nodeProps || typeof nodeProps !== 'object') {
    return <span />;
  }

  const { propValueStyle, propNameStyle } = stylesheet;

  const names = Object.keys(nodeProps).filter(
    name =>
      name[0] !== '_' &&
      name !== 'children' &&
      (!defaultProps || nodeProps[name] !== defaultProps[name])
  );

  const breakIntoNewLines = names.length > maxPropsIntoLine;
  const endingSpace = props.singleLine ? ' ' : '';

  const items = [];
  names.forEach((name, i) => {
    items.push(
      <span key={name}>
        {breakIntoNewLines ? <span><br />&nbsp;&nbsp;</span> : ' '}
        <span style={propNameStyle}>{name}</span>
        {/* Use implicit true: */}
        {(!nodeProps[name] || typeof nodeProps[name] !== 'boolean') &&
          <span>
            =
            <span style={propValueStyle}>
              <PropVal
                val={nodeProps[name]}
                maxPropObjectKeys={maxPropObjectKeys}
                maxPropArrayLength={maxPropArrayLength}
                maxPropStringLength={maxPropStringLength}
              />
            </span>
          </span>}

        {i === names.length - 1 && (breakIntoNewLines ? <br /> : endingSpace)}
      </span>
    );
  });

  return <span>{items}</span>;
}

Props.defaultProps = {
  singleLine: false,
};

Props.propTypes = {
  node: PropTypes.shape({
    props: PropTypes.object,
    type: PropTypes.object.isRequired,
  }).isRequired,
  singleLine: PropTypes.bool,
  maxPropsIntoLine: PropTypes.number.isRequired,
  maxPropObjectKeys: PropTypes.number.isRequired,
  maxPropArrayLength: PropTypes.number.isRequired,
  maxPropStringLength: PropTypes.number.isRequired,
};
<commit_msg>prop-fix: Use correct type.<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import PropVal from './PropVal';

const stylesheet = {
  propStyle: {},
  propNameStyle: {},
  propValueStyle: {},
};

export default function Props(props) {
  const { maxPropsIntoLine, maxPropArrayLength, maxPropObjectKeys, maxPropStringLength } = props;
  const nodeProps = props.node.props;
  const defaultProps = props.node.type.defaultProps;
  if (!nodeProps || typeof nodeProps !== 'object') {
    return <span />;
  }

  const { propValueStyle, propNameStyle } = stylesheet;

  const names = Object.keys(nodeProps).filter(
    name =>
      name[0] !== '_' &&
      name !== 'children' &&
      (!defaultProps || nodeProps[name] !== defaultProps[name])
  );

  const breakIntoNewLines = names.length > maxPropsIntoLine;
  const endingSpace = props.singleLine ? ' ' : '';

  const items = [];
  names.forEach((name, i) => {
    items.push(
      <span key={name}>
        {breakIntoNewLines ? <span><br />&nbsp;&nbsp;</span> : ' '}
        <span style={propNameStyle}>{name}</span>
        {/* Use implicit true: */}
        {(!nodeProps[name] || typeof nodeProps[name] !== 'boolean') &&
          <span>
            =
            <span style={propValueStyle}>
              <PropVal
                val={nodeProps[name]}
                maxPropObjectKeys={maxPropObjectKeys}
                maxPropArrayLength={maxPropArrayLength}
                maxPropStringLength={maxPropStringLength}
              />
            </span>
          </span>}

        {i === names.length - 1 && (breakIntoNewLines ? <br /> : endingSpace)}
      </span>
    );
  });

  return <span>{items}</span>;
}

Props.defaultProps = {
  singleLine: false,
};

Props.propTypes = {
  node: PropTypes.shape({
    props: PropTypes.object,
    type: PropTypes.node.isRequired,
  }).isRequired,
  singleLine: PropTypes.bool,
  maxPropsIntoLine: PropTypes.number.isRequired,
  maxPropObjectKeys: PropTypes.number.isRequired,
  maxPropArrayLength: PropTypes.number.isRequired,
  maxPropStringLength: PropTypes.number.isRequired,
};

{'fraction_non_alphanumeric': 0.14519961977186313, 'fraction_numerical': 0.0009505703422053232, 'mean_word_length': 2.9189944134078214, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5431367', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1248, 'n_words': 243}