]> git.openstreetmap.org Git - rails.git/blob - lib/tasks/eslint.rake
Move eslint ignore rules to the configuration file
[rails.git] / lib / tasks / eslint.rake
1 task "eslint" => "eslint:check"
2
3 def yarn_path
4   Rails.root.join("bin/yarn").to_s
5 end
6
7 def config_file
8   Rails.root.join("config/eslint.js").to_s
9 end
10
11 namespace "eslint" do
12   task :check => :environment do
13     system(yarn_path, "run", "eslint", "-c", config_file, "--no-warn-ignored", Rails.root.to_s) || abort
14   end
15
16   task :fix => :environment do
17     system(yarn_path, "run", "eslint", "-c", config_file, "--no-warn-ignored", "--fix", Rails.root.to_s) || abort
18   end
19 end