<commit_before>import React, { Component } from 'react'
import { connect } from 'react-redux'
import debounce from 'lodash/debounce'
import get from 'lodash/get'

import beautifyJS from 'js-beautify'

import CodeMirror from 'codemirror/lib/codemirror'
import 'codemirror/addon/selection/active-line'
import 'codemirror/addon/edit/closetag'
import 'codemirror/addon/edit/matchtags'
import 'codemirror/addon/fold/foldcode'
import 'codemirror/addon/fold/foldgutter'
import 'codemirror/addon/search/match-highlighter'
import 'codemirror/addon/search/search'
import 'codemirror/addon/search/searchcursor'
import 'codemirror/addon/search/jump-to-line'
import 'codemirror/addon/dialog/dialog'
import 'codemirror/addon/scroll/annotatescrollbar'
import 'codemirror/addon/search/matchesonscrollbar'
import 'codemirror/addon/hint/show-hint'
import 'codemirror/addon/hint/xml-hint'
import 'codemirror/mode/xml/xml'
import 'codemirror/addon/lint/lint'

import 'helpers/codemirror-util-autoformat'

import isOldSyntax from 'helpers/detectOldMJMLSyntax'

import {
  completeAfter,
  completeIfAfterLt,
  completeIfInTag,
} from 'helpers/codemirror-autocomplete-mjml'

import { completeAfterSnippet } from 'helpers/codemirror-autocomplete-snippets'

import { migrateToMJML4 } from 'helpers/mjml'
import foldByLevel from 'helpers/foldByLevel'
import { fsReadFile, fsWriteFile } from 'helpers/fs'
import { setPreview } from 'actions/preview'

import './styles.scss'

function beautify(content) {
  return beautifyJS.html(content, {
    indent_size: 2, // eslint-disable-line camelcase
    wrap_attributes_indent_size: 2, // eslint-disable-line camelcase
    max_preserve_newline: 0, // eslint-disable-line camelcase
    preserve_newlines: false, // eslint-disable-line camelcase
  })
}


@connect(
  state => {
    const { settings, preview } = state
    return {
      mjmlEngine: settings.getIn(['mjml', 'engine'], 'auto'),
      minify: settings.getIn(['mjml', 'minify'], false),
      wrapLines: settings.getIn(['editor', 'wrapLines'], true),
      autoFold: settings.getIn(['editor', 'autoFold']),
      foldLevel: settings.getIn(['editor', 'foldLevel']),
      highlightTag: settings.getIn(['editor', 'highlightTag']),
      lightTheme: settings.getIn(['editor', 'lightTheme'], false),
      errors: get(preview, 'errors', []),
      snippets: settings.get('snippets'),
      useTab: settings.getIn(['editor', 'useTab'], false),
      tabSize: settings.getIn(['editor', 'tabSize'], 2),
      indentSize: settings.getIn(['editor', 'indentSize'], 2),
    }
  },
  {
    setPreview,
  },
)<commit_msg>rm empty line<commit_after>import React, { Component } from 'react'
import { connect } from 'react-redux'
import debounce from 'lodash/debounce'
import get from 'lodash/get'

import beautifyJS from 'js-beautify'

import CodeMirror from 'codemirror/lib/codemirror'
import 'codemirror/addon/selection/active-line'
import 'codemirror/addon/edit/closetag'
import 'codemirror/addon/edit/matchtags'
import 'codemirror/addon/fold/foldcode'
import 'codemirror/addon/fold/foldgutter'
import 'codemirror/addon/search/match-highlighter'
import 'codemirror/addon/search/search'
import 'codemirror/addon/search/searchcursor'
import 'codemirror/addon/search/jump-to-line'
import 'codemirror/addon/dialog/dialog'
import 'codemirror/addon/scroll/annotatescrollbar'
import 'codemirror/addon/search/matchesonscrollbar'
import 'codemirror/addon/hint/show-hint'
import 'codemirror/addon/hint/xml-hint'
import 'codemirror/mode/xml/xml'
import 'codemirror/addon/lint/lint'

import 'helpers/codemirror-util-autoformat'

import isOldSyntax from 'helpers/detectOldMJMLSyntax'

import {
  completeAfter,
  completeIfAfterLt,
  completeIfInTag,
} from 'helpers/codemirror-autocomplete-mjml'

import { completeAfterSnippet } from 'helpers/codemirror-autocomplete-snippets'

import { migrateToMJML4 } from 'helpers/mjml'
import foldByLevel from 'helpers/foldByLevel'
import { fsReadFile, fsWriteFile } from 'helpers/fs'
import { setPreview } from 'actions/preview'

import './styles.scss'

function beautify(content) {
  return beautifyJS.html(content, {
    indent_size: 2, // eslint-disable-line camelcase
    wrap_attributes_indent_size: 2, // eslint-disable-line camelcase
    max_preserve_newline: 0, // eslint-disable-line camelcase
    preserve_newlines: false, // eslint-disable-line camelcase
  })
}

@connect(
  state => {
    const { settings, preview } = state
    return {
      mjmlEngine: settings.getIn(['mjml', 'engine'], 'auto'),
      minify: settings.getIn(['mjml', 'minify'], false),
      wrapLines: settings.getIn(['editor', 'wrapLines'], true),
      autoFold: settings.getIn(['editor', 'autoFold']),
      foldLevel: settings.getIn(['editor', 'foldLevel']),
      highlightTag: settings.getIn(['editor', 'highlightTag']),
      lightTheme: settings.getIn(['editor', 'lightTheme'], false),
      errors: get(preview, 'errors', []),
      snippets: settings.get('snippets'),
      useTab: settings.getIn(['editor', 'useTab'], false),
      tabSize: settings.getIn(['editor', 'tabSize'], 2),
      indentSize: settings.getIn(['editor', 'indentSize'], 2),
    }
  },
  {
    setPreview,
  },
)
{'fraction_non_alphanumeric': 0.1388512860181783, 'fraction_numerical': 0.002320634306710501, 'mean_word_length': 4.95852534562212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '954401', 'n_tokens_mistral': 1802, 'n_tokens_neox': 1759, 'n_words': 326}