<commit_before>import React, { PropTypes, createElement } from 'react'
import { Field } from 'redux-form'
import { injectIntl, intlShape, FormattedMessage } from 'react-intl'

class FormInputField extends React.Component {
  constructor (props) {
    super(props)
    this.renderField = this.renderField.bind(this)
  }

  render () {
    return (
      <Field name={this.props.name} type={this.props.type ? this.props.type : 'text'} component={this.renderField} />
    )
  }

  renderField (field) {
    const formattedHeaderMessage = <FormattedMessage {...this.props.message} />
    const header = this.props.headerType ? createElement(this.props.headerType, {}, formattedHeaderMessage) : null
    return (
      <div className={`form-item ${field.meta.error ? 'error' : null}`}>
        {header}
        {!this.props.excludeLabel && !this.props.isLabelUnderInput
          ? <label htmlFor={field.name}><FormattedMessage {...this.props.message} /></label> : null}
        <input placeholder={this.props.placeholder ? this.props.intl.formatMessage(this.props.placeholder) : null}
               data-automation-id={`${this.props.formName}_${field.name}`} {...field.input}
               type={field.type}
               name={field.name}
               id={field.name}
               className=""
        />
        {!this.props.excludeLabel && this.props.isLabelUnderInput
          ? <label htmlFor={field.name}><FormattedMessage {...this.props.message} /></label> : null}
        { this.props.getValidator ? this.props.getValidator(field) : null}
      </div>
    )
  }
}

FormInputField.propTypes = {
  name: PropTypes.string.isRequired,
  type: PropTypes.string,
  message: PropTypes.object.isRequired,
  getValidator: PropTypes.func,
  intl: intlShape.isRequired,
  isLabelUnderInput: PropTypes.bool,
  excludeLabel: PropTypes.bool,
  headerType: PropTypes.string,
  formName: PropTypes.string.isRequired,
  placeholder: PropTypes.object
}
<commit_msg>fix for input fields initializing with error class<commit_after>import React, { PropTypes, createElement } from 'react'
import { Field } from 'redux-form'
import { injectIntl, intlShape, FormattedMessage } from 'react-intl'

class FormInputField extends React.Component {
  constructor (props) {
    super(props)
    this.renderField = this.renderField.bind(this)
  }

  render () {
    return (
      <Field name={this.props.name} type={this.props.type ? this.props.type : 'text'} component={this.renderField} />
    )
  }

  renderField (field) {
    const formattedHeaderMessage = <FormattedMessage {...this.props.message} />
    const header = this.props.headerType ? createElement(this.props.headerType, {}, formattedHeaderMessage) : null
    return (
      <div className={`form-item ${field.meta.error && field.meta.touched ? 'error' : ''}`}>
        {header}
        {!this.props.excludeLabel && !this.props.isLabelUnderInput
          ? <label htmlFor={field.name}><FormattedMessage {...this.props.message} /></label> : null}
        <input placeholder={this.props.placeholder ? this.props.intl.formatMessage(this.props.placeholder) : null}
               data-automation-id={`${this.props.formName}_${field.name}`} {...field.input}
               type={field.type}
               name={field.name}
               id={field.name}
               className=""
        />
        {!this.props.excludeLabel && this.props.isLabelUnderInput
          ? <label htmlFor={field.name}><FormattedMessage {...this.props.message} /></label> : null}
        { this.props.getValidator ? this.props.getValidator(field) : null}
      </div>
    )
  }
}

FormInputField.propTypes = {
  name: PropTypes.string.isRequired,
  type: PropTypes.string,
  message: PropTypes.object.isRequired,
  getValidator: PropTypes.func,
  intl: intlShape.isRequired,
  isLabelUnderInput: PropTypes.bool,
  excludeLabel: PropTypes.bool,
  headerType: PropTypes.string,
  formName: PropTypes.string.isRequired,
  placeholder: PropTypes.object
}

{'fraction_non_alphanumeric': 0.14138364779874213, 'fraction_numerical': 0.0, 'mean_word_length': 3.211864406779661, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '4262823', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1195, 'n_words': 209}