DEV: updates prettier and displays linters/prettifiers version in CI

This commit is contained in:
Joffrey JAFFEUX
2018-06-20 18:34:49 +02:00
committed by GitHub
parent 8126b603e4
commit 2f7960bd2a
8 changed files with 27 additions and 29 deletions

View File

@@ -10,8 +10,7 @@ export default Ember.Route.extend({
if (preloadedLogs && preloadedLogs.length) { if (preloadedLogs && preloadedLogs.length) {
// we need to filter out message like: "[SUCCESS]" // we need to filter out message like: "[SUCCESS]"
// and convert POJOs to Ember Objects // and convert POJOs to Ember Objects
const newLogs = _ const newLogs = _.chain(preloadedLogs)
.chain(preloadedLogs)
.reject(function(log) { .reject(function(log) {
return log.message.length === 0 || log.message[0] === "["; return log.message.length === 0 || log.message[0] === "[";
}) })

View File

@@ -72,16 +72,14 @@ export default Ember.Component.extend(
if (notices.length > 0) { if (notices.length > 0) {
buffer.push( buffer.push(
_ _.map(notices, n => {
.map(notices, n => { var html = `<div class='row'><div class='alert alert-info ${
var html = `<div class='row'><div class='alert alert-info ${ n[1]
n[1] }'>`;
}'>`; if (n[2]) html += n[2];
if (n[2]) html += n[2]; html += `${n[0]}</div></div>`;
html += `${n[0]}</div></div>`; return html;
return html; }).join("")
})
.join("")
); );
} }
}, },

View File

@@ -142,12 +142,12 @@ export function ajax() {
!Discourse.Session.currentProp("csrfToken") !Discourse.Session.currentProp("csrfToken")
) { ) {
promise = new Ember.RSVP.Promise((resolve, reject) => { promise = new Ember.RSVP.Promise((resolve, reject) => {
ajaxObj = $ ajaxObj = $.ajax(Discourse.getURL("/session/csrf"), {
.ajax(Discourse.getURL("/session/csrf"), { cache: false }) cache: false
.done(result => { }).done(result => {
Discourse.Session.currentProp("csrfToken", result.csrf); Discourse.Session.currentProp("csrfToken", result.csrf);
performAjax(resolve, reject); performAjax(resolve, reject);
}); });
}); });
} else { } else {
promise = new Ember.RSVP.Promise(performAjax); promise = new Ember.RSVP.Promise(performAjax);

View File

@@ -68,9 +68,9 @@ export function linkSeenMentions($elem, siteSettings) {
.substr(1) .substr(1)
); );
updateFound($mentions, usernames); updateFound($mentions, usernames);
return _ return _.uniq(usernames).filter(
.uniq(usernames) u => !checked[u] && u.length >= siteSettings.min_username_length
.filter(u => !checked[u] && u.length >= siteSettings.min_username_length); );
} }
return []; return [];
} }

View File

@@ -330,8 +330,7 @@ const TopicTrackingState = Discourse.Model.extend({
}, },
countNew(category_id) { countNew(category_id) {
return _ return _.chain(this.states)
.chain(this.states)
.where(isNew) .where(isNew)
.where( .where(
topic => topic =>
@@ -353,8 +352,7 @@ const TopicTrackingState = Discourse.Model.extend({
}, },
countUnread(category_id) { countUnread(category_id) {
return _ return _.chain(this.states)
.chain(this.states)
.where(isUnread) .where(isUnread)
.where( .where(
topic => topic =>

View File

@@ -103,9 +103,9 @@ export default MultiSelectComponent.extend(Tags, {
}; };
if (selectedTags.length || this.get("blacklist").length) { if (selectedTags.length || this.get("blacklist").length) {
data.selected_tags = _ data.selected_tags = _.uniq(
.uniq(selectedTags.concat(this.get("blacklist"))) selectedTags.concat(this.get("blacklist"))
.slice(0, 100); ).slice(0, 100);
} }
if (!this.get("everyTag")) data.filterForInput = true; if (!this.get("everyTag")) data.filterForInput = true;

View File

@@ -40,6 +40,9 @@ task 'docker:test' do
@good = true @good = true
unless ENV['SKIP_LINT'] unless ENV['SKIP_LINT']
puts "Running linters/prettyfiers" puts "Running linters/prettyfiers"
puts "eslint #{`eslint -v`}"
puts "prettier #{`prettier -v`}"
if ENV["SINGLE_PLUGIN"] if ENV["SINGLE_PLUGIN"]
@good &&= run_or_fail("bundle exec rubocop --parallel plugins/#{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']}") @good &&= run_or_fail("eslint --ext .es6 plugins/#{ENV['SINGLE_PLUGIN']}")

View File

@@ -11,7 +11,7 @@
"chrome-launcher": "^0.10.2", "chrome-launcher": "^0.10.2",
"chrome-remote-interface": "^0.25.6", "chrome-remote-interface": "^0.25.6",
"eslint": "^4.19.1", "eslint": "^4.19.1",
"prettier": "1.13.4", "prettier": "^1.13.0",
"puppeteer": "^1.4.0" "puppeteer": "^1.4.0"
} }
} }