DEV: apply coding standards (#18)

DEV: apply coding standards (#18)

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 3c3629e..2d83702 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
 node_modules
+yarn-error.log
+.rubocop-https---raw-githubusercontent-com-discourse-*
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/components/encrypt-enable-dropdown.js.es6 b/assets/javascripts/discourse/components/encrypt-enable-dropdown.js.es6
index e4336ef..372d6f9 100644
--- a/assets/javascripts/discourse/components/encrypt-enable-dropdown.js.es6
+++ b/assets/javascripts/discourse/components/encrypt-enable-dropdown.js.es6
@@ -1,23 +1,24 @@
 import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
+import I18n from "I18n";
 
 export default DropdownSelectBoxComponent.extend({
   classNames: ["encrypt-enable-dropdown"],
 
   selectKitOptions: {
     icon: "bars",
-    showFullTitle: false
+    showFullTitle: false,
   },
 
   content: [
     {
       id: "import",
       icon: "file-import",
-      name: I18n.t("encrypt.preferences.import")
+      name: I18n.t("encrypt.preferences.import"),
     },
     {
       id: "reset",
       icon: "trash-alt",
-      name: I18n.t("encrypt.preferences.reset")
-    }
-  ]
+      name: I18n.t("encrypt.preferences.reset"),
+    },
+  ],
 });
diff --git a/assets/javascripts/discourse/components/encrypt-preferences-dropdown.js.es6 b/assets/javascripts/discourse/components/encrypt-preferences-dropdown.js.es6
index c16cafd..57fbdd9 100644
--- a/assets/javascripts/discourse/components/encrypt-preferences-dropdown.js.es6
+++ b/assets/javascripts/discourse/components/encrypt-preferences-dropdown.js.es6
@@ -1,28 +1,29 @@
 import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
+import I18n from "I18n";
 
 export default DropdownSelectBoxComponent.extend({
   classNames: ["encrypt-preferences-dropdown"],
 
   selectKitOptions: {
     icon: "wrench",
-    showFullTitle: false
+    showFullTitle: false,
   },
 
   content: [
     {
       id: "export",
       icon: "file-export",
-      name: I18n.t("encrypt.export.title")
+      name: I18n.t("encrypt.export.title"),
     },
     {
       id: "managePaperKeys",
       icon: "ticket-alt",
-      name: I18n.t("encrypt.manage_paper_keys.title")
+      name: I18n.t("encrypt.manage_paper_keys.title"),
     },
     {
       id: "reset",
       icon: "trash-alt",
-      name: I18n.t("encrypt.preferences.reset")
-    }
-  ]
+      name: I18n.t("encrypt.preferences.reset"),
+    },
+  ],
 });
diff --git a/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js.es6 b/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js.es6
index d018818..5b6452c 100644
--- a/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js.es6
+++ b/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js.es6
@@ -3,7 +3,7 @@ import { registerHelper } from "discourse-common/lib/helpers";
 import {
   ENCRYPT_ACTIVE,
   ENCRYPT_DISABLED,
-  getEncryptionStatus
+  getEncryptionStatus,
 } from "discourse/plugins/discourse-encrypt/lib/discourse";
 
 // TODO: I believe this should get into core.
@@ -25,7 +25,7 @@ export default {
         const newStatus = getEncryptionStatus(currentUser);
         component.setProperties({
           isEncryptEnabled: newStatus !== ENCRYPT_DISABLED,
-          isEncryptActive: newStatus === ENCRYPT_ACTIVE
+          isEncryptActive: newStatus === ENCRYPT_ACTIVE,
         });
       },
 
@@ -45,7 +45,7 @@ export default {
           this.set("model.isEncrypted", !this.get("model.isEncrypted"));
           this.set("model.overwriteDefault", true);
         }
-      }
+      },
     });
 
     Ember.defineProperty(
@@ -65,5 +65,5 @@ export default {
         }
       )
     );
-  }
+  },
 };
diff --git a/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6 b/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6
index c718f9f..55f14e4 100644
--- a/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6
+++ b/assets/javascripts/discourse/connectors/user-preferences-account/encrypt.js.es6
@@ -2,7 +2,7 @@ import showModal from "discourse/lib/show-modal";
 import User from "discourse/models/user";
 import {
   deleteDb,
-  saveDbIdentity
+  saveDbIdentity,
 } from "discourse/plugins/discourse-encrypt/lib/database";
 import {
   activateEncrypt,
@@ -10,7 +10,7 @@ import {
   enableEncrypt,
   ENCRYPT_ACTIVE,
   ENCRYPT_DISABLED,
-  getEncryptionStatus
+  getEncryptionStatus,
 } from "discourse/plugins/discourse-encrypt/lib/discourse";
 import { unpackIdentity } from "discourse/plugins/discourse-encrypt/lib/pack";
 import { importIdentity } from "discourse/plugins/discourse-encrypt/lib/protocol";
@@ -31,7 +31,7 @@ export default {
       /** Whether plugin is enabled for current user. */
       canEnableEncrypt: canEnableEncrypt(args.model),
       /** Whether the encryption is enabled or not. */
-      isEncryptEnabled: !!args.model.encrypt_public
+      isEncryptEnabled: !!args.model.encrypt_public,
     });
 
     if (isCurrentUser) {
@@ -58,7 +58,7 @@ export default {
           const newStatus = getEncryptionStatus(args.model);
           component.setProperties({
             isEncryptEnabled: newStatus !== ENCRYPT_DISABLED,
-            isEncryptActive: newStatus === ENCRYPT_ACTIVE
+            isEncryptActive: newStatus === ENCRYPT_ACTIVE,
           });
         },
         didInsertElement() {
@@ -68,7 +68,7 @@ export default {
         willDestroyElement() {
           this._super(...arguments);
           this.appEvents.off("encrypt:status-changed", this, this.listener);
-        }
+        },
       });
     }
   },
@@ -86,7 +86,7 @@ export default {
             passphrase: "",
             inProgress: false,
             importIdentity: false,
-            identity: ""
+            identity: "",
           });
         });
     },
@@ -95,7 +95,7 @@ export default {
       this.set("inProgress", true);
 
       const identityPromise = this.importIdentity
-        ? importIdentity(unpackIdentity(this.identity)).then(identity =>
+        ? importIdentity(unpackIdentity(this.identity)).then((identity) =>
             saveDbIdentity(identity)
           )
         : activateEncrypt(this.model, this.passphrase);
@@ -112,7 +112,7 @@ export default {
             passphrase: "",
             inProgress: false,
             importIdentity: false,
-            identity: ""
+            identity: "",
           })
         );
     },
@@ -131,8 +131,8 @@ export default {
       showModal("generate-paper-key", {
         model: {
           user: this.model,
-          device
-        }
+          device,
+        },
       });
     },
 
@@ -159,6 +159,6 @@ export default {
           showModal("reset-key-pair", { model: this.model });
           break;
       }
-    }
-  }
+    },
+  },
 };
diff --git a/assets/javascripts/discourse/controllers/activate-encrypt.js.es6 b/assets/javascripts/discourse/controllers/activate-encrypt.js.es6
index 0c7457e..b1fc4de 100644
--- a/assets/javascripts/discourse/controllers/activate-encrypt.js.es6
+++ b/assets/javascripts/discourse/controllers/activate-encrypt.js.es6
@@ -1,3 +1,4 @@
+import I18n from "I18n";
 import ModalFunctionality from "discourse/mixins/modal-functionality";
 import { activateEncrypt } from "discourse/plugins/discourse-encrypt/lib/discourse";
 
@@ -9,13 +10,13 @@ export default Ember.Controller.extend(ModalFunctionality, {
     this.setProperties({
       models: models,

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

GitHub sha: 01efbd88

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