DEV: apply coding standards

DEV: apply coding standards

diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..7898fbf
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,3 @@
+{
+  "extends": "eslint-config-discourse"
+}
diff --git a/.gitignore b/.gitignore
index 4cf24de..81ca8db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
 gems/
+node_modules
+yarn-error.log
+.rubocop-https---raw-githubusercontent-com-discourse-*
diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 0000000..d46296c
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,2 @@
+inherit_gem:
+  rubocop-discourse: default.yml
diff --git a/.template-lintrc.js b/.template-lintrc.js
new file mode 100644
index 0000000..dd2e0b9
--- /dev/null
+++ b/.template-lintrc.js
@@ -0,0 +1,4 @@
+module.exports = {
+  plugins: ["ember-template-lint-plugin-discourse"],
+  extends: "discourse:recommended"
+};
diff --git a/app/jobs/regular/update_algolia_post.rb b/app/jobs/regular/update_algolia_post.rb
index 53874a2..68909aa 100644
--- a/app/jobs/regular/update_algolia_post.rb
+++ b/app/jobs/regular/update_algolia_post.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Jobs
   class UpdateAlgoliaPost < ::Jobs::Base
     def execute(args)
diff --git a/app/jobs/regular/update_algolia_tags.rb b/app/jobs/regular/update_algolia_tags.rb
index 62e31e4..5fff6ca 100644
--- a/app/jobs/regular/update_algolia_tags.rb
+++ b/app/jobs/regular/update_algolia_tags.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Jobs
   class UpdateAlgoliaTags < ::Jobs::Base
     def execute(args)
diff --git a/app/jobs/regular/update_algolia_topic.rb b/app/jobs/regular/update_algolia_topic.rb
index b3783a2..21a0ed9 100644
--- a/app/jobs/regular/update_algolia_topic.rb
+++ b/app/jobs/regular/update_algolia_topic.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Jobs
   class UpdateAlgoliaTopic < ::Jobs::Base
     def execute(args)
diff --git a/app/jobs/regular/update_algolia_user.rb b/app/jobs/regular/update_algolia_user.rb
index 36f874f..e02e533 100644
--- a/app/jobs/regular/update_algolia_user.rb
+++ b/app/jobs/regular/update_algolia_user.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Jobs
   class UpdateAlgoliaUser < ::Jobs::Base
     def execute(args)
