From 0e15abfc26311196996eda9888b4120de5f73339 Mon Sep 17 00:00:00 2001
From: Thomas Citharel <tcit@tcit.fr>
Date: Mon, 17 May 2021 19:01:08 +0200
Subject: [PATCH] Lint files with prettier

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
---
 js/src/components/Editor/Image.ts         |  3 +-
 js/src/components/Editor/Mention.ts       |  3 +-
 js/src/graphql/actor.ts                   |  8 ++---
 js/src/graphql/comment.ts                 |  4 +--
 js/src/graphql/discussion.ts              |  2 +-
 js/src/graphql/event.ts                   |  8 ++---
 js/src/graphql/followers.ts               |  2 +-
 js/src/graphql/group.ts                   |  4 +--
 js/src/graphql/member.ts                  |  2 +-
 js/src/mixins/identityEdition.ts          |  5 ++-
 js/src/views/Admin/AdminGroupProfile.vue  | 18 +++++-----
 js/src/views/Event/Edit.vue               |  8 +++--
 js/src/views/Event/Event.vue              |  3 +-
 js/src/views/Resources/ResourceFolder.vue |  7 ++--
 js/src/views/Settings/AccountSettings.vue |  5 ++-
 js/src/views/Settings/Notifications.vue   |  6 ++--
 js/tests/e2e/support/commands.js          | 40 +++++++++++------------
 js/tests/unit/specs/mocks/event.ts        |  9 ++---
 18 files changed, 72 insertions(+), 65 deletions(-)

diff --git a/js/src/components/Editor/Image.ts b/js/src/components/Editor/Image.ts
index 8ebd17f85..653fd8c9c 100644
--- a/js/src/components/Editor/Image.ts
+++ b/js/src/components/Editor/Image.ts
@@ -60,7 +60,8 @@ const CustomImage = Image.extend({
                 top: realEvent.clientY,
               });
               if (!coordinates) return false;
