forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint
executable file
·36 lines (30 loc) · 893 Bytes
/
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
#!/usr/bin/env ruby
# frozen_string_literal: true
require_relative "linter"
linter_options = {
file_regex: %r{^ui/.*\.(?:js|ts|tsx)$},
linter_name: "eslint",
format: "eslint",
command: "node_modules/.bin/eslint",
campsite_mode: false,
boyscout_mode: false,
append_files_to_command: true,
severe_anywhere: true
}
eslint = Linter.new(linter_options)
eslint.run
puts "Linting sub-packages"
linter_options[:command] = "yarn lint"
linter_options[:base_dir] = "../../"
linter_options[:file_regex] = nil
linter_options[:severe_anywhere] = false
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|ts|tsx)$}
eslint = Linter.new(linter_options)
eslint.run
Dir.chdir cwd
end