diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..d0405b751 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,16 @@ +module.exports = { + env: { + browser: true, + es6: true, + }, + extends: 'eslint:recommended', + globals: { + Atomics: 'readonly', + SharedArrayBuffer: 'readonly', + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + rules: {}, +}; diff --git a/Gemfile b/Gemfile index be3c31389..4f4ea1e01 100644 --- a/Gemfile +++ b/Gemfile @@ -88,7 +88,7 @@ gem "sass-rails", "~> 6.0" # Sass adapter for the Rails asset pipeline gem "sidekiq", "~> 6.0.4" # Sidekiq is used to process background jobs with the help of Redis gem "sitemap_generator", "~> 6.1" # SitemapGenerator is a framework-agnostic XML Sitemap generator gem "slack-notifier", "~> 2.3" # A slim ruby wrapper for posting to slack webhooks -gem "sprockets", "~> 3.7" # Sprockets is a Rack-based asset packaging system +gem "sprockets", "~> 4.0" # Sprockets is a Rack-based asset packaging system gem "staccato", "~> 0.5" # Ruby Google Analytics Measurement gem "storext", "~> 3.1" # Add type-casting and other features on top of ActiveRecord::Store.store_accessor gem "stripe", "~> 5.15" # Ruby library for the Stripe API diff --git a/Gemfile.lock b/Gemfile.lock index 3eea16106..0b5442ad0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -740,7 +740,7 @@ GEM spring (2.1.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (3.7.2) + sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -963,7 +963,7 @@ DEPENDENCIES slack-notifier (~> 2.3) spring (~> 2.1) spring-commands-rspec (~> 1.0) - sprockets (~> 3.7) + sprockets (~> 4.0) staccato (~> 0.5) stackprof (~> 0.2) storext (~> 3.1) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 000000000..5fbbb5019 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,6 @@ +// https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css +//= link internal/layout.css +//= link s3_direct_upload.js diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 7da6b0738..9c6dcea8e 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -10,27 +10,6 @@ Rails.application.config.assets.version = "1.1" Rails.application.config.assets.paths << Rails.root.join("node_modules") # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -# Rails.application.config.assets.precompile += %w( search.js ) -Rails.application.config.assets.precompile += %w[favicon.ico] -# Add client/assets/ folders to asset pipeline's search path. -# If you do not want to move existing images and fonts from your Rails app -# you could also consider creating symlinks there that point to the original -# rails directories. In that case, you would not add these paths here. -# Rails.application.config.assets.paths << Rails.root.join("client/assets/stylesheets") -# Rails.application.config.assets.paths << Rails.root.join("client/assets/images") -# Rails.application.config.assets.paths << Rails.root.join("client/assets/fonts") -# Rails.application.config.assets.precompile += %w( generated/server-bundle.js ) - -Rails.application.config.assets.precompile += %w[minimal.css] -Rails.application.config.assets.precompile += %w[s3_direct_upload.css] -Rails.application.config.assets.precompile += %w[base.js] -Rails.application.config.assets.precompile += %w[hello-dev.js] -Rails.application.config.assets.precompile += %w[s3_direct_upload.js] -Rails.application.config.assets.precompile += %w[classified_listings.css] -Rails.application.config.assets.precompile += %w[lib/xss.js] -Rails.application.config.assets.precompile += %w[lib/pulltorefresh.js] -Rails.application.config.assets.precompile += %w[internal.js] -Rails.application.config.assets.precompile += %w[internal/layout] -Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/ -Rails.application.config.assets.precompile += %w[honeybadger-js/dist/honeybadger.js] +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/package.json b/package.json index 36d93b068..c27556d12 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,10 @@ } }, "lint-staged": { + "app/assets/config/manifest.js": [ + "prettier --write", + "eslint --fix -c app/assets/javascripts/.eslintrc.js" + ], "*.{js,jsx}": [ "prettier --write", "eslint --fix"