From 62dff6ab7ff94c38b19208dd1423ad0be5cb9dcf Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 1 Apr 2019 21:33:17 +0100 Subject: [PATCH] Replace jshint with eslint --- .travis.yml | 2 +- Gemfile | 4 +++- Gemfile.lock | 13 ++++++++----- config/eslint.json | 30 ++++++++++++++++++++++++++++++ config/jshint.yml | 30 ------------------------------ 5 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 config/eslint.json delete mode 100644 config/jshint.yml diff --git a/.travis.yml b/.travis.yml index 9b848200f..a0ed70c19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 ce37b7c44..d2e0167a5 100644 --- 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 diff --git a/Gemfile.lock b/Gemfile.lock index 32496e129..d850c7aeb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 index 000000000..28ec4d373 --- /dev/null +++ b/config/eslint.json @@ -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 index a7e22486b..000000000 --- a/config/jshint.yml +++ /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 -- 2.43.2