<commit_before>import moment from 'moment'

// Validation highlighting for react-bootstrap Input component
export function validationState(field) {
  if (!field || !field.touched || field.active) return null
  return field.error ? 'error' : 'success'
}

// Validation highlighting for other input component
export function validationStyle(field) {
  if (!field || !field.touched || field.active) return null
  return field.error ? 'has-error' : 'has-success'
}

// Vadliation help text for react-bootstrap Input component
export function validationHelp(field) {
  if (!field) return null
  return (field.touched && !field.active && field.error) || null
}

export function validDate(current) {
  const yesterday = moment().subtract(1, 'day')
  return current.isAfter(yesterday)
}

export function allFieldsRequiredFn(fieldNames) {
  return data => {
    const errors = {}
    fieldNames.forEach(fieldName => {
      if (!data[fieldName]) errors[fieldName] = 'This field is required'
    })
    return errors
  }
}<commit_msg>Only show success validation for dirty fields<commit_after>import moment from 'moment'

// Validation highlighting for react-bootstrap Input components
export function validationState(field) {
  console.log('validationState field', field)
  if (!field || !field.touched || field.active) return null
  if (field.error) return 'error'
  if (field.dirty) return 'success'
}

// Validation highlighting for other input components
export function validationStyle(field) {
  console.log('validationStyle field', field)
  if (!field || !field.touched || field.active) return null
  if (field.error) return 'has-error'
  if (field.dirty) return 'has-success'
}

// Validation help text for react-bootstrap Input components
export function validationHelp(field) {
  if (!field) return null
  return (field.touched && !field.active && field.error) || null
}

export function validDate(current) {
  const yesterday = moment().subtract(1, 'day')
  return current.isAfter(yesterday)
}

export function allFieldsRequiredFn(fieldNames) {
  return data => {
    const errors = {}
    fieldNames.forEach(fieldName => {
      if (!data[fieldName]) errors[fieldName] = 'This field is required'
    })
    return errors
  }
}
{'fraction_non_alphanumeric': 0.11574697173620457, 'fraction_numerical': 0.0008972633467922835, 'mean_word_length': 4.479115479115479, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4580290', 'n_tokens_mistral': 635, 'n_tokens_neox': 618, 'n_words': 194}