forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint
executable file
·40 lines (35 loc) · 1.01 KB
/
eslint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/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