From 2f7960bd2a65d84270953a7c2489e17083e39062 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 20 Jun 2018 18:34:49 +0200 Subject: [PATCH] DEV: updates prettier and displays linters/prettifiers version in CI --- .../admin/routes/admin-backups-logs.js.es6 | 3 +-- .../discourse/components/global-notice.js.es6 | 18 ++++++++---------- .../javascripts/discourse/lib/ajax.js.es6 | 12 ++++++------ .../discourse/lib/link-mentions.js.es6 | 6 +++--- .../models/topic-tracking-state.js.es6 | 6 ++---- .../select-kit/components/tag-chooser.js.es6 | 6 +++--- lib/tasks/docker.rake | 3 +++ package.json | 2 +- 8 files changed, 27 insertions(+), 29 deletions(-) diff --git a/app/assets/javascripts/admin/routes/admin-backups-logs.js.es6 b/app/assets/javascripts/admin/routes/admin-backups-logs.js.es6 index ce0210b1bea..200d33f28e6 100644 --- a/app/assets/javascripts/admin/routes/admin-backups-logs.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-backups-logs.js.es6 @@ -10,8 +10,7 @@ export default Ember.Route.extend({ if (preloadedLogs && preloadedLogs.length) { // we need to filter out message like: "[SUCCESS]" // and convert POJOs to Ember Objects - const newLogs = _ - .chain(preloadedLogs) + const newLogs = _.chain(preloadedLogs) .reject(function(log) { return log.message.length === 0 || log.message[0] === "["; }) diff --git a/app/assets/javascripts/discourse/components/global-notice.js.es6 b/app/assets/javascripts/discourse/components/global-notice.js.es6 index deaeec293ce..327f6aa79af 100644 --- a/app/assets/javascripts/discourse/components/global-notice.js.es6 +++ b/app/assets/javascripts/discourse/components/global-notice.js.es6 @@ -72,16 +72,14 @@ export default Ember.Component.extend( if (notices.length > 0) { buffer.push( - _ - .map(notices, n => { - var html = `
`; - if (n[2]) html += n[2]; - html += `${n[0]}
`; - return html; - }) - .join("") + _.map(notices, n => { + var html = `
`; + if (n[2]) html += n[2]; + html += `${n[0]}
`; + return html; + }).join("") ); } }, diff --git a/app/assets/javascripts/discourse/lib/ajax.js.es6 b/app/assets/javascripts/discourse/lib/ajax.js.es6 index c29e704d2ae..098676437c2 100644 --- a/app/assets/javascripts/discourse/lib/ajax.js.es6 +++ b/app/assets/javascripts/discourse/lib/ajax.js.es6 @@ -142,12 +142,12 @@ export function ajax() { !Discourse.Session.currentProp("csrfToken") ) { promise = new Ember.RSVP.Promise((resolve, reject) => { - ajaxObj = $ - .ajax(Discourse.getURL("/session/csrf"), { cache: false }) - .done(result => { - Discourse.Session.currentProp("csrfToken", result.csrf); - performAjax(resolve, reject); - }); + ajaxObj = $.ajax(Discourse.getURL("/session/csrf"), { + cache: false + }).done(result => { + Discourse.Session.currentProp("csrfToken", result.csrf); + performAjax(resolve, reject); + }); }); } else { promise = new Ember.RSVP.Promise(performAjax); diff --git a/app/assets/javascripts/discourse/lib/link-mentions.js.es6 b/app/assets/javascripts/discourse/lib/link-mentions.js.es6 index fd64d3121f3..c58797d0bfa 100644 --- a/app/assets/javascripts/discourse/lib/link-mentions.js.es6 +++ b/app/assets/javascripts/discourse/lib/link-mentions.js.es6 @@ -68,9 +68,9 @@ export function linkSeenMentions($elem, siteSettings) { .substr(1) ); updateFound($mentions, usernames); - return _ - .uniq(usernames) - .filter(u => !checked[u] && u.length >= siteSettings.min_username_length); + return _.uniq(usernames).filter( + u => !checked[u] && u.length >= siteSettings.min_username_length + ); } return []; } diff --git a/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 b/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 index 59e2df410da..55ea3762083 100644 --- a/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 +++ b/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 @@ -330,8 +330,7 @@ const TopicTrackingState = Discourse.Model.extend({ }, countNew(category_id) { - return _ - .chain(this.states) + return _.chain(this.states) .where(isNew) .where( topic => @@ -353,8 +352,7 @@ const TopicTrackingState = Discourse.Model.extend({ }, countUnread(category_id) { - return _ - .chain(this.states) + return _.chain(this.states) .where(isUnread) .where( topic => diff --git a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 index f8fcae3cbbc..2f2089bc212 100644 --- a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 @@ -103,9 +103,9 @@ export default MultiSelectComponent.extend(Tags, { }; if (selectedTags.length || this.get("blacklist").length) { - data.selected_tags = _ - .uniq(selectedTags.concat(this.get("blacklist"))) - .slice(0, 100); + data.selected_tags = _.uniq( + selectedTags.concat(this.get("blacklist")) + ).slice(0, 100); } if (!this.get("everyTag")) data.filterForInput = true; diff --git a/lib/tasks/docker.rake b/lib/tasks/docker.rake index e2d6f17cdaf..6349bfa7731 100644 --- a/lib/tasks/docker.rake +++ b/lib/tasks/docker.rake @@ -40,6 +40,9 @@ task 'docker:test' do @good = true unless ENV['SKIP_LINT'] puts "Running linters/prettyfiers" + puts "eslint #{`eslint -v`}" + puts "prettier #{`prettier -v`}" + if ENV["SINGLE_PLUGIN"] @good &&= run_or_fail("bundle exec rubocop --parallel plugins/#{ENV["SINGLE_PLUGIN"]}") @good &&= run_or_fail("eslint --ext .es6 plugins/#{ENV['SINGLE_PLUGIN']}") diff --git a/package.json b/package.json index bc918b3eef1..0fc51ebb720 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "chrome-launcher": "^0.10.2", "chrome-remote-interface": "^0.25.6", "eslint": "^4.19.1", - "prettier": "1.13.4", + "prettier": "^1.13.0", "puppeteer": "^1.4.0" } }