From 8ee9a536e1833ac9a39f0593b9ef35e4e6ef5280 Mon Sep 17 00:00:00 2001 From: Georg Krause Date: Mon, 6 Dec 2021 11:35:20 +0100 Subject: [PATCH] Lint the frontend code --- .gitlab-ci.yml | 5 +- front/.eslintrc.js | 2 + front/package.json | 2 +- front/src/EmbedFrame.vue | 430 +++++++----- front/src/audio/backend.js | 4 +- front/src/audio/volume.js | 28 +- front/src/components/Footer.vue | 217 ++++-- front/src/components/Home.vue | 314 ++++++--- front/src/components/Logo.vue | 47 +- front/src/components/LogoText.vue | 17 +- front/src/components/PageNotFound.vue | 36 +- front/src/components/Pagination.vue | 65 +- front/src/components/Queue.vue | 397 +++++++---- front/src/components/RemoteSearchForm.vue | 255 ++++--- front/src/components/ServiceMessages.vue | 8 +- front/src/components/SetInstanceModal.vue | 184 ++++-- front/src/components/ShortcutsModal.vue | 69 +- front/src/components/admin/SettingsGroup.vue | 200 ++++-- .../components/admin/SignupFormBuilder.vue | 159 +++-- front/src/components/audio/ArtistLabel.vue | 25 +- front/src/components/audio/ChannelCard.vue | 73 ++- front/src/components/audio/ChannelEntries.vue | 78 ++- .../src/components/audio/ChannelEntryCard.vue | 89 ++- front/src/components/audio/ChannelForm.vue | 299 ++++++--- .../src/components/audio/ChannelSerieCard.vue | 57 +- front/src/components/audio/ChannelSeries.vue | 70 +- front/src/components/audio/ChannelsWidget.vue | 50 +- front/src/components/audio/EmbedWizard.vue | 97 ++- .../components/audio/LibraryFollowButton.vue | 33 +- front/src/components/audio/PlayButton.vue | 189 ++++-- front/src/components/audio/Player.vue | 495 ++++++++------ front/src/components/audio/Search.vue | 90 ++- front/src/components/audio/SearchBar.vue | 97 +-- front/src/components/audio/VolumeControl.vue | 61 +- front/src/components/audio/album/Card.vue | 45 +- front/src/components/audio/album/Widget.vue | 95 ++- front/src/components/audio/artist/Card.vue | 63 +- front/src/components/audio/artist/Widget.vue | 90 ++- .../components/audio/podcast/MobileRow.vue | 115 ++-- front/src/components/audio/podcast/Row.vue | 99 +-- front/src/components/audio/podcast/Table.vue | 89 +-- .../src/components/audio/track/MobileRow.vue | 96 ++- .../components/audio/track/PlayIndicator.vue | 10 +- front/src/components/audio/track/Row.vue | 141 ++-- front/src/components/audio/track/Table.vue | 194 +++--- front/src/components/audio/track/Widget.vue | 160 +++-- front/src/components/auth/ApplicationEdit.vue | 84 ++- front/src/components/auth/ApplicationForm.vue | 183 ++++-- front/src/components/auth/ApplicationNew.vue | 36 +- front/src/components/auth/Authorize.vue | 216 ++++-- front/src/components/auth/LoginForm.vue | 122 ++-- front/src/components/auth/Logout.vue | 52 +- front/src/components/auth/Plugin.vue | 195 ++++-- front/src/components/auth/SignupForm.vue | 227 ++++--- .../src/components/auth/SubsonicTokenForm.vue | 187 ++++-- front/src/components/channels/AlbumForm.vue | 63 +- front/src/components/channels/AlbumModal.vue | 44 +- front/src/components/channels/AlbumSelect.vue | 57 +- .../src/components/channels/LicenseSelect.vue | 57 +- .../components/channels/SubscribeButton.vue | 57 +- front/src/components/channels/UploadForm.vue | 397 ++++++----- .../channels/UploadMetadataForm.vue | 46 +- front/src/components/channels/UploadModal.vue | 151 ++++- .../src/components/common/ActionFeedback.vue | 37 +- front/src/components/common/ActionTable.vue | 342 ++++++---- front/src/components/common/ActorAvatar.vue | 17 +- front/src/components/common/ActorLink.vue | 26 +- front/src/components/common/AjaxButton.vue | 15 +- .../src/components/common/AttachmentInput.vue | 114 +++- front/src/components/common/CollapseLink.vue | 22 +- front/src/components/common/ContentForm.vue | 125 ++-- front/src/components/common/CopyInput.vue | 39 +- .../src/components/common/DangerousButton.vue | 43 +- front/src/components/common/Duration.vue | 16 +- front/src/components/common/EmptyState.vue | 13 +- front/src/components/common/ExpandableDiv.vue | 24 +- front/src/components/common/HumanDate.vue | 16 +- front/src/components/common/HumanDuration.vue | 7 +- .../src/components/common/InlineSearchBar.vue | 39 +- front/src/components/common/LoginModal.vue | 95 +-- front/src/components/common/Message.vue | 20 +- .../components/common/RenderedDescription.vue | 117 ++-- front/src/components/common/Tooltip.vue | 7 +- front/src/components/common/UserLink.vue | 17 +- front/src/components/common/UserModal.vue | 12 +- front/src/components/common/Username.vue | 2 +- front/src/components/favorites/List.vue | 207 +++--- .../favorites/TrackFavoriteIcon.vue | 37 +- .../src/components/federation/FetchButton.vue | 202 ++++-- .../components/federation/LibraryWidget.vue | 71 +- front/src/components/forms/PasswordInput.vue | 39 +- front/src/components/globals.js | 38 +- front/src/components/library/AlbumBase.vue | 325 ++++++--- front/src/components/library/AlbumDetail.vue | 92 ++- .../src/components/library/AlbumDropdown.vue | 136 ++-- front/src/components/library/AlbumEdit.vue | 47 +- front/src/components/library/Albums.vue | 218 +++--- front/src/components/library/ArtistBase.vue | 327 +++++---- front/src/components/library/ArtistDetail.vue | 126 +++- front/src/components/library/ArtistEdit.vue | 47 +- front/src/components/library/Artists.vue | 253 ++++--- front/src/components/library/EditCard.vue | 196 ++++-- front/src/components/library/EditDetail.vue | 44 +- front/src/components/library/EditForm.vue | 263 +++++--- front/src/components/library/EditList.vue | 75 ++- front/src/components/library/FileUpload.vue | 620 +++++++++++------- .../components/library/FileUploadWidget.vue | 18 +- front/src/components/library/FsBrowser.vue | 46 +- front/src/components/library/FsLogs.vue | 22 +- front/src/components/library/Home.vue | 116 ++-- .../components/library/ImportStatusModal.vue | 131 ++-- front/src/components/library/Library.vue | 12 +- front/src/components/library/Podcasts.vue | 319 +++++---- front/src/components/library/Radios.vue | 234 ++++--- front/src/components/library/TagDetail.vue | 105 ++- front/src/components/library/TagsSelector.vue | 72 +- front/src/components/library/TrackBase.vue | 367 +++++++---- front/src/components/library/TrackDetail.vue | 279 +++++--- front/src/components/library/TrackEdit.vue | 62 +- front/src/components/library/UploadDetail.vue | 24 +- .../src/components/library/radios/Builder.vue | 298 ++++++--- .../src/components/library/radios/Filter.vue | 119 ++-- front/src/components/manage/ChannelsTable.vue | 229 +++++-- .../components/manage/library/AlbumsTable.vue | 225 +++++-- .../manage/library/ArtistsTable.vue | 232 ++++--- .../manage/library/EditsCardList.vue | 179 +++-- .../manage/library/LibrariesTable.vue | 248 ++++--- .../components/manage/library/TagsTable.vue | 182 +++-- .../components/manage/library/TracksTable.vue | 238 ++++--- .../manage/library/UploadsTable.vue | 384 +++++++---- .../manage/moderation/AccountsTable.vue | 210 ++++-- .../manage/moderation/DomainsTable.vue | 227 +++++-- .../manage/moderation/InstancePolicyCard.vue | 92 ++- .../manage/moderation/InstancePolicyForm.vue | 274 +++++--- .../manage/moderation/InstancePolicyModal.vue | 90 ++- .../components/manage/moderation/NoteForm.vue | 60 +- .../manage/moderation/NotesThread.vue | 56 +- .../manage/moderation/ReportCard.vue | 342 +++++++--- .../manage/moderation/UserRequestCard.vue | 189 ++++-- .../manage/users/InvitationForm.vue | 85 ++- .../manage/users/InvitationsTable.vue | 194 ++++-- .../components/manage/users/UsersTable.vue | 251 ++++--- front/src/components/mixins/Ordering.vue | 20 +- front/src/components/mixins/Pagination.vue | 4 +- front/src/components/mixins/PlayOptions.vue | 70 +- front/src/components/mixins/Report.vue | 39 +- front/src/components/mixins/SmartSearch.vue | 76 +-- front/src/components/mixins/Translations.vue | 60 +- .../src/components/moderation/FilterModal.vue | 84 ++- .../moderation/ReportCategoryDropdown.vue | 41 +- .../src/components/moderation/ReportModal.vue | 195 ++++-- .../notifications/NotificationRow.vue | 107 ++- front/src/components/playlists/Card.vue | 51 +- front/src/components/playlists/CardList.vue | 8 +- front/src/components/playlists/Editor.vue | 329 ++++++---- front/src/components/playlists/Form.vue | 112 +++- .../components/playlists/PlaylistModal.vue | 246 ++++--- .../playlists/TrackPlaylistIcon.vue | 24 +- front/src/components/playlists/Widget.vue | 86 ++- front/src/components/radios/Button.vue | 54 +- front/src/components/radios/Card.vue | 70 +- front/src/components/tags/List.vue | 35 +- front/src/components/utils/global-events.vue | 6 +- front/src/edits.js | 32 +- front/src/embed.js | 4 +- front/src/entities.js | 52 +- front/src/filters.js | 40 +- front/src/lodash.js | 2 +- front/src/main.js | 61 +- front/src/radios.js | 18 +- front/src/registerServiceWorker.js | 12 +- front/src/sanitize.js | 66 +- front/src/search.js | 94 +-- front/src/service-worker.js | 59 +- front/src/store/auth.js | 2 +- front/src/store/channels.js | 28 +- front/src/store/favorites.js | 28 +- front/src/store/index.js | 6 +- front/src/store/instance.js | 32 +- front/src/store/libraries.js | 34 +- front/src/store/moderation.js | 38 +- front/src/store/playlists.js | 7 +- front/src/store/queue.js | 52 +- front/src/store/radios.js | 28 +- front/src/store/ui.js | 207 +++--- front/src/utils.js | 30 +- front/src/utils/color.js | 6 +- front/src/utils/time.js | 2 +- front/src/utils/url.js | 4 +- front/src/views/Notifications.vue | 274 +++++--- front/src/views/Search.vue | 303 +++++---- front/src/views/admin/ChannelDetail.vue | 304 ++++++--- front/src/views/admin/ChannelsList.vue | 17 +- front/src/views/admin/Settings.vue | 213 +++--- front/src/views/admin/library/AlbumDetail.vue | 299 ++++++--- front/src/views/admin/library/AlbumsList.vue | 17 +- .../src/views/admin/library/ArtistDetail.vue | 305 ++++++--- front/src/views/admin/library/ArtistsList.vue | 17 +- front/src/views/admin/library/Base.vue | 75 ++- front/src/views/admin/library/EditsList.vue | 21 +- .../src/views/admin/library/LibrariesList.vue | 17 +- .../src/views/admin/library/LibraryDetail.vue | 263 +++++--- front/src/views/admin/library/TagDetail.vue | 172 +++-- front/src/views/admin/library/TagsList.vue | 17 +- front/src/views/admin/library/TrackDetail.vue | 320 ++++++--- front/src/views/admin/library/TracksList.vue | 17 +- .../src/views/admin/library/UploadDetail.vue | 256 +++++--- front/src/views/admin/library/UploadsList.vue | 17 +- .../views/admin/moderation/AccountsDetail.vue | 475 +++++++++----- .../views/admin/moderation/AccountsList.vue | 21 +- front/src/views/admin/moderation/Base.vue | 75 ++- .../views/admin/moderation/DomainsDetail.vue | 357 ++++++---- .../views/admin/moderation/DomainsList.vue | 79 ++- .../views/admin/moderation/ReportDetail.vue | 34 +- .../views/admin/moderation/ReportsList.vue | 203 +++--- .../views/admin/moderation/RequestDetail.vue | 34 +- .../views/admin/moderation/RequestsList.vue | 166 +++-- front/src/views/admin/users/Base.vue | 31 +- .../src/views/admin/users/InvitationsList.vue | 16 +- front/src/views/admin/users/UsersList.vue | 12 +- front/src/views/auth/Callback.vue | 13 +- front/src/views/auth/EmailConfirm.vue | 89 ++- front/src/views/auth/Login.vue | 33 +- front/src/views/auth/PasswordReset.vue | 88 ++- front/src/views/auth/PasswordResetConfirm.vue | 101 ++- front/src/views/auth/Plugins.vue | 42 +- front/src/views/auth/ProfileActivity.vue | 59 +- front/src/views/auth/ProfileBase.vue | 187 ++++-- front/src/views/auth/ProfileOverview.vue | 135 +++- front/src/views/auth/Signup.vue | 40 +- front/src/views/channels/DetailBase.vue | 518 ++++++++++----- front/src/views/channels/DetailEpisodes.vue | 15 +- front/src/views/channels/DetailOverview.vue | 217 +++--- .../src/views/channels/SubscriptionsList.vue | 90 ++- front/src/views/content/Base.vue | 33 +- front/src/views/content/Home.vue | 86 ++- front/src/views/content/libraries/Card.vue | 69 +- front/src/views/content/libraries/Files.vue | 8 +- .../views/content/libraries/FilesTable.vue | 359 +++++----- front/src/views/content/libraries/Form.vue | 122 +++- front/src/views/content/libraries/Home.vue | 95 ++- front/src/views/content/libraries/Quota.vue | 203 ++++-- front/src/views/content/remote/Card.vue | 321 +++++---- front/src/views/content/remote/Home.vue | 82 ++- front/src/views/content/remote/ScanForm.vue | 74 ++- front/src/views/library/DetailAlbums.vue | 28 +- front/src/views/library/DetailBase.vue | 269 +++++--- front/src/views/library/DetailOverview.vue | 35 +- front/src/views/library/DetailTracks.vue | 26 +- front/src/views/library/Edit.vue | 128 +++- front/src/views/library/Upload.vue | 21 +- front/src/views/playlists/Detail.vue | 225 ++++--- front/src/views/playlists/List.vue | 203 ++++-- front/src/views/radios/Detail.vue | 155 +++-- 254 files changed, 19510 insertions(+), 10099 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a3a493e33..380f359ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -136,10 +136,7 @@ eslint: - cd front - yarn install script: - # We search for all files ending with .vue or .js in src which changed in relation to develop - # and lint them. This way we focus on some errors instead of checking the hole repository - - export changedFiles=$(git diff --relative --name-only --diff-filter=d origin/develop -- src/ | grep -E "\.(vue|js)$") - - yarn run eslint --quiet -f table $(echo $changedFiles | tr '\n' ' ') + - yarn lint cache: key: "$CI_PROJECT_ID__eslint_npm_cache" paths: diff --git a/front/.eslintrc.js b/front/.eslintrc.js index c01b98750..c07080821 100644 --- a/front/.eslintrc.js +++ b/front/.eslintrc.js @@ -20,5 +20,7 @@ module.exports = { 'vue' ], rules: { + "vue/no-v-html": "off", // TODO: tackle this properly + "vue/no-use-v-if-with-v-for": "off" } } diff --git a/front/package.json b/front/package.json index 791dd97f4..75089cc75 100644 --- a/front/package.json +++ b/front/package.json @@ -8,7 +8,7 @@ "serve": "[ ! -d src/translations ] && npm run i18n-compile; vue-cli-service serve --port ${VUE_PORT:-8080} --host ${VUE_HOST:-0.0.0.0}", "build": "scripts/i18n-compile.sh && vue-cli-service build", "test:unit": "vue-cli-service test:unit --reporter mocha-junit-reporter", - "lint": "eslint $(git status --porcelain --untracked-files=no | grep -E '(A|M) ' | cut -d' ' -f3 | sed s_front/__ | grep -E '.(js|vue)$')", + "lint": "eslint --ext .js,.vue src", "i18n-compile": "scripts/i18n-compile.sh", "i18n-extract": "scripts/i18n-extract.sh", "fix-fomantic-css": "scripts/fix-fomantic-css.sh", diff --git a/front/src/EmbedFrame.vue b/front/src/EmbedFrame.vue index 8d0949b4f..bc31d51e4 100644 --- a/front/src/EmbedFrame.vue +++ b/front/src/EmbedFrame.vue @@ -2,57 +2,110 @@