From 2d541f2e3208b19d4fbb58a2744f032990bb59e3 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 30 Nov 2020 10:24:11 +0100 Subject: [PATCH] Fix lint issues And disable eslint when building in prod mode Signed-off-by: Thomas Citharel --- js/.editorconfig | 2 +- js/.eslintrc.js | 10 +- js/get_union_json.ts | 4 +- js/src/App.vue | 12 +- js/src/apollo/user.ts | 7 +- js/src/apollo/utils.ts | 11 +- .../components/Account/ActorAutoComplete.vue | 15 +- js/src/components/Account/ActorCard.vue | 11 +- js/src/components/Account/Identities.vue | 10 +- js/src/components/Admin/Followers.vue | 63 +++- js/src/components/Admin/Followings.vue | 87 +++-- js/src/components/Comment/Comment.vue | 81 ++++- js/src/components/Comment/CommentTree.vue | 52 ++- .../Discussion/DiscussionComment.vue | 17 +- .../Discussion/DiscussionListItem.vue | 32 +- js/src/components/Editor.vue | 29 +- js/src/components/Editor/Image.ts | 17 +- .../components/Event/AddressAutoComplete.vue | 26 +- js/src/components/Event/DateTimePicker.vue | 10 +- js/src/components/Event/EventCard.vue | 13 +- js/src/components/Event/EventFullDate.vue | 12 +- js/src/components/Event/EventListCard.vue | 93 +++-- js/src/components/Event/EventListViewCard.vue | 41 ++- .../components/Event/EventMinimalistCard.vue | 19 +- .../Event/FullAddressAutoComplete.vue | 25 +- js/src/components/Event/OrganizerPicker.vue | 26 +- .../Event/OrganizerPickerWrapper.vue | 47 ++- .../components/Event/ParticipationButton.vue | 47 ++- js/src/components/Event/ShareEventModal.vue | 20 +- js/src/components/Event/TagInput.vue | 10 +- js/src/components/Footer.vue | 17 +- js/src/components/Group/GroupCard.vue | 4 +- js/src/components/Group/GroupMemberCard.vue | 20 +- js/src/components/Group/GroupPicker.vue | 29 +- .../components/Group/GroupPickerWrapper.vue | 20 +- js/src/components/Group/GroupSection.vue | 6 +- js/src/components/Group/InvitationCard.vue | 17 +- js/src/components/Group/Invitations.vue | 32 +- .../components/Group/JoinGroupWithAccount.vue | 4 +- js/src/components/Map.vue | 18 +- .../Map/Vue2LeafletLocateControl.vue | 5 +- js/src/components/NavBar.vue | 62 +++- .../Participation/ConfirmParticipation.vue | 22 +- .../ParticipationWithAccount.vue | 10 +- .../ParticipationWithoutAccount.vue | 53 ++- .../Participation/UnloggedParticipation.vue | 54 ++- js/src/components/PictureUpload.vue | 8 +- js/src/components/Post/PostElementItem.vue | 42 ++- js/src/components/Post/PostListItem.vue | 3 +- js/src/components/Report/ReportCard.vue | 12 +- js/src/components/Report/ReportModal.vue | 17 +- js/src/components/Resource/FolderItem.vue | 28 +- js/src/components/Resource/ResourceItem.vue | 11 +- .../components/Resource/ResourceSelector.vue | 41 ++- .../Settings/NotificationsOnboarding.vue | 23 +- js/src/components/Settings/SettingsMenu.vue | 53 ++- .../Settings/SettingsOnboarding.vue | 5 +- js/src/components/Todo/CompactTodo.vue | 17 +- js/src/components/Todo/FullTodo.vue | 10 +- js/src/components/User/AuthProvider.vue | 6 +- .../components/Utils/RedirectWithAccount.vue | 22 +- js/src/components/Utils/Subtitle.vue | 3 +- js/src/filters/datetime.ts | 5 +- js/src/filters/index.ts | 6 +- js/src/graphql/actor.ts | 19 +- js/src/graphql/comment.ts | 12 +- js/src/graphql/search.ts | 16 +- js/src/graphql/user.ts | 7 +- js/src/mixins/actor.ts | 4 +- js/src/mixins/event.ts | 55 ++- js/src/mixins/group.ts | 8 +- js/src/mixins/identityEdition.ts | 8 +- js/src/mixins/onboarding.ts | 4 +- js/src/mixins/relay.ts | 13 +- js/src/plugins/dateFns.ts | 5 +- js/src/registerServiceWorker.ts | 4 +- js/src/router/actor.ts | 10 +- js/src/router/discussion.ts | 19 +- js/src/router/error.ts | 4 +- js/src/router/event.ts | 38 ++- js/src/router/groups.ts | 44 ++- js/src/router/index.ts | 40 ++- js/src/router/settings.ts | 102 ++++-- js/src/router/user.ts | 42 ++- .../services/AnonymousParticipationStorage.ts | 53 ++- js/src/types/actor/actor.model.ts | 4 +- js/src/types/address.model.ts | 11 +- js/src/types/discussions.ts | 4 +- js/src/types/event.model.ts | 7 +- js/src/typings/intl.d.ts | 5 +- js/src/typings/tiptap-commands.d.ts | 11 +- js/src/typings/tiptap.d.ts | 8 +- js/src/utils/auth.ts | 25 +- js/src/utils/i18n.ts | 17 +- js/src/utils/image.ts | 8 +- js/src/utils/username.ts | 5 +- js/src/views/About.vue | 14 +- js/src/views/About/AboutInstance.vue | 26 +- js/src/views/Account/IdentityPicker.vue | 7 +- .../views/Account/IdentityPickerWrapper.vue | 17 +- js/src/views/Account/Profile.vue | 13 +- js/src/views/Account/Register.vue | 32 +- .../views/Account/children/EditIdentity.vue | 44 ++- js/src/views/Admin/AdminGroupProfile.vue | 138 ++++++-- js/src/views/Admin/AdminProfile.vue | 64 +++- js/src/views/Admin/AdminUserProfile.vue | 34 +- js/src/views/Admin/Dashboard.vue | 57 +++- js/src/views/Admin/Follows.vue | 12 +- js/src/views/Admin/GroupProfiles.vue | 19 +- js/src/views/Admin/Profiles.vue | 19 +- js/src/views/Admin/Settings.vue | 103 ++++-- js/src/views/Admin/Users.vue | 20 +- js/src/views/Discussions/Create.vue | 7 +- js/src/views/Discussions/Discussion.vue | 49 ++- js/src/views/Discussions/DiscussionsList.vue | 10 +- js/src/views/Event/Edit.vue | 135 ++++++-- js/src/views/Event/Event.vue | 319 ++++++++++++++---- js/src/views/Event/EventList.vue | 8 +- js/src/views/Event/GroupEvents.vue | 15 +- js/src/views/Event/MyEvents.vue | 61 ++-- js/src/views/Event/Participants.vue | 77 ++++- js/src/views/Group/Create.vue | 18 +- js/src/views/Group/Group.vue | 155 +++++++-- js/src/views/Group/GroupMembers.vue | 97 +++++- js/src/views/Group/GroupSettings.vue | 19 +- js/src/views/Group/MyGroups.vue | 19 +- js/src/views/Group/Settings.vue | 5 +- js/src/views/Home.vue | 128 +++++-- js/src/views/Moderation/Logs.vue | 113 +++++-- js/src/views/Moderation/Report.vue | 90 ++++- js/src/views/Moderation/ReportList.vue | 51 ++- js/src/views/PageNotFound.vue | 25 +- js/src/views/Posts/Edit.vue | 60 +++- js/src/views/Posts/List.vue | 4 +- js/src/views/Posts/Post.vue | 30 +- js/src/views/Resources/ResourceFolder.vue | 88 +++-- js/src/views/Search.vue | 42 ++- js/src/views/Settings.vue | 3 +- js/src/views/Settings/AccountSettings.vue | 93 +++-- js/src/views/Settings/Notifications.vue | 44 ++- js/src/views/Settings/Preferences.vue | 71 ++-- js/src/views/Todos/Todo.vue | 11 +- js/src/views/Todos/TodoList.vue | 8 +- js/src/views/Todos/TodoLists.vue | 14 +- js/src/views/User/EmailValidate.vue | 4 +- js/src/views/User/Login.vue | 60 +++- js/src/views/User/PasswordReset.vue | 10 +- js/src/views/User/ProviderValidation.vue | 16 +- js/src/views/User/Register.vue | 100 ++++-- js/src/views/User/ResendConfirmation.vue | 26 +- js/src/views/User/SendPasswordReset.vue | 32 +- js/src/views/User/SettingsOnboard.vue | 9 +- js/src/views/User/Validate.vue | 18 +- js/src/vue-apollo.ts | 74 ++-- js/tests/e2e/plugins/index.js | 6 +- js/tests/e2e/specs/dashboard.js | 9 +- js/tests/e2e/specs/event.js | 14 +- js/tests/e2e/specs/login.js | 36 +- js/tests/e2e/specs/register.js | 31 +- js/tests/e2e/support/commands.js | 17 +- js/vue.config.js | 9 +- 161 files changed, 3869 insertions(+), 1236 deletions(-) diff --git a/js/.editorconfig b/js/.editorconfig index c24743d00..446bb3e15 100644 --- a/js/.editorconfig +++ b/js/.editorconfig @@ -4,4 +4,4 @@ indent_size = 2 end_of_line = lf trim_trailing_whitespace = true insert_final_newline = true -max_line_length = 100 +max_line_length = 80 diff --git a/js/.eslintrc.js b/js/.eslintrc.js index d29e98c47..939c4df9d 100644 --- a/js/.eslintrc.js +++ b/js/.eslintrc.js @@ -38,8 +38,11 @@ module.exports = { "error", { ignoreStrings: true, + ignoreHTMLTextContents: true, + ignoreTemplateLiterals: true, + ignoreComments: true, template: 170, - code: 100, + code: 80, }, ], "prettier/prettier": "error", @@ -56,7 +59,10 @@ module.exports = { overrides: [ { - files: ["**/__tests__/*.{j,t}s?(x)", "**/tests/unit/**/*.spec.{j,t}s?(x)"], + files: [ + "**/__tests__/*.{j,t}s?(x)", + "**/tests/unit/**/*.spec.{j,t}s?(x)", + ], env: { mocha: true, }, diff --git a/js/get_union_json.ts b/js/get_union_json.ts index dc3899bb8..287cc9982 100644 --- a/js/get_union_json.ts +++ b/js/get_union_json.ts @@ -24,7 +24,9 @@ fetch(`http://localhost:4000/api`, { .then((result) => result.json()) .then((result) => { // here we're filtering out any type information unrelated to unions or interfaces - const filteredData = result.data.__schema.types.filter((type) => type.possibleTypes !== null); + const filteredData = result.data.__schema.types.filter( + (type) => type.possibleTypes !== null + ); result.data.__schema.types = filteredData; fs.writeFile("./fragmentTypes.json", JSON.stringify(result.data), (err) => { if (err) { diff --git a/js/src/App.vue b/js/src/App.vue index 0817426e7..a0b85b0f8 100644 --- a/js/src/App.vue +++ b/js/src/App.vue @@ -32,8 +32,16 @@ diff --git a/js/src/components/Map.vue b/js/src/components/Map.vue index 00ebaa3a3..0d52fd943 100644 --- a/js/src/components/Map.vue +++ b/js/src/components/Map.vue @@ -8,7 +8,11 @@ @click="clickMap" @update:zoom="updateZoom" > - + + - {{ line }}
+ {{ line }}
@@ -51,7 +57,10 @@ export default class Map extends Vue { @Prop({ type: String, required: true }) coords!: string; - @Prop({ type: Object, required: false }) marker!: { text: string | string[]; icon: string }; + @Prop({ type: Object, required: false }) marker!: { + text: string | string[]; + icon: string; + }; @Prop({ type: Object, required: false }) options!: Record; @@ -125,7 +134,8 @@ export default class Map extends Vue { get attribution(): string { return ( - this.config.maps.tiles.attribution || (this.$t("© The OpenStreetMap Contributors") as string) + this.config.maps.tiles.attribution || + (this.$t("© The OpenStreetMap Contributors") as string) ); } } diff --git a/js/src/components/Map/Vue2LeafletLocateControl.vue b/js/src/components/Map/Vue2LeafletLocateControl.vue index df2de381e..c7afaad7e 100644 --- a/js/src/components/Map/Vue2LeafletLocateControl.vue +++ b/js/src/components/Map/Vue2LeafletLocateControl.vue @@ -23,7 +23,10 @@ import { Component, Prop, Vue } from "vue-property-decorator"; }, }) export default class Vue2LeafletLocateControl extends Vue { - @Prop({ type: Object, default: () => ({}) }) options!: Record; + @Prop({ type: Object, default: () => ({}) }) options!: Record< + string, + unknown + >; @Prop({ type: Boolean, default: true }) visible = true; diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue index 6846f78eb..53fdfcfc4 100644 --- a/js/src/components/NavBar.vue +++ b/js/src/components/NavBar.vue @@ -1,7 +1,15 @@ @@ -187,7 +195,9 @@ export default class CreateGroup extends mixins(IdentityEditionMixin) { } private handleError(err: any) { - this.errors.push(...err.graphQLErrors.map(({ message }: { message: string }) => message)); + this.errors.push( + ...err.graphQLErrors.map(({ message }: { message: string }) => message) + ); } } diff --git a/js/src/views/Group/Group.vue b/js/src/views/Group/Group.vue index 858ef5827..616a494dd 100644 --- a/js/src/views/Group/Group.vue +++ b/js/src/views/Group/Group.vue @@ -4,7 +4,9 @@