diff --git a/assets/javascripts/discourse/initializers/discourse-algolia.js.es6 b/assets/javascripts/discourse/initializers/discourse-algolia.js.es6
index b3f0991..4ce8d39 100644
--- a/assets/javascripts/discourse/initializers/discourse-algolia.js.es6
+++ b/assets/javascripts/discourse/initializers/discourse-algolia.js.es6
@@ -1,62 +1,68 @@
-import { h } from 'virtual-dom';
-import { on } from 'ember-addons/ember-computed-decorators';
-import DiscourseURL from 'discourse/lib/url';
-import { withPluginApi } from 'discourse/lib/plugin-api';
-import discourseAutocomplete from './discourse-autocomplete';
+import { h } from "virtual-dom";
+import { on } from "ember-addons/ember-computed-decorators";
+import DiscourseURL from "discourse/lib/url";
+import { withPluginApi } from "discourse/lib/plugin-api";
+import discourseAutocomplete from "./discourse-autocomplete";
 
 export default {
-  name : "discourse-algolia",
-  initialize(container) {
-
-    withPluginApi('0.8.8', (api) => {
-
-      api.modifyClass('component:site-header', {
+  name: "discourse-algolia",
+  initialize() {
+    withPluginApi("0.8.8", (api) => {
+      api.modifyClass("component:site-header", {
         @on("didInsertElement")
         initializeAlgolia() {
           this._super();
-          if (this.siteSettings.algolia_enabled &&
-              this.siteSettings.algolia_autocomplete_enabled) {
+          if (
+            this.siteSettings.algolia_enabled &&
+            this.siteSettings.algolia_autocomplete_enabled
+          ) {
             $("body").addClass("algolia-enabled");
+
             setTimeout(() => {
               discourseAutocomplete._initialize({
                 algoliaApplicationId: this.siteSettings.algolia_application_id,
                 algoliaSearchApiKey: this.siteSettings.algolia_search_api_key,
                 imageBaseURL: "",
-                debug: document.location.host.indexOf('localhost') > -1,
-                onSelect: function(event, suggestion, dataset) {
+                debug: document.location.host.indexOf("localhost") > -1,
+                onSelect(event, suggestion) {
                   DiscourseURL.routeTo(suggestion.url);
-                }
+                },
               });
             }, 100);
           }
-        }
+        },
       });
 
-      api.createWidget('algolia', {
-        tagName: 'li.algolia-holder',
+      api.createWidget("algolia", {
+        tagName: "li.algolia-holder",
         html() {
           return [
-            h('form', {
-              action: '/search',
-              method: 'GET'
-            }, [
-              h('input.aa-input#search-box', {
-                name: "q",
-                placeholder: "Search the forum...",
-                autocomplete: "off"
-              })
-            ])
+            h(
+              "form",
+              {
+                action: "/search",
+                method: "GET",
+              },
+              [
+                h("input.aa-input#search-box", {
+                  name: "q",
+                  placeholder: "Search the forum...",
+                  autocomplete: "off",
+                }),
+              ]
+            ),
           ];
-        }
+        },
       });
 
-      api.decorateWidget('header-icons:before', function(helper) {
-        if (helper.widget.siteSettings.algolia_enabled &&
-            helper.widget.siteSettings.algolia_autocomplete_enabled) {
-          return helper.attach('algolia');
+      api.decorateWidget("header-icons:before", function (helper) {
+        if (
+          helper.widget.siteSettings.algolia_enabled &&
+          helper.widget.siteSettings.algolia_autocomplete_enabled
+        ) {
+          return helper.attach("algolia");
         }
       });
-
     });
-  }
-}
+  },
+};
diff --git a/assets/javascripts/discourse/initializers/discourse-autocomplete.js.es6 b/assets/javascripts/discourse/initializers/discourse-autocomplete.js.es6
index 623c08e..f301120 100644
--- a/assets/javascripts/discourse/initializers/discourse-autocomplete.js.es6
+++ b/assets/javascripts/discourse/initializers/discourse-autocomplete.js.es6
@@ -1,21 +1,24 @@
 export default {
-
   name: "discourse-autocomplete",
   initialize() {},
   _initialize(options) {
+    let searchInput = "#search-box";
+    let client = algoliasearch(
+      options.algoliaApplicationId,
+      options.algoliaSearchApiKey
+    );
+    let postsIndex = client.initIndex("discourse-posts");
+    let tagsIndex = client.initIndex("discourse-tags");
+    let usersIndex = client.initIndex("discourse-users");
 
-    var searchInput = '#search-box';
-    var client = algoliasearch(options.algoliaApplicationId, options.algoliaSearchApiKey);
-    var postsIndex = client.initIndex('discourse-posts');
-    var tagsIndex = client.initIndex('discourse-tags');
-    var usersIndex = client.initIndex('discourse-users');
-
-    autocomplete(searchInput, {
-      openOnFocus: true,
-      hint: false,
-      debug: options.debug,
-      templates: {
-        dropdownMenu: `
+    autocomplete(
+      searchInput,
+      {
+        openOnFocus: true,
+        hint: false,
+        debug: options.debug,
+        templates: {
+          dropdownMenu: `
           <div class="left-container">
             <div class="aa-dataset-posts" />
           </div>
@@ -23,7 +26,7 @@ export default {
             <span class="aa-dataset-users" />
             <span class="aa-dataset-tags" />
           </div>`,
-        footer: `
+          footer: `
           <div class="aa-footer">
             <div class="left-container">
               <a class="advanced-search" href="/search">advanced search</a>
@@ -33,19 +36,22 @@ export default {

[... diff too long, it was truncated ...]

GitHub sha: 77786098