41 lines
1.0 KiB
Ruby
Executable File
41 lines
1.0 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
require_relative "./linter"
|
|
|
|
linter_options = {
|
|
linter_name: "eslint",
|
|
# ignore packages subdirectory
|
|
file_regex: %r{^(?!(?:packages/)).*\.js$},
|
|
format: "eslint",
|
|
command: "node_modules/.bin/eslint",
|
|
campsite_mode: false,
|
|
boyscout_mode: false,
|
|
append_files_to_command: true,
|
|
comment_post_processing: proc do |comments|
|
|
# This section should be removed when we start -2ing patchsets
|
|
comments.each do |comment|
|
|
comment[:severity] = "warn"
|
|
end
|
|
end,
|
|
severe_anywhere: false
|
|
}
|
|
|
|
eslint = Linter.new(linter_options)
|
|
eslint.run
|
|
|
|
puts "Linting sub-packages"
|
|
|
|
linter_options[:command] = "yarn lint"
|
|
linter_options[:base_dir] = "../../"
|
|
package_dirs = `ls -1 packages/*/package.json 2> /dev/null`.split("\n").map { |d| d.sub("/package.json", "") }
|
|
cwd = Dir.pwd
|
|
package_dirs.each do |d|
|
|
puts "working sub-package dir #{d}"
|
|
Dir.chdir d
|
|
linter_options[:file_regex] = %r{#{d}/.*\.js$}
|
|
eslint = Linter.new(linter_options)
|
|
eslint.run
|
|
Dir.chdir cwd
|
|
end
|