<commit_before>require "language/node"

class Eslint < Formula
  desc "AST-based pattern checker for JavaScript"
  homepage "https://eslint.org"
  url "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz"
  sha256 "9ae7c52b2974a0bcc8c969f7ed9444058afd0352fd3c6f7772fae9fac50bf6c5"

  bottle do
    cellar :any_skip_relocation
    sha256 "bea5fe7b378bb1be382ddaab09234a82cc5321cb19a078d476fd62e63e17ba4f" => :mojave
    sha256 "a8fa91afbc63e27f0687e0a7dae5ada8b02d1eef03a32752fc4f7f458e9a0951" => :high_sierra
    sha256 "c2e4c24651b34fa120287ddff0682e6c4f1d6d0e64afaf694e40f1160503f6b0" => :sierra
    sha256 "dd3a4d89d1dfe385a4c553e88e928ed4013c6e54f1f73cd034e206605955bf45" => :el_capitan
  end

  depends_on "node"

  def install
    system "npm", "install", *Language::Node.std_npm_install_args(libexec)
    bin.install_symlink Dir["#{libexec}/bin/*"]
  end

  test do
    (testpath/".eslintrc.json").write("{}") # minimal config
    (testpath/"syntax-error.js").write("{}}")
    # https://eslint.org/docs/user-guide/command-line-interface#exit-codes
    output = shell_output("#{bin}/eslint syntax-error.js", 1)<commit_msg>eslint 5.5.0<commit_after>require "language/node"

class Eslint < Formula
  desc "AST-based pattern checker for JavaScript"
  homepage "https://eslint.org"
  url "https://registry.npmjs.org/eslint/-/eslint-5.5.0.tgz"
  sha256 "5e05603dd9bb660649649329ee7666f749e943ca30b8121ab2660c4654f5aabf"

  bottle do
    cellar :any_skip_relocation
    sha256 "bea5fe7b378bb1be382ddaab09234a82cc5321cb19a078d476fd62e63e17ba4f" => :mojave
    sha256 "a8fa91afbc63e27f0687e0a7dae5ada8b02d1eef03a32752fc4f7f458e9a0951" => :high_sierra
    sha256 "c2e4c24651b34fa120287ddff0682e6c4f1d6d0e64afaf694e40f1160503f6b0" => :sierra
    sha256 "dd3a4d89d1dfe385a4c553e88e928ed4013c6e54f1f73cd034e206605955bf45" => :el_capitan
  end

  depends_on "node"

  def install
    system "npm", "install", *Language::Node.std_npm_install_args(libexec)
    bin.install_symlink Dir["#{libexec}/bin/*"]
  end

  test do
    (testpath/".eslintrc.json").write("{}") # minimal config
    (testpath/"syntax-error.js").write("{}}")
    # https://eslint.org/docs/user-guide/command-line-interface#exit-codes
    output = shell_output("#{bin}/eslint syntax-error.js", 1)
{'fraction_non_alphanumeric': 0.11962782454585734, 'fraction_numerical': 0.18741692512184316, 'mean_word_length': 5.4147727272727275, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 6, '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': '7173933', 'n_tokens_mistral': 1199, 'n_tokens_neox': 979, 'n_words': 112}