[openstreetmap/openstreetmap-website] Replace eslint-rails-ee with direct calls to eslint (#2209)

Andy Allan notifications at github.com
Wed Jun 12 08:56:03 UTC 2019


gravitystorm commented on this pull request.

Normally I would hesitate about removing a gem and doing it ourselves, but I don't see much activity in either of the gems mentioned so hey-ho.

I'm also totally in favour of yarn instead of npm, beyond it being the rails default.

> @@ -0,0 +1,27 @@
+task "eslint" => "eslint:check"
+
+namespace "eslint" do
+  def yarn_path
+    Rails.root.join("bin", "yarn").to_s
+  end
+
+  def config_file
+    Rails.root.join("config", "eslint.json").to_s
+  end
+
+  def js_files
+    require File.dirname(__FILE__) + "/../../config/environment"

Instead of manually requiring the environment, rake tasks can be marked as depending on the rails environment e.g.

`task :check => :environment do`

>  script:
   - bundle exec rubocop -f fuubar
-  - bundle exec rake eslint:run_all
+  - bundle exec rake eslint

We should add this to CONTRIBUTING.md in the Coding Style section. I mean, I expect a change like this to have a corresponding change to the documentation, but the documentation mentioning eslint is missing :smile:

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2209#pullrequestreview-248624524
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190612/bbf4a852/attachment.html>


More information about the rails-dev mailing list