From ae5a033469bce7d2a054ff9c9e5bc09221388b77 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 14 Jun 2016 16:11:45 +0800 Subject: [PATCH] Start checking eslint in plugins. --- .travis.yml | 1 + .../components/poll-results-number-voters.js.es6 | 1 - .../components/poll-results-standard-voters.js.es6 | 1 - .../javascripts/controllers/poll-ui-builder.js.es6 | 14 ++++---------- .../assets/javascripts/controllers/poll.js.es6 | 1 - plugins/poll/assets/javascripts/views/poll.js.es6 | 2 -- 6 files changed, 5 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43ef9e816..6a2ca9143 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,7 @@ before_install: - eslint app/assets/javascripts - eslint --ext .es6 app/assets/javascripts - eslint --ext .es6 test/javascripts + - eslint --ext .es6 plugins/**/assets/javascripts - eslint test/javascripts before_script: diff --git a/plugins/poll/assets/javascripts/components/poll-results-number-voters.js.es6 b/plugins/poll/assets/javascripts/components/poll-results-number-voters.js.es6 index e75ad84cb..412cc8acd 100644 --- a/plugins/poll/assets/javascripts/components/poll-results-number-voters.js.es6 +++ b/plugins/poll/assets/javascripts/components/poll-results-number-voters.js.es6 @@ -1,5 +1,4 @@ import computed from 'ember-addons/ember-computed-decorators'; -import User from 'discourse/models/user'; import PollVoters from 'discourse/plugins/poll/components/poll-voters'; export default PollVoters.extend({ diff --git a/plugins/poll/assets/javascripts/components/poll-results-standard-voters.js.es6 b/plugins/poll/assets/javascripts/components/poll-results-standard-voters.js.es6 index 80dc1ef8b..50332f4ae 100644 --- a/plugins/poll/assets/javascripts/components/poll-results-standard-voters.js.es6 +++ b/plugins/poll/assets/javascripts/components/poll-results-standard-voters.js.es6 @@ -1,5 +1,4 @@ import computed from 'ember-addons/ember-computed-decorators'; -import User from 'discourse/models/user'; import PollVoters from 'discourse/plugins/poll/components/poll-voters'; export default PollVoters.extend({ diff --git a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 index 6d10e459d..ce139cd45 100644 --- a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 +++ b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 @@ -70,7 +70,6 @@ export default Ember.Controller.extend({ @computed("isMultiple", "isNumber", "pollOptionsCount", "pollMin", "pollStep") pollMaxOptions(isMultiple, isNumber, count, pollMin, pollStep) { if (!isMultiple && !isNumber) return; - var range = []; const pollMinInt = parseInt(pollMin); if (isMultiple) { @@ -84,7 +83,6 @@ export default Ember.Controller.extend({ @computed("isNumber", "pollMax") pollStepOptions(isNumber, pollMax) { if (!isNumber) return; - return this._comboboxOptions(1, parseInt(pollMax) + 1); }, @@ -99,7 +97,7 @@ export default Ember.Controller.extend({ if (pollMax) pollHeader += ` max=${pollMax}`; if (isNumber) pollHeader += ` step=${pollStep}`; if (publicPoll) pollHeader += ' public=true'; - pollHeader += ']' + pollHeader += ']'; output += `${pollHeader}\n`; if (pollOptions.length > 0 && !isNumber) { @@ -112,11 +110,7 @@ export default Ember.Controller.extend({ @computed("pollOptionsCount", "isNumber") disableInsert(count, isNumber) { - if (isNumber) { - return false; - } else { - return count < 2; - } + return isNumber ? false : (count < 2); }, @computed("disableInsert") @@ -132,8 +126,8 @@ export default Ember.Controller.extend({ _comboboxOptions(start_index, end_index) { return _.range(start_index, end_index).map(number => { - return { value: number, name: number } - }) + return { value: number, name: number }; + }); }, _setupPoll() { diff --git a/plugins/poll/assets/javascripts/controllers/poll.js.es6 b/plugins/poll/assets/javascripts/controllers/poll.js.es6 index 841a3beb8..acf63314c 100644 --- a/plugins/poll/assets/javascripts/controllers/poll.js.es6 +++ b/plugins/poll/assets/javascripts/controllers/poll.js.es6 @@ -147,7 +147,6 @@ export default Ember.Controller.extend({ }).then(results => { const poll = results.poll; const votes = results.vote; - const currentUser = this.currentUser; this.setProperties({ vote: votes, showResults: true }); this.set("model", Em.Object.create(poll)); diff --git a/plugins/poll/assets/javascripts/views/poll.js.es6 b/plugins/poll/assets/javascripts/views/poll.js.es6 index ac739b3f4..c9d6e632e 100644 --- a/plugins/poll/assets/javascripts/views/poll.js.es6 +++ b/plugins/poll/assets/javascripts/views/poll.js.es6 @@ -1,5 +1,3 @@ -import { on } from "ember-addons/ember-computed-decorators"; - export default Em.View.extend({ templateName: "poll", classNames: ["poll"],