DEV: apply coding standards (#5)

DEV: apply coding standards (#5)

diff --git a/.eslintrc b/.eslintrc
index a656e80..7898fbf 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,96 +1,3 @@
 {
-  "env": {
-    "browser": true,
-    "builtin": true,
-    "es6": true,
-    "jasmine": true,
-    "mocha": true,
-    "node": true
-  },
-  "parserOptions": {
-    "ecmaVersion": 7,
-    "sourceType": "module"
-  },
-  "globals": {
-    "$": true,
-    "_": true,
-    "andThen": true,
-    "asyncRender": true,
-    "Blob": true,
-    "bootbox": true,
-    "click": true,
-    "waitUntil": true,
-    "getSettledState": true,
-    "count": true,
-    "currentPath": true,
-    "currentRouteName": true,
-    "currentURL": true,
-    "define": true,
-    "Discourse": true,
-    "Ember": true,
-    "exists": true,
-    "File": true,
-    "fillIn": true,
-    "find": true,
-    "Handlebars": true,
-    "hasModule": true,
-    "I18n": true,
-    "invisible": true,
-    "jQuery": true,
-    "keyboardHelper": true,
-    "keyEvent": true,
-    "moduleFor": true,
-    "moduleForComponent": true,
-    "moment": true,
-    "Pretender": true,
-    "QUnit": true,
-    "require": true,
-    "requirejs": true,
-    "RSVP": true,
-    "sandbox": true,
-    "sinon": true,
-    "test": true,
-    "triggerEvent": true,
-    "visible": true,
-    "visit": true,
-    "pauseTest": true
-  },
-  "rules": {
-    "block-scoped-var": 2,
-    "dot-notation": 0,
-    "eqeqeq": [2, "allow-null"],
-    "guard-for-in": 2,
-    "no-alert": 2,
-    "no-bitwise": 2,
-    "no-caller": 2,
-    "no-cond-assign": 0,
-    "no-console": 2,
-    "no-debugger": 2,
-    "no-empty": 0,
-    "no-eval": 2,
-    "no-extend-native": 2,
-    "no-extra-parens": 0,
-    "no-inner-declarations": 2,
-    "no-irregular-whitespace": 2,
-    "no-iterator": 2,
-    "no-loop-func": 2,
-    "no-mixed-spaces-and-tabs": 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-this-before-super": 2,
-    "no-trailing-spaces": 2,
-    "no-undef": 2,
-    "no-unused-vars": 2,
-    "no-with": 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 328093d..2c4c4c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -130,3 +130,4 @@ vendor/bundle/*
 
 # ignore auto-generated plugin js assets
 /app/assets/javascripts/plugins/*
+yarn-error.log
diff --git a/.rubocop.yml b/.rubocop.yml
index e6ec768..d46296c 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,2 +1,2 @@
 inherit_gem:
-  rubocop-discourse: default.yml
\ No newline at end of file
+  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/assets/javascripts/discourse/components/bcc-checkbox.js.es6 b/assets/javascripts/discourse/components/bcc-checkbox.js.es6
index a557503..83deb91 100644
--- a/assets/javascripts/discourse/components/bcc-checkbox.js.es6
+++ b/assets/javascripts/discourse/components/bcc-checkbox.js.es6
@@ -12,7 +12,7 @@ export default Component.extend({
       return (
         this.currentUser.staff &&
         this.creatingPrivateMessage &&
-        ((this.targetRecipients || "").split(",").length > 1 ||
+        ((this.targetRecipients || "").split(",").filter(Boolean).length > 1 ||
           this.targetGroups)
       );
     }
diff --git a/assets/javascripts/discourse/templates/components/bcc-checkbox.hbs b/assets/javascripts/discourse/templates/components/bcc-checkbox.hbs
index ed2c2c7..758c316 100644
--- a/assets/javascripts/discourse/templates/components/bcc-checkbox.hbs
+++ b/assets/javascripts/discourse/templates/components/bcc-checkbox.hbs
@@ -1,7 +1,8 @@
 {{#if bccAvailable}}
-  <div class='bcc-checkbox'>
+  <div class="bcc-checkbox">
     <label>
-      {{input type="checkbox" checked=checked}} {{i18n "discourse_bcc.use_bcc"}}
+      {{input type="checkbox" checked=checked}}
+      {{i18n "discourse_bcc.use_bcc"}}
     </label>
   </div>
 {{/if}}
diff --git a/assets/javascripts/discourse/templates/connectors/composer-fields/bcc-checkbox.hbs b/assets/javascripts/discourse/templates/connectors/composer-fields/bcc-checkbox.hbs
index f22ce03..29aa5e0 100644
--- a/assets/javascripts/discourse/templates/connectors/composer-fields/bcc-checkbox.hbs
+++ b/assets/javascripts/discourse/templates/connectors/composer-fields/bcc-checkbox.hbs
@@ -2,4 +2,5 @@
   creatingPrivateMessage=model.creatingPrivateMessage
   targetRecipients=model.targetRecipients
   checked=model.use_bcc
-  targetGroups=model.hasTargetGroups}}
+  targetGroups=model.hasTargetGroups
+}}
diff --git a/package.json b/package.json
index 15db7a3..46742f7 100644
--- a/package.json
+++ b/package.json
@@ -4,9 +4,7 @@
   "author": "Discourse",
   "license": "MIT",
   "devDependencies": {
-    "babel-eslint": "^8.2",
-    "eslint": "^4.19",
-    "prettier": "^1.18.2"
+    "eslint-config-discourse": "^1.1.5"
   },
   "scripts": {
     "preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('NPM is not supported, please use Yarn instead. ')\""
diff --git a/spec/jobs/bcc_post_spec.rb b/spec/jobs/bcc_post_spec.rb
index 09ca685..ec2eef8 100644
--- a/spec/jobs/bcc_post_spec.rb
+++ b/spec/jobs/bcc_post_spec.rb
@@ -1,7 +1,6 @@
 # frozen_string_literal: true
 
 describe ::Jobs::BccPost do
-
   fab!(:sender) { Fabricate(:moderator) }
   fab!(:user0) { Fabricate(:user) }
   fab!(:user1) { Fabricate(:user) }
@@ -37,7 +36,7 @@ describe ::Jobs::BccPost do
       topic_count = Topic.count
 
       ::Jobs::BccPost.new.execute(user_id: sender.id, create_params: create_params.merge(target_emails: 'test@test.com'))
-      
+
       expect(Topic.count).to eq(topic_count + 3)
     end
 
@@ -46,15 +45,14 @@ describe ::Jobs::BccPost do
       topic_count = Topic.count
 
       ::Jobs::BccPost.new.execute(
-        user_id: sender.id, 
+        user_id: sender.id,
         create_params: create_params.merge(
-          target_usernames: nil, 
+          target_usernames: nil,
           target_emails: 'test@test.com,test2@test.com'
         )
       )
-      
+
       expect(Topic.count).to eq(topic_count + 2)
     end
   end
-
 end
diff --git a/spec/requests/post_controller_spec.rb b/spec/requests/post_controller_spec.rb
index c404ad9..94515f9 100644
--- a/spec/requests/post_controller_spec.rb
+++ b/spec/requests/post_controller_spec.rb
@@ -102,6 +102,5 @@ describe PostsController do
         expect(usernames).to match_array([@user0.username, @user1.username])
       end
     end
-
   end
 end
diff --git a/yarn.lock b/yarn.lock
index c8cc358..78b4f51 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,150 +2,216 @@
 # yarn lockfile v1
 
 
-"@babel/code-frame@7.0.0-beta.44":
-  version "7.0.0-beta.44"
-  resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9"
-  integrity sha512-cuAuTTIQ9RqcFRJ/Y8PvTh+paepNcaGxwQwjIDRWPXmzzyAeCO4KqS9ikMvq0MCbRk6GlYKwfzStrcP3/jSL8g==
+"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4":
+  version "7.10.4"
+  resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a"
+  integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==
   dependencies:
-    "@babel/highlight" "7.0.0-beta.44"
+    "@babel/highlight" "^7.10.4"
 
-"@babel/generator@7.0.0-beta.44":
-  version "7.0.0-beta.44"
-  resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42"
-  integrity sha512-5xVb7hlhjGcdkKpMXgicAVgx8syK5VJz193k0i/0sLP6DzE6lRrU1K3B/rFefgdo9LPGMAOOOAWW4jycj07ShQ==

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

GitHub sha: 450ffbc3

This commit appears in #5 which was approved by ZogStriP. It was merged by jjaffeux.