<commit_before>'use strict';
const through = require('through2'),
  PluginError = require('plugin-error'),
  prettier = require('prettier'),
  merge = require('merge'),
  applySourceMap = require('vinyl-sourcemaps-apply');

module.exports = function(opt) {
  function transform(file, encoding, callback) {
    if (file.isNull())
      return callback(null, file);
    if (file.isStream())
      return callback(new PluginError(
        'gulp-prettier',
        'Streaming not supported'
      ));

    let data;
    let str = file.contents.toString('utf8');

    options = merge(
      {
        // Fit code within this line limit
        printWidth: 80,
        // Number of spaces it should use per tab
        tabWidth: 2,
        // Use tabs instead of spaces
        useTabs: false,
        // Remove semicolons
        semi: true,
        // If true, will use single instead of double quotes
        singleQuote: false,
        // Controls the printing of trailing commas wherever possible
        trailingComma: "none",
        // Controls the printing of spaces inside array and objects
        bracketSpacing: true,
        // Put JSX angle brackets on a new line rather than the last line of attributes
        jsxBracketSameLine: false,
      },
      opt
    );

    try {
      data = prettier.format(str, options);
    } catch (err) {
      console.log('there was a fucking error b!!');
      return callback(new PluginError('gulp-prettier', err));
    }

    if (data && data.v3SourceMap && file.sourceMap) {
      applySourceMap(file, data.v3SourceMap);
      if (file.contents.toString() !== data.js) file.isPrettier = true;
      file.contents = new Buffer(data.js);
    } else {
      if (file.contents.toString() !== data) file.isPrettier = true;
      file.contents = new Buffer(data);
    }

    callback(null, file);
  }

  return through.obj(transform);
};<commit_msg>refactor: remove unneeded console statement (#10)<commit_after>'use strict';
const through = require('through2'),
  PluginError = require('plugin-error'),
  prettier = require('prettier'),
  merge = require('merge'),
  applySourceMap = require('vinyl-sourcemaps-apply');

module.exports = function(opt) {
  function transform(file, encoding, callback) {
    if (file.isNull())
      return callback(null, file);
    if (file.isStream())
      return callback(new PluginError(
        'gulp-prettier',
        'Streaming not supported'
      ));

    let data;
    let str = file.contents.toString('utf8');

    options = merge(
      {
        // Fit code within this line limit
        printWidth: 80,
        // Number of spaces it should use per tab
        tabWidth: 2,
        // Use tabs instead of spaces
        useTabs: false,
        // Remove semicolons
        semi: true,
        // If true, will use single instead of double quotes
        singleQuote: false,
        // Controls the printing of trailing commas wherever possible
        trailingComma: "none",
        // Controls the printing of spaces inside array and objects
        bracketSpacing: true,
        // Put JSX angle brackets on a new line rather than the last line of attributes
        jsxBracketSameLine: false,
      },
      opt
    );

    try {
      data = prettier.format(str, options);
    } catch (err) {
      return callback(new PluginError('gulp-prettier', err));
    }

    if (data && data.v3SourceMap && file.sourceMap) {
      applySourceMap(file, data.v3SourceMap);
      if (file.contents.toString() !== data.js) file.isPrettier = true;
      file.contents = new Buffer(data.js);
    } else {
      if (file.contents.toString() !== data) file.isPrettier = true;
      file.contents = new Buffer(data);
    }

    callback(null, file);
  }

  return through.obj(transform);
};
{'fraction_non_alphanumeric': 0.11464968152866242, 'fraction_numerical': 0.004246284501061571, 'mean_word_length': 2.480147737765466, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2687375', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1055, 'n_words': 323}