Fix Prettier using correct version (1.19.1)

This commit is contained in:
Penar Musaraj 2019-11-15 10:34:26 -05:00
parent 655e610357
commit cc8baa1a7c
26 changed files with 102 additions and 41 deletions

View File

@ -4,7 +4,10 @@ import Backup from "admin/models/backup";
export default Route.extend({
activate() {
this.messageBus.subscribe("/admin/backups", backups =>
this.controller.set("model", backups.map(backup => Backup.create(backup)))
this.controller.set(
"model",
backups.map(backup => Backup.create(backup))
)
);
},

View File

@ -75,9 +75,7 @@ export default Component.extend(
buffer.push(
notices
.map(n => {
var html = `<div class='row'><div class='alert alert-info ${
n[1]
}'>`;
var html = `<div class='row'><div class='alert alert-info ${n[1]}'>`;
if (n[2]) html += n[2];
html += `${n[0]}</div></div>`;
return html;

View File

@ -107,7 +107,7 @@ export default Controller.extend(ModalFunctionality, {
@discourseComputed("canSplitTopic")
canSplitToPM(canSplitTopic) {
return canSplitTopic && (this.currentUser && this.currentUser.admin);
return canSplitTopic && this.currentUser && this.currentUser.admin;
},
actions: {

View File

@ -81,7 +81,10 @@ export default Controller.extend(ModalFunctionality, {
const topics = this.get("model.topics");
// const relistButtonIndex = _buttons.findIndex(b => b.action === 'relistTopics');
this.set("buttons", _buttons.filter(b => b.buttonVisible(topics)));
this.set(
"buttons",
_buttons.filter(b => b.buttonVisible(topics))
);
this.set("modal.modalClass", "topic-bulk-actions-modal small");
this.send("changeBulkTemplate", "modal/bulk-actions-buttons");
},

View File

@ -28,9 +28,11 @@ export default Controller.extend({
@observes("searchTerm")
_searchTermChanged: discourseDebounce(function() {
Invite.findInvitedBy(this.user, this.filter, this.searchTerm).then(
invites => this.set("model", invites)
);
Invite.findInvitedBy(
this.user,
this.filter,
this.searchTerm
).then(invites => this.set("model", invites));
}, 250),
inviteRedeemed: equal("filter", "redeemed"),

View File

@ -49,10 +49,10 @@ export function isPushNotificationsSupported(mobileView) {
if (
!(
"serviceWorker" in navigator &&
(ServiceWorkerRegistration &&
ServiceWorkerRegistration &&
typeof Notification !== "undefined" &&
"showNotification" in ServiceWorkerRegistration.prototype &&
"PushManager" in window)
"PushManager" in window
)
) {
return false;

View File

@ -239,7 +239,7 @@ export default function transformPost(
postAtts.showFlagDelete =
!postAtts.canDelete &&
postAtts.yours &&
(currentUser && !currentUser.staff);
currentUser && !currentUser.staff;
} else {
postAtts.canRecover = postAtts.isDeleted && postAtts.canRecover;
postAtts.canDelete =

View File

@ -652,10 +652,7 @@ const Composer = RestModel.extend({
const replyBlank = isEmpty(this.reply);
const composer = this;
if (
!replyBlank &&
((opts.reply || isEdit(opts.action)) && this.replyDirty)
) {
if (!replyBlank && (opts.reply || isEdit(opts.action)) && this.replyDirty) {
return;
}

View File

@ -53,9 +53,9 @@ Invite.reopenClass({
findInvitedCount(user) {
if (!user) Promise.resolve();
return ajax(userPath(`${user.username_lower}/invited_count.json`)).then(
result => EmberObject.create(result.counts)
);
return ajax(
userPath(`${user.username_lower}/invited_count.json`)
).then(result => EmberObject.create(result.counts));
},
reinviteAll() {

View File

@ -8,7 +8,10 @@ export default RestrictedUserRoute.extend({
const user = this.modelFor("user");
if (this.siteSettings.enable_badges) {
return UserBadge.findByUsername(user.get("username")).then(userBadges => {
user.set("badges", userBadges.map(ub => ub.badge));
user.set(
"badges",
userBadges.map(ub => ub.badge)
);
return user;
});
} else {

View File

@ -19,7 +19,10 @@ createWidget("menu-links", {
const result = [];
result.push(
h("ul.menu-links.columned", links.map(l => h("li", liOpts, l)))
h(
"ul.menu-links.columned",
links.map(l => h("li", liOpts, l))
)
);
result.push(h("div.clearfix"));

View File

@ -211,7 +211,7 @@ createWidget("timeline-scrollarea", {
position.lastRead > 3 &&
Math.abs(position.lastRead - position.current) > 3 &&
Math.abs(position.lastRead - position.total) > 1 &&
(position.lastRead && position.lastRead !== position.total);
position.lastRead && position.lastRead !== position.total;
if (hasBackPosition) {
const lastReadTop = Math.round(

View File

@ -115,7 +115,10 @@ createWidget("user-menu-links", {
return h("ul.menu-links-row", [
links.map(l => h("li.user", this.linkHtml(l))),
h("li.glyphs", glyphs.map(l => this.glyphHtml(l)))
h(
"li.glyphs",
glyphs.map(l => this.glyphHtml(l))
)
]);
},

View File

@ -185,7 +185,10 @@ export function setup(helper) {
if (simpleUrlRegex.test(url)) {
startToken.type = "link_open";
startToken.tag = "a";
startToken.attrs = [["href", url], ["data-bbcode", "true"]];
startToken.attrs = [
["href", url],
["data-bbcode", "true"]
];
startToken.content = "";
startToken.nesting = 1;
@ -214,7 +217,10 @@ export function setup(helper) {
let email = tagInfo.attrs["_default"] || content;
token = state.push("link_open", "a", 1);
token.attrs = [["href", "mailto:" + email], ["data-bbcode", "true"]];
token.attrs = [
["href", "mailto:" + email],
["data-bbcode", "true"]
];
token = state.push("text", "", 0);
token.content = content;
@ -228,7 +234,10 @@ export function setup(helper) {
tag: "img",
replace: function(state, tagInfo, content) {
let token = state.push("image", "img", 0);
token.attrs = [["src", content], ["alt", ""]];
token.attrs = [
["src", content],
["alt", ""]
];
token.children = [];
return true;
}

View File

@ -8,7 +8,10 @@ function addHashtag(buffer, matches, state) {
if (result) {
token = new state.Token("link_open", "a", 1);
token.attrs = [["class", "hashtag"], ["href", result[0]]];
token.attrs = [
["class", "hashtag"],
["href", result[0]]
];
token.block = false;
buffer.push(token);

View File

@ -34,7 +34,10 @@ export default MultiSelectComponent.extend({
},
mutateValues(values) {
this.set("categories", values.map(v => Category.findById(v)));
this.set(
"categories",
values.map(v => Category.findById(v))
);
},
filterComputedContent(computedContent, computedValues, filter) {

View File

@ -132,7 +132,7 @@ export default DropdownSelectBoxComponent.extend({
(action !== REPLY && _topicSnapshot) ||
(action === REPLY &&
_topicSnapshot &&
(options.userAvatar && options.userLink && options.topicLink))
options.userAvatar && options.userLink && options.topicLink)
) {
items.push({
name: I18n.t("composer.composer_actions.reply_to_topic.label"),

View File

@ -54,7 +54,10 @@ export default MultiSelectComponent.extend(TagsMixin, {
},
mutateValues(values) {
this.set("tags", values.filter(v => v));
this.set(
"tags",
values.filter(v => v)
);
},
@discourseComputed("tags")

View File

@ -27,7 +27,10 @@ export default MultiSelectComponent.extend(TagsMixin, {
},
mutateValues(values) {
this.set("tagGroups", values.filter(v => v));
this.set(
"tagGroups",
values.filter(v => v)
);
},
@discourseComputed("tagGroups")

View File

@ -187,7 +187,7 @@ export default Mixin.create({
const offsetBottom = this.element.getBoundingClientRect().bottom;
const windowWidth = $(window).width();
if (this.fullWidthOnMobile && (this.site && this.site.isMobileDevice)) {
if (this.fullWidthOnMobile && this.site && this.site.isMobileDevice) {
const margin = 10;
const relativeLeft =
$(this.element).offset().left - $(window).scrollLeft();

View File

@ -126,5 +126,8 @@ QUnit.test("Group Requests", async assert => {
.trim(),
"denied"
);
assert.deepEqual(requests, [["19", "true"], ["20", undefined]]);
assert.deepEqual(requests, [
["19", "true"],
["20", undefined]
]);
});

View File

@ -11,7 +11,10 @@ moduleForComponent("combo-box", {
componentTest("default", {
template: "{{combo-box content=items}}",
beforeEach() {
this.set("items", [{ id: 1, name: "hello" }, { id: 2, name: "world" }]);
this.set("items", [
{ id: 1, name: "hello" },
{ id: 2, name: "world" }
]);
},
async test(assert) {
@ -43,7 +46,10 @@ componentTest("with valueAttribute", {
componentTest("with nameProperty", {
template: '{{combo-box content=items nameProperty="text"}}',
beforeEach() {
this.set("items", [{ id: 0, text: "hello" }, { id: 1, text: "world" }]);
this.set("items", [
{ id: 0, text: "hello" },
{ id: 1, text: "world" }
]);
},
async test(assert) {

View File

@ -14,7 +14,10 @@ componentTest("with objects and values", {
template: "{{multi-select content=items values=values}}",
beforeEach() {
this.set("items", [{ id: 1, name: "hello" }, { id: 2, name: "world" }]);
this.set("items", [
{ id: 1, name: "hello" },
{ id: 2, name: "world" }
]);
this.set("values", [1, 2]);
},

View File

@ -33,7 +33,10 @@ componentTest("accepts a value by reference", {
beforeEach() {
this.set("value", 1);
this.set("content", [{ id: 1, name: "robin" }, { id: 2, name: "regis" }]);
this.set("content", [
{ id: 1, name: "robin" },
{ id: 2, name: "regis" }
]);
},
async test(assert) {
@ -148,7 +151,10 @@ componentTest("dynamic headerText", {
template: "{{single-select value=1 content=content}}",
beforeEach() {
this.set("content", [{ id: 1, name: "robin" }, { id: 2, name: "regis" }]);
this.set("content", [
{ id: 1, name: "robin" },
{ id: 2, name: "regis" }
]);
},
async test(assert) {
@ -246,7 +252,10 @@ componentTest("supports keyboard events", {
template: "{{single-select content=content filterable=true}}",
beforeEach() {
this.set("content", [{ id: 1, name: "robin" }, { id: 2, name: "regis" }]);
this.set("content", [
{ id: 1, name: "robin" },
{ id: 2, name: "regis" }
]);
},
skip: true,

View File

@ -324,7 +324,10 @@ QUnit.test("canChangeOwner", function(assert) {
this.registry.injection("controller", "currentUser", "current-user:main");
const postStream = {
posts: [{ id: 1, username: "gary" }, { id: 2, username: "lili" }],
posts: [
{ id: 1, username: "gary" },
{ id: 2, username: "lili" }
],
stream: [1, 2]
};

View File

@ -141,7 +141,11 @@ QUnit.test("closestPostNumberFor", assert => {
QUnit.test("closestDaysAgoFor", assert => {
const postStream = buildStream(1231);
postStream.set("timelineLookup", [[1, 10], [3, 8], [5, 1]]);
postStream.set("timelineLookup", [
[1, 10],
[3, 8],
[5, 1]
]);
assert.equal(postStream.closestDaysAgoFor(1), 10);
assert.equal(postStream.closestDaysAgoFor(2), 10);