-              const client = apolloProvider.defaultClient as ApolloClient<NormalizedCacheObject>;
+              const client =
+                apolloProvider.defaultClient as ApolloClient<NormalizedCacheObject>;
 
               try {
                 images.forEach(async (image) => {
diff --git a/js/src/components/Editor/Mention.ts b/js/src/components/Editor/Mention.ts
index b025e49ed..dbb6f809e 100644
--- a/js/src/components/Editor/Mention.ts
+++ b/js/src/components/Editor/Mention.ts
@@ -8,7 +8,8 @@ import apolloProvider from "@/vue-apollo";
 import { IPerson } from "@/types/actor";
 import pDebounce from "p-debounce";
 
-const client = apolloProvider.defaultClient as ApolloClient<NormalizedCacheObject>;
+const client =
+  apolloProvider.defaultClient as ApolloClient<NormalizedCacheObject>;
 
 const fetchItems = async (query: string): Promise<IPerson[]> => {
   const result = await client.query({
diff --git a/js/src/graphql/actor.ts b/js/src/graphql/actor.ts
index 197fbd25a..68f08d5f2 100644
--- a/js/src/graphql/actor.ts
+++ b/js/src/graphql/actor.ts
@@ -1,7 +1,7 @@
 import gql from "graphql-tag";
 
 export const FETCH_PERSON = gql`
-  query($username: String!) {
+  query ($username: String!) {
     fetchPerson(preferredUsername: $username) {
       id
       url
@@ -37,7 +37,7 @@ export const FETCH_PERSON = gql`
 `;
 
 export const GET_PERSON = gql`
-  query(
+  query (
     $actorId: ID!
     $organizedEventsPage: Int
     $organizedEventsLimit: Int
@@ -433,7 +433,7 @@ export const PERSON_MEMBERSHIP_GROUP = gql`
 `;
 
 export const GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED = gql`
-  subscription($actorId: ID!, $group: String!) {
+  subscription ($actorId: ID!, $group: String!) {
     groupMembershipChanged(personId: $actorId, group: $group) {
       id
       memberships {
@@ -522,7 +522,7 @@ export const DELETE_PERSON = gql`
  * Prefer CREATE_PERSON when creating another identity
  */
 export const REGISTER_PERSON = gql`
-  mutation(
+  mutation (
     $preferredUsername: String!
     $name: String!
     $summary: String!
diff --git a/js/src/graphql/comment.ts b/js/src/graphql/comment.ts
index 06b6d7a28..ce4b2ce2e 100644
--- a/js/src/graphql/comment.ts
+++ b/js/src/graphql/comment.ts
@@ -46,7 +46,7 @@ export const COMMENT_RECURSIVE_FRAGMENT = gql`
 `;
 
 export const FETCH_THREAD_REPLIES = gql`
-  query($threadId: ID!) {
+  query ($threadId: ID!) {
     thread(id: $threadId) {
       ...CommentRecursive
     }
@@ -55,7 +55,7 @@ export const FETCH_THREAD_REPLIES = gql`
 `;
 
 export const COMMENTS_THREADS = gql`
-  query($eventUUID: UUID!) {
+  query ($eventUUID: UUID!) {
     event(uuid: $eventUUID) {
       id
       uuid
diff --git a/js/src/graphql/discussion.ts b/js/src/graphql/discussion.ts
index ea3093b25..1d96a0d01 100644
--- a/js/src/graphql/discussion.ts
+++ b/js/src/graphql/discussion.ts
@@ -150,7 +150,7 @@ export const DELETE_DISCUSSION = gql`
 `;
 
 export const DISCUSSION_COMMENT_CHANGED = gql`
-  subscription($slug: String!) {
+  subscription ($slug: String!) {
     discussionCommentChanged(slug: $slug) {
       id
       lastComment {
diff --git a/js/src/graphql/event.ts b/js/src/graphql/event.ts
index 8302ca51c..f231fe9e3 100644
--- a/js/src/graphql/event.ts
+++ b/js/src/graphql/event.ts
@@ -177,7 +177,7 @@ export const FETCH_EVENT = gql`
 `;
 
 export const FETCH_EVENT_BASIC = gql`
-  query($uuid: UUID!) {
+  query ($uuid: UUID!) {
     event(uuid: $uuid) {
       id
       uuid
@@ -551,7 +551,7 @@ export const PARTICIPANTS = gql`
 `;
 
 export const EVENT_PERSON_PARTICIPATION = gql`
-  query($actorId: ID!, $eventId: ID!) {
+  query ($actorId: ID!, $eventId: ID!) {
     person(id: $actorId) {
       id
       participations(eventId: $eventId) {
@@ -572,7 +572,7 @@ export const EVENT_PERSON_PARTICIPATION = gql`
 `;
 
 export const EVENT_PERSON_PARTICIPATION_SUBSCRIPTION_CHANGED = gql`
-  subscription($actorId: ID!, $eventId: ID!) {
+  subscription ($actorId: ID!, $eventId: ID!) {
     eventPersonParticipationChanged(personId: $actorId) {
       id
       participations(eventId: $eventId) {
@@ -593,7 +593,7 @@ export const EVENT_PERSON_PARTICIPATION_SUBSCRIPTION_CHANGED = gql`
 `;
 
 export const FETCH_GROUP_EVENTS = gql`
-  query(
+  query (
     $name: String!
     $afterDateTime: DateTime
     $beforeDateTime: DateTime
diff --git a/js/src/graphql/followers.ts b/js/src/graphql/followers.ts
index 660c2e7db..48f4f0abc 100644
--- a/js/src/graphql/followers.ts
+++ b/js/src/graphql/followers.ts
@@ -1,7 +1,7 @@
 import gql from "graphql-tag";
 
 export const GROUP_FOLLOWERS = gql`
-  query(
+  query (
     $name: String!
     $followersPage: Int
     $followersLimit: Int
diff --git a/js/src/graphql/group.ts b/js/src/graphql/group.ts
index cae4c7fa3..bb5f23dca 100644
--- a/js/src/graphql/group.ts
+++ b/js/src/graphql/group.ts
@@ -188,7 +188,7 @@ export const GROUP_FIELDS_FRAGMENTS = gql`
 `;
 
 export const FETCH_GROUP = gql`
-  query(
+  query (
     $name: String!
     $afterDateTime: DateTime
     $beforeDateTime: DateTime
@@ -206,7 +206,7 @@ export const FETCH_GROUP = gql`
 `;
 
 export const GET_GROUP = gql`
-  query(
+  query (
     $id: ID!
     $afterDateTime: DateTime
     $beforeDateTime: DateTime
diff --git a/js/src/graphql/member.ts b/js/src/graphql/member.ts
index 02b928e6c..305ae7239 100644
--- a/js/src/graphql/member.ts
+++ b/js/src/graphql/member.ts
@@ -55,7 +55,7 @@ export const REJECT_INVITATION = gql`
 `;
 
 export const GROUP_MEMBERS = gql`
-  query($name: String!, $roles: String, $page: Int, $limit: Int) {
+  query ($name: String!, $roles: String, $page: Int, $limit: Int) {
     group(preferredUsername: $name) {
       id
       url
diff --git a/js/src/mixins/identityEdition.ts b/js/src/mixins/identityEdition.ts
index 5602529d1..246b423ce 100644
--- a/js/src/mixins/identityEdition.ts
+++ b/js/src/mixins/identityEdition.ts
@@ -14,9 +14,8 @@ export default class IdentityEditionMixin extends Mixins(Vue) {
     );
 
     if (this.identity.preferredUsername === oldUsername) {
-      this.identity.preferredUsername = IdentityEditionMixin.convertToUsername(
-        newDisplayName
-      );
+      this.identity.preferredUsername =
+        IdentityEditionMixin.convertToUsername(newDisplayName);
     }
 
     this.oldDisplayName = newDisplayName;
diff --git a/js/src/views/Admin/AdminGroupProfile.vue b/js/src/views/Admin/AdminGroupProfile.vue
index 74087dcc6..33d22c198 100644
--- a/js/src/views/Admin/AdminGroupProfile.vue
+++ b/js/src/views/Admin/AdminGroupProfile.vue
@@ -344,14 +344,16 @@ export default class AdminGroupProfile extends Vue {
   }
 
   confirmSuspendProfile(): void {
-    const message = (this.group.domain
-      ? this.$t(
-          "Are you sure you want to <b>suspend</b> this group? As this group originates from instance {instance}, this will only remove local members and delete the local data, as well as rejecting all the future data.",
-          { instance: this.group.domain }
-        )
-      : this.$t(
-          "Are you sure you want to <b>suspend</b> this group? All members - including remote ones - will be notified and removed from the group, and <b>all of the group data (events, posts, discussions, todos…) will be irretrievably destroyed</b>."
-        )) as string;
+    const message = (
+      this.group.domain
+        ? this.$t(
+            "Are you sure you want to <b>suspend</b> this group? As this group originates from instance {instance}, this will only remove local members and delete the local data, as well as rejecting all the future data.",
+            { instance: this.group.domain }
+          )
+        : this.$t(
+            "Are you sure you want to <b>suspend</b> this group? All members - including remote ones - will be notified and removed from the group, and <b>all of the group data (events, posts, discussions, todos…) will be irretrievably destroyed</b>."
+          )
+    ) as string;
 
     this.$buefy.dialog.confirm({
       title: this.$t("Suspend group") as string,
diff --git a/js/src/views/Event/Edit.vue b/js/src/views/Event/Edit.vue
index fc73ace85..98f012837 100644
--- a/js/src/views/Event/Edit.vue
+++ b/js/src/views/Event/Edit.vue
@@ -774,9 +774,11 @@ export default class EditEvent extends Vue {
   get updateEventMessage(): string {
     if (this.unmodifiedEvent.draft && !this.event.draft)
       return this.$i18n.t("The event has been updated and published") as string;
-    return (this.event.draft
-      ? this.$i18n.t("The draft event has been updated")
-      : this.$i18n.t("The event has been updated")) as string;
+    return (
+      this.event.draft
+        ? this.$i18n.t("The draft event has been updated")
+        : this.$i18n.t("The event has been updated")
+    ) as string;
   }
 
   private handleError(err: any) {
diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue
index fac4f62b6..9dbe00338 100755
--- a/js/src/views/Event/Event.vue
+++ b/js/src/views/Event/Event.vue
@@ -874,7 +874,8 @@ export default class Event extends EventMixin {
 
     try {
       if (window.isSecureContext) {
-        this.anonymousParticipation = await this.anonymousParticipationConfirmed();
+        this.anonymousParticipation =
+          await this.anonymousParticipationConfirmed();
       }
     } catch (e) {
       if (e instanceof AnonymousParticipationNotFoundError) {
diff --git a/js/src/views/Resources/ResourceFolder.vue b/js/src/views/Resources/ResourceFolder.vue
index 645b03ffb..1ae5a4e98 100644
--- a/js/src/views/Resources/ResourceFolder.vue
+++ b/js/src/views/Resources/ResourceFolder.vue
@@ -562,9 +562,10 @@ export default class Resources extends Mixins(ResourceMixin) {
           const updatedResource: IResource = data.updateResource;
 
           // eslint-disable-next-line vue/max-len
-          oldParentCachedResource.children.elements = oldParentCachedResource.children.elements.filter(
-            (cachedResource) => cachedResource.id !== updatedResource.id
-          );
+          oldParentCachedResource.children.elements =
+            oldParentCachedResource.children.elements.filter(
+              (cachedResource) => cachedResource.id !== updatedResource.id
+            );
 
           store.writeQuery({
             query: GET_RESOURCE,
diff --git a/js/src/views/Settings/AccountSettings.vue b/js/src/views/Settings/AccountSettings.vue
index 3702a3356..a4c3ee31c 100644
--- a/js/src/views/Settings/AccountSettings.vue
+++ b/js/src/views/Settings/AccountSettings.vue
@@ -155,7 +155,10 @@
             <div class="container">
               <div class="columns">
                 <div
-                  class="column is-one-third-desktop is-offset-one-third-desktop"
+                  class="
+                    column
+                    is-one-third-desktop is-offset-one-third-desktop
+                  "
                 >
                   <h1 class="title">
                     {{ $t("Deleting your Mobilizon account") }}
diff --git a/js/src/views/Settings/Notifications.vue b/js/src/views/Settings/Notifications.vue
index c6e697b1d..e5250e227 100644
--- a/js/src/views/Settings/Notifications.vue
+++ b/js/src/views/Settings/Notifications.vue
@@ -251,8 +251,10 @@ export default class Notifications extends Vue {
     if (this.loggedUser && this.loggedUser.settings) {
       this.notificationOnDay = this.loggedUser.settings.notificationOnDay;
       this.notificationEachWeek = this.loggedUser.settings.notificationEachWeek;
-      this.notificationBeforeEvent = this.loggedUser.settings.notificationBeforeEvent;
-      this.notificationPendingParticipation = this.loggedUser.settings.notificationPendingParticipation;
+      this.notificationBeforeEvent =
+        this.loggedUser.settings.notificationBeforeEvent;
+      this.notificationPendingParticipation =
+        this.loggedUser.settings.notificationPendingParticipation;
     }
   }
 
diff --git a/js/tests/e2e/support/commands.js b/js/tests/e2e/support/commands.js
index 8268b7ee3..442fb374e 100644
--- a/js/tests/e2e/support/commands.js
+++ b/js/tests/e2e/support/commands.js
@@ -106,29 +106,27 @@ const decreaseFetches = () => {
   Cypress.env("fetchCount", count - 1);
 };
 
-const buildTrackableFetchWithSessionId = (fetch) => (
-  fetchUrl,
-  fetchOptions
-) => {
-  const { headers } = fetchOptions;
-  const modifiedHeaders = {
-    "x-session-id": Cypress.env("sessionId"),
-    ...headers,
+const buildTrackableFetchWithSessionId =
+  (fetch) => (fetchUrl, fetchOptions) => {
+    const { headers } = fetchOptions;
+    const modifiedHeaders = {
+      "x-session-id": Cypress.env("sessionId"),
+      ...headers,
+    };
+
+    const modifiedOptions = { ...fetchOptions, headers: modifiedHeaders };
+
+    return fetch(fetchUrl, modifiedOptions)
+      .then((result) => {
+        decreaseFetches();
+        return Promise.resolve(result);
+      })
+      .catch((result) => {
+        decreaseFetches();
+        return Promise.reject(result);
+      });
   };
 
-  const modifiedOptions = { ...fetchOptions, headers: modifiedHeaders };
-
-  return fetch(fetchUrl, modifiedOptions)
-    .then((result) => {
-      decreaseFetches();
-      return Promise.resolve(result);
-    })
-    .catch((result) => {
-      decreaseFetches();
-      return Promise.reject(result);
-    });
-};
-
 Cypress.on("window:before:load", (win) => {
   cy.stub(win, "fetch", buildTrackableFetchWithSessionId(fetch));
 });
diff --git a/js/tests/unit/specs/mocks/event.ts b/js/tests/unit/specs/mocks/event.ts
index 5d74e8a8b..abe00d4a4 100644
--- a/js/tests/unit/specs/mocks/event.ts
+++ b/js/tests/unit/specs/mocks/event.ts
@@ -74,8 +74,7 @@ export const eventCommentThreadsMock = {
           __typename: "Comment",
           id: "2",
           uuid: "e37910ea-fd5a-4756-9679-00971f3f4107",
-          url:
-            "https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-00971f3f4107",
+          url: "https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-00971f3f4107",
           text: "my comment text",
           local: true,
           visibility: "PUBLIC",
@@ -100,8 +99,7 @@ export const eventCommentThreadsMock = {
           __typename: "Comment",
           id: "29",
           uuid: "e37910ea-fd5a-4756-9679-01171f3f4107",
-          url:
-            "https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-01171f3f4107",
+          url: "https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-01171f3f4107",
           text: "a second comment",
           local: true,
           visibility: "PUBLIC",
@@ -139,8 +137,7 @@ export const newCommentForEventResponse: DataMock = {
       __typename: "Comment",
       id: "79",
       uuid: "e37910ea-fd5a-4756-9679-01171f3f4444",
-      url:
-        "https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-01171f3f4444",
+      url: "https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-01171f3f4444",
       text: newCommentForEventMock.text,
       local: true,
       visibility: "PUBLIC",