DEV: apply coding standards (#28)

DEV: apply coding standards (#28)

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 3c5ab1f..113898a 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..a558b8e
--- /dev/null
+++ b/.template-lintrc.js
@@ -0,0 +1,4 @@
+module.exports = {
+  plugins: ["ember-template-lint-plugin-discourse"],
+  extends: "discourse:recommended",
+};
diff --git a/assets/javascripts/discourse/activity-route-map.js.es6 b/assets/javascripts/discourse/activity-route-map.js.es6
index f2caf77..2b761b4 100644
--- a/assets/javascripts/discourse/activity-route-map.js.es6
+++ b/assets/javascripts/discourse/activity-route-map.js.es6
@@ -4,5 +4,5 @@ export default {
   map() {
     this.route("approval-given");
     this.route("approval-pending");
-  }
+  },
 };
diff --git a/assets/javascripts/discourse/code-review-route-map.js.es6 b/assets/javascripts/discourse/code-review-route-map.js.es6
index 4a484be..4e1a9b5 100644
--- a/assets/javascripts/discourse/code-review-route-map.js.es6
+++ b/assets/javascripts/discourse/code-review-route-map.js.es6
@@ -3,5 +3,5 @@ export default {
   path: "/plugins",
   map() {
     this.route("code-review");
-  }
+  },
 };
diff --git a/assets/javascripts/discourse/components/review-topic-list-item.js.es6 b/assets/javascripts/discourse/components/review-topic-list-item.js.es6
index 31ca665..f00aae7 100644
--- a/assets/javascripts/discourse/components/review-topic-list-item.js.es6
+++ b/assets/javascripts/discourse/components/review-topic-list-item.js.es6
@@ -9,5 +9,5 @@ export default TopicListItem.extend({
     if (template) {
       this.set("topicListItemContents", template(this).htmlSafe());
     }
-  }
+  },
 });
diff --git a/assets/javascripts/discourse/controllers/admin-plugins-code-review.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-code-review.js.es6
index 701bee2..43809c0 100644
--- a/assets/javascripts/discourse/controllers/admin-plugins-code-review.js.es6
+++ b/assets/javascripts/discourse/controllers/admin-plugins-code-review.js.es6
@@ -9,27 +9,27 @@ export default Ember.Controller.extend({
     const organizations = Ember.A([]);
     this.set("organizations", organizations);
 
-    ajax(`${prefix}/organizations.json`).then(orgNames => {
+    ajax(`${prefix}/organizations.json`).then((orgNames) => {
       for (const orgName of orgNames) {
         let organization = Ember.Object.create({
           name: orgName,
-          repos: Ember.A([])
+          repos: Ember.A([]),
         });
         organizations.pushObject(organization);
 
         ajax(`${prefix}/organizations/${orgName}/repos.json`).then(
-          repoNames => {
+          (repoNames) => {
             for (const repoName of repoNames) {
               let repo = Ember.Object.create({
                 name: repoName,
                 hasConfiguredWebhook: null,
-                receivedWebhookState: false
+                receivedWebhookState: false,
               });
               organization.repos.pushObject(repo);
 
               ajax(
                 `${prefix}/organizations/${orgName}/repos/${repoName}/has-configured-webhook.json`
-              ).then(response => {
+              ).then((response) => {
                 repo.set("receivedWebhookState", true);
                 repo.set(
                   "hasConfiguredWebhook",
@@ -49,9 +49,9 @@ export default Ember.Controller.extend({
         ajax(
           `${prefix}/organizations/${organization.name}/repos/${repo.name}/configure-webhook.json`,
           {
-            type: "POST"
+            type: "POST",
           }
-        ).then(response => {
+        ).then((response) => {
           repo.set("hasConfiguredWebhook", response["has_configured_webhook"]);
         });
       }
@@ -64,9 +64,9 @@ export default Ember.Controller.extend({
             ajax(
               `${prefix}/organizations/${organization.name}/repos/${repo.name}/configure-webhook.json`,
               {
-                type: "POST"
+                type: "POST",
               }
-            ).then(response => {
+            ).then((response) => {
               repo.set(
                 "hasConfiguredWebhook",
                 response["has_configured_webhook"]
@@ -75,6 +75,6 @@ export default Ember.Controller.extend({
           }
         }
       }
-    }
-  }
+    },
+  },
 });
diff --git a/assets/javascripts/discourse/initializers/init-code-review.js.es6 b/assets/javascripts/discourse/initializers/init-code-review.js.es6
index 9b5b9aa..7669c09 100644
--- a/assets/javascripts/discourse/initializers/init-code-review.js.es6
+++ b/assets/javascripts/discourse/initializers/init-code-review.js.es6
@@ -7,9 +7,9 @@ import { findAll } from "discourse/models/login-method";
 function actOnCommit(topic, action) {
   return ajax(`/code-review/${action}.json`, {
     type: "POST",
-    data: { topic_id: topic.id }
+    data: { topic_id: topic.id },
   })
-    .then(result => {
+    .then((result) => {
       if (result.next_topic_url) {
         DiscourseURL.routeTo(result.next_topic_url);
       } else {
@@ -31,12 +31,12 @@ function initialize(api) {
   // note there are slightly cleaner ways of doing this but we would need
   // to amend core for the plugin which is not feeling right
   api.modifyClass("controller:preferences/account", {
-    canUpdateAssociatedAccounts: Ember.computed("authProviders", function() {
+    canUpdateAssociatedAccounts: Ember.computed("authProviders", function () {
       return (
         findAll(this.siteSettings, this.capabilities, this.site.isMobileDevice)
           .length > 0
       );
-    })
+    }),
   });
 
   function allowApprove(currentUser, topic, siteSettings) {
@@ -89,7 +89,7 @@ function initialize(api) {
         this.get("currentUser.staff") &&
         allowApprove(this.currentUser, this.topic, this.siteSettings)
       );
-    }
+    },
   });
 
   api.registerTopicFooterButton({
@@ -111,7 +111,7 @@ function initialize(api) {
         this.get("currentUser.staff") &&
         allowFollowup(this.topic, this.siteSettings)
       );
-    }
+    },
   });
 }
 
@@ -120,5 +120,5 @@ export default {
 
   initialize() {
     withPluginApi("0.8.28", initialize);
-  }
+  },
 };
diff --git a/assets/javascripts/discourse/initializers/theme.js.es6 b/assets/javascripts/discourse/initializers/theme.js.es6
index 2fa5cd2..5558440 100644
--- a/assets/javascripts/discourse/initializers/theme.js.es6
+++ b/assets/javascripts/discourse/initializers/theme.js.es6
@@ -23,7 +23,7 @@ export default {
           }
 
           const topicsByDate = {};
-          filteredTopics.forEach(topic => {
+          filteredTopics.forEach((topic) => {
             topic.setProperties({
               approved: topic.tags.includes(
                 this.siteSettings.code_review_approved_tag
@@ -33,7 +33,7 @@ export default {
               ),
               pending: topic.tags.includes(
                 this.siteSettings.code_review_pending_tag
-              )
+              ),
             });
 
             const date = moment(topic.created_at).format("YYYY-MM-DD");
@@ -47,15 +47,15 @@ export default {
           Object.keys(topicsByDate)
             .sort()
             .reverse()
-            .forEach(date => {
+            .forEach((date) => {
               filteredTopicsByDate.push({
                 date: moment(date).format("MMMM D, YYYY"),
-                topics: topicsByDate[date]
+                topics: topicsByDate[date],
               });
             });

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

GitHub sha: 1053fc1d

This commit appears in #28 which was merged by jjaffeux.