]> git.openstreetmap.org Git - rails.git/commitdiff
Replace jshint with eslint
authorTom Hughes <tom@compton.nu>
Mon, 1 Apr 2019 20:33:17 +0000 (21:33 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 1 Apr 2019 21:03:39 +0000 (22:03 +0100)
.travis.yml
Gemfile
Gemfile.lock
config/eslint.json [new file with mode: 0644]
config/jshint.yml [deleted file]

index 9b848200fb127855e839de0d0b7adfbb07dee7f5..a0ed70c19601565c24634c0e5ecbc6f2bc34757f 100644 (file)
@@ -27,6 +27,6 @@ before_script:
   - bundle exec rake i18n:js:export
 script:
   - bundle exec rubocop -f fuubar
-  - bundle exec rake jshint
+  - bundle exec rake eslint:run_all
   - bundle exec erblint .
   - bundle exec rake test:db
diff --git a/Gemfile b/Gemfile
index ce37b7c440e4d3cb402339bb68a27cb293e014d9..d2e0167a5878011461ed735075f915601fc90791 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -145,8 +145,10 @@ group :development, :test do
   gem "capybara", "~> 2.13"
   gem "coveralls", :require => false
   gem "erb_lint", :require => false
+  gem "eslint-rails-ee"
+  gem "execjs"
   gem "factory_bot_rails"
-  gem "jshint"
   gem "poltergeist"
   gem "puma", "~> 3.7"
+  gem "therubyracer", :platforms => :ruby
 end
index 32496e129ba67fbba417a796d355f64e28e60cd9..d850c7aebe3219d2d3741259523858f8021d6b02 100644 (file)
@@ -99,6 +99,7 @@ GEM
       coffee-script-source
       execjs
     coffee-script-source (1.12.2)
+    colorize (0.8.1)
     composite_primary_keys (11.1.0)
       activerecord (~> 5.2.1)
     concurrent-ruby (1.1.5)
@@ -161,6 +162,10 @@ GEM
       rubocop (~> 0.51)
       smart_properties
     erubi (1.8.0)
+    eslint-rails-ee (1.0.2)
+      colorize
+      execjs
+      railties (>= 3.2)
     execjs (2.7.0)
     exifr (1.3.6)
     factory_bot (5.0.2)
@@ -204,10 +209,6 @@ GEM
       rails-dom-testing (>= 1, < 3)
       railties (>= 4.2.0)
       thor (>= 0.14, < 2.0)
-    jshint (1.5.0)
-      execjs (>= 1.4.0)
-      multi_json (~> 1.0)
-      therubyracer (~> 0.12.1)
     json (2.2.0)
     jsonify (0.3.1)
       multi_json (~> 1.0)
@@ -459,6 +460,8 @@ DEPENDENCIES
   delayed_job_active_record
   dynamic_form
   erb_lint
+  eslint-rails-ee
+  execjs
   factory_bot_rails
   fakefs
   faraday
@@ -469,7 +472,6 @@ DEPENDENCIES
   i18n-js (>= 3.0.0)
   image_optim_rails
   jquery-rails
-  jshint
   json
   jsonify-rails
   kgio
@@ -506,6 +508,7 @@ DEPENDENCIES
   sanitize
   sassc-rails
   secure_headers
+  therubyracer
   uglifier (>= 1.3.0)
   validates_email_format_of (>= 1.5.1)
   vendorer
diff --git a/config/eslint.json b/config/eslint.json
new file mode 100644 (file)
index 0000000..28ec4d3
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "env": {
+    "browser": true,
+    "jquery": true
+  },
+  "extends": [
+    "eslint:recommended"
+  ],
+  "globals": {
+    "bowser": "readonly",
+    "I18n": "readonly",
+    "L": "readonly",
+    "OSM": "writable",
+    "Piwik": "readonly",
+    "querystring": "readonly",
+    "require": "readonly",
+    "updateLinks": "readonly"
+  },
+  "rules": {
+    "eqeqeq": ["error", "smart"],
+    "no-caller": "error",
+    "no-extend-native": "error",
+    "no-new": "error",
+    "no-trailing-spaces": "error",
+    "no-undef": "error",
+    "no-unused-vars": "error",
+    "no-use-before-define": ["error", {"functions": false}],
+    "semi": ["error", "always"]
+  }
+}
diff --git a/config/jshint.yml b/config/jshint.yml
deleted file mode 100644 (file)
index a7e2248..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-files:
-  - "**/*.js"
-exclude_paths:
-  - "app/assets/javascripts/i18n"
-  - "vendor/assets/javascripts"
-options:
-  eqeqeq: true
-  freeze: true
-  latedef: "nofunc"
-  noarg: true
-  noempty: true
-  nonew: true
-  undef: true
-  browser: true
-  jquery: true
-  unused: true
-  trailing: true
-  globals:
-    I18n: false
-    L: true
-    OSM: true
-    Piwik: false
-    alert: false
-    escape: false
-    maximiseMap: false
-    minimiseMap: false
-    querystring: true
-    require: false
-    updateLinks: false
-    bowser: false