DEV: apply coding standards (#42)

DEV: apply coding standards (#42)

diff --git a/.eslintrc b/.eslintrc
index bae20bb..7898fbf 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,105 +1,3 @@
 {
-  "env": {
-    "jasmine": true,
-    "node": true,
-    "mocha": true,
-    "browser": true,
-    "builtin": true
-  },
-  "parserOptions": {
-    "ecmaVersion": 7,
-    "sourceType": "module"
-  },
-  "globals": {
-    "Ember":true,
-    "jQuery":true,
-    "$":true,
-    "RSVP":true,
-    "Discourse":true,
-    "Em":true,
-    "PreloadStore":true,
-    "Handlebars":true,
-    "I18n":true,
-    "bootbox":true,
-    "module":true,
-    "moduleFor":true,
-    "moduleForComponent":true,
-    "Pretender":true,
-    "sandbox":true,
-    "controllerFor":true,
-    "test":true,
-    "ok":true,
-    "not":true,
-    "expect":true,
-    "equal":true,
-    "visit":true,
-    "andThen":true,
-    "click":true,
-    "currentPath":true,
-    "currentRouteName":true,
-    "currentURL":true,
-    "fillIn":true,
-    "keyEvent":true,
-    "triggerEvent":true,
-    "count":true,
-    "exists":true,
-    "visible":true,
-    "invisible":true,
-    "asyncRender":true,
-    "asyncTestDiscourse":true,
-    "fixture":true,
-    "find":true,
-    "sinon":true,
-    "moment":true,
-    "start":true,
-    "_":true,
-    "alert":true,
-    "containsInstance":true,
-    "deepEqual":true,
-    "notEqual":true,
-    "define":true,
-    "require":true,
-    "requirejs":true,
-    "hasModule":true,
-    "Blob":true,
-    "File":true},
-  "rules": {
-    "block-scoped-var": 2,
-    "dot-notation": 0,
-    "eqeqeq": [
-      2,
-      "allow-null"
-    ],
-    "guard-for-in": 2,
-    "no-bitwise": 2,
-    "no-caller": 2,
-    "no-cond-assign": 0,
-    "no-debugger": 2,
-    "no-empty": 0,
-    "no-eval": 2,
-    "no-extend-native": 2,
-    "no-extra-parens": 0,
-    "no-irregular-whitespace": 2,
-    "no-iterator": 2,
-    "no-loop-func": 2,
-    "no-multi-str": 2,
-    "no-new": 2,
-    "no-plusplus": 0,
-    "no-proto": 2,
-    "no-script-url": 2,
-    "no-sequences": 2,
-    "no-shadow": 2,
-    "no-undef": 2,
-    "no-unused-vars": 2,
-    "no-with": 2,
-    "no-this-before-super": 2,
-    "semi": 2,
-    "strict": 0,
-    "valid-typeof": 2,
-    "wrap-iife": [
-      2,
-      "inside"
-    ]
-  },
-  "parser": "babel-eslint"
+  "extends": "eslint-config-discourse"
 }
diff --git a/.gitignore b/.gitignore
index e2f8a7f..3123da6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,6 @@ doc/
 node_modules/
 
 *.swp
+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/initializers/spoiler-alert.js.es6 b/assets/javascripts/initializers/spoiler-alert.js.es6
index 9cdc10e..c87f85d 100644
--- a/assets/javascripts/initializers/spoiler-alert.js.es6
+++ b/assets/javascripts/initializers/spoiler-alert.js.es6
@@ -3,10 +3,7 @@ import { Tag } from "discourse/lib/to-markdown";
 import ComposerController from "discourse/controllers/composer";
 
 function spoil($elem) {
-  $(".spoiler", $elem)
-    .removeClass("spoiler")
-    .addClass("spoiled")
-    .spoil();
+  $(".spoiler", $elem).removeClass("spoiler").addClass("spoiled").spoil();
 }
 
 function initializeSpoiler(api) {
@@ -16,7 +13,7 @@ function initializeSpoiler(api) {
     return {
       action: "insertSpoiler",
       icon: "magic",
-      label: "spoiler.title"
+      label: "spoiler.title",
     };
   });
 
@@ -29,12 +26,12 @@ function initializeSpoiler(api) {
           "spoiler_text",
           { multiline: false, useBlockMode: true }
         );
-      }
-    }
+      },
+    },
   });
 
   if (Tag) {
-    Tag.prototype.decorate = function(text) {
+    Tag.prototype.decorate = function (text) {
       const attr = this.element.attributes;
       if (attr.class === "spoiled") {
         this.prefix = "[spoiler]";
@@ -52,7 +49,7 @@ function initializeSpoiler(api) {
       return text;
     };
 
-    Tag.block = function(name, prefix, suffix) {
+    Tag.block = function (name, prefix, suffix) {
       return class extends Tag {
         constructor() {
           super(name, prefix, suffix);
@@ -88,5 +85,5 @@ export default {
     if (siteSettings.spoiler_enabled) {
       withPluginApi("0.5", initializeSpoiler);
     }
-  }
+  },
 };
diff --git a/assets/javascripts/lib/discourse-markdown/spoiler-alert.js.es6 b/assets/javascripts/lib/discourse-markdown/spoiler-alert.js.es6
index 0d07a20..ed435e2 100644
--- a/assets/javascripts/lib/discourse-markdown/spoiler-alert.js.es6
+++ b/assets/javascripts/lib/discourse-markdown/spoiler-alert.js.es6
@@ -28,15 +28,15 @@ function setupMarkdownIt(helper) {
     opts.features["spoiler-alert"] = !!siteSettings.spoiler_enabled;
   });
 
-  helper.registerPlugin(md => {
+  helper.registerPlugin((md) => {
     md.inline.bbcode.ruler.push("spoiler", {
       tag: "spoiler",
-      wrap: "span.spoiler"
+      wrap: "span.spoiler",
     });
 
     md.block.bbcode.ruler.push("spoiler", {
       tag: "spoiler",
-      wrap: "div.spoiler"
+      wrap: "div.spoiler",
     });
   });
 }
diff --git a/assets/javascripts/spoiler.js b/assets/javascripts/spoiler.js
index 56c7426..525bd18 100644
--- a/assets/javascripts/spoiler.js
+++ b/assets/javascripts/spoiler.js
@@ -1,7 +1,7 @@
-(function($) {
+(function ($) {
   // handle lazyYT onebox
   function blurLazyYT($spoiler) {
-    $("div.lazyYT", $spoiler).each(function() {
+    $("div.lazyYT", $spoiler).each(function () {
       $(this).replaceWith(
         "<p>https://youtube.com/watch?v=" + $(this).data("youtube-id") + "</p>"
       );
@@ -13,17 +13,17 @@
     $("a", $spoiler).addClass("no-track-link");
   }
 
-  var applyBlur = function($spoiler) {
+  var applyBlur = function ($spoiler) {
     blurLazyYT($spoiler);
     blur($spoiler);
   };
 
-  var applySpoilers = function($spoiler) {
+  var applySpoilers = function ($spoiler) {
     $spoiler.data("spoiler-state", "blurred");
 
     applyBlur($spoiler);
 
-    $spoiler.on("click", function(e) {
+    $spoiler.on("click", function (e) {
       if ($spoiler.data("spoiler-state") === "blurred") {
         $spoiler.data("spoiler-state", "revealed");
         $spoiler.removeClass("spoiler-blurred");
@@ -35,8 +35,8 @@
     });
   };
 
-  $.fn.spoil = function() {
-    return this.each(function() {
+  $.fn.spoil = function () {
+    return this.each(function () {
       applySpoilers($(this));
     });
   };
diff --git a/package.json b/package.json
index e77c8a6..c25cfbf 100644
--- a/package.json
+++ b/package.json
@@ -5,8 +5,6 @@
   "author": "Discourse",
   "license": "MIT",
   "devDependencies": {
-    "babel-eslint": "^8.2",
-    "eslint": "^4.19",
-    "prettier": "1.14.3"
+    "eslint-config-discourse": "latest"
   }
 }
diff --git a/test/javascripts/acceptance/spoiler-button-test.js.es6 b/test/javascripts/acceptance/spoiler-button-test.js.es6
index 99bbe00..bf7be4a 100644
--- a/test/javascripts/acceptance/spoiler-button-test.js.es6
+++ b/test/javascripts/acceptance/spoiler-button-test.js.es6
@@ -7,10 +7,10 @@ acceptance("Spoiler Button", {
   settings: { spoiler_enabled: true },
   beforeEach() {
     clearPopupMenuOptionsCallback();
-  }
+  },
 });
 
-test("spoiler button", async assert => {
+test("spoiler button", async (assert) => {
   const popUpMenu = selectKit(".toolbar-popup-menu-options");
 
   await visit("/");
diff --git a/test/javascripts/acceptance/to-markdown-test.js.es6 b/test/javascripts/acceptance/to-markdown-test.js.es6
index ad657c9..0401302 100644
--- a/test/javascripts/acceptance/to-markdown-test.js.es6
+++ b/test/javascripts/acceptance/to-markdown-test.js.es6
@@ -2,10 +2,10 @@ import { acceptance } from "helpers/qunit-helpers";
 import toMarkdown from "discourse/lib/to-markdown";
 
 acceptance("To Markdown", {

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

GitHub sha: 75f3d5e6

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