From 67210c73632dcedc79f598a1f5a3147e200513d6 Mon Sep 17 00:00:00 2001 From: Michael An <2331806369@qq.com> Date: Thu, 18 Jul 2024 11:58:42 +0800 Subject: [PATCH] fix code format (#6365) --- frontend/.eslintrc.json | 83 +++-- frontend/src/app.js | 16 +- frontend/src/components/btn-qr-code.js | 4 +- frontend/src/components/common/account.js | 6 +- .../src/components/common/event-bus-type.js | 6 +- frontend/src/components/common/logout.js | 2 +- frontend/src/components/common/notice-item.js | 36 +- .../src/components/common/notification.js | 10 +- .../src/components/common/search-input.js | 8 +- .../common/select/no-group-message.js | 2 +- .../common/select/seahub-select-style.js | 2 +- .../src/components/common/switch/index.js | 4 +- .../components/context-menu/context-menu.js | 4 +- frontend/src/components/copy-to-clipboard.js | 4 +- .../src/components/cur-dir-path/dir-path.js | 2 +- .../src/components/cur-dir-path/dir-tool.js | 14 +- .../src/components/date-and-time-picker.js | 2 +- .../dialog/add-abuse-report-dialog.js | 8 +- .../src/components/dialog/add-wiki-dialog.js | 2 +- .../components/dialog/add-wiki-page-dialog.js | 2 +- .../dialog/change-repo-password-dialog.js | 4 +- frontend/src/components/dialog/clean-trash.js | 8 +- .../src/components/dialog/commit-details.js | 20 +- .../common-operation-confirmation-dialog.js | 2 +- .../dialog/confirm-delete-account.js | 2 +- .../dialog/confirm-disconnect-dingtalk.js | 2 +- .../dialog/confirm-disconnect-wechat.js | 2 +- .../components/dialog/copy-dirent-dialog.js | 14 +- .../copy-move-dirent-progress-dialog.js | 2 +- .../components/dialog/create-file-dialog.js | 14 +- .../components/dialog/create-folder-dialog.js | 14 +- .../components/dialog/create-group-dialog.js | 10 +- .../components/dialog/create-repo-dialog.js | 32 +- .../components/dialog/create-tag-dialog.js | 10 +- .../custom-permission-editor.js | 18 +- .../custom-permission-item.js | 6 +- .../custom-permission-manager.js | 8 +- .../components/dialog/delete-folder-dialog.js | 2 +- .../components/dialog/delete-repo-dialog.js | 8 +- .../components/dialog/dismiss-group-dialog.js | 4 +- .../components/dialog/edit-filetag-dialog.js | 6 +- .../dialog/edit-repo-commit-labels.js | 6 +- .../editor/number-editor.js | 2 +- .../editor/search-input.js | 4 +- .../editor/simple-text.js | 2 +- .../editor/single-select/index.js | 3 +- .../single-select/single-select-editor.js | 2 +- .../extra-metadata-attributes-dialog/index.js | 2 +- .../components/dialog/generate-upload-link.js | 47 +-- .../components/dialog/group-members-dialog.js | 10 +- .../import-dingtalk-department-dialog.js | 4 +- .../import-work-weixin-department-dialog.js | 4 +- .../components/dialog/internal-link-dialog.js | 8 +- .../src/components/dialog/internal-link.js | 2 +- .../dialog/invitation-revoke-dialog.js | 2 +- .../dialog/label-repo-state-dialog.js | 4 +- .../components/dialog/leave-group-dialog.js | 4 +- .../dialog/lib-history-setting-dialog.js | 8 +- .../dialog/lib-old-files-auto-del-dialog.js | 6 +- .../lib-sub-folder-permission-dialog.js | 6 +- ...-sub-folder-set-group-permission-dialog.js | 10 +- ...b-sub-folder-set-user-permission-dialog.js | 18 +- .../dialog/list-taggedfiles-dialog.js | 6 +- .../components/dialog/move-dirent-dialog.js | 18 +- frontend/src/components/dialog/op-menu.js | 4 +- .../components/dialog/org-add-user-dialog.js | 26 +- .../dialog/org-admin-invite-user-dialog.js | 6 +- .../dialog/org-delete-department-dialog.js | 2 +- .../dialog/org-delete-member-dialog.js | 2 +- .../dialog/org-delete-repo-dialog.js | 2 +- .../dialog/org-logs-file-update-detail.js | 2 +- frontend/src/components/dialog/perm-select.js | 6 +- .../src/components/dialog/rename-dialog.js | 16 +- .../src/components/dialog/rename-dirent.js | 16 +- .../components/dialog/rename-group-dialog.js | 8 +- .../components/dialog/rename-wiki-dialog.js | 2 +- .../dialog/repo-api-token-dialog.js | 26 +- .../repo-seatable-integration-dialog.js | 6 +- .../dialog/repo-share-admin-dialog.js | 4 +- .../dialog/repo-share-admin/group-shares.js | 8 +- .../dialog/repo-share-admin/share-links.js | 6 +- .../dialog/repo-share-admin/upload-links.js | 6 +- .../dialog/repo-share-admin/user-shares.js | 8 +- .../reset-encrypted-repo-password-dialog.js | 10 +- .../dialog/reset-webdav-password.js | 10 +- .../dialog/save-shared-file-dialog.js | 2 +- .../components/dialog/search-file-dialog.js | 4 +- .../components/dialog/set-webdav-password.js | 10 +- .../src/components/dialog/share-admin-link.js | 2 +- .../src/components/dialog/share-dialog.js | 4 +- .../components/dialog/share-repo-dialog.js | 12 +- .../src/components/dialog/share-to-group.js | 14 +- .../dialog/share-to-invite-people.js | 3 +- .../dialog/share-to-other-server.js | 10 +- .../src/components/dialog/share-to-user.js | 18 +- .../src/components/dialog/sort-options.js | 12 +- .../sysadmin-add-member-dialog.js | 2 +- .../sysadmin-add-or-update-term-dialog.js | 24 +- .../sysadmin-add-org-dialog.js | 4 +- .../sysadmin-add-user-dialog.js | 6 +- .../sysadmin-create-group-dialog.js | 6 +- .../sysadmin-delete-department-dialog.js | 2 +- .../sysadmin-delete-member-dialog.js | 2 +- .../sysadmin-delete-repo-dialog.js | 2 +- .../sysadmin-group-transfer-dialog.js | 4 +- .../sysadmin-lib-history-setting-dialog.js | 8 +- .../sysadmin-logs-export-excel-dialog.js | 4 +- .../sysadmin-dialog/sysadmin-share-dialog.js | 4 +- .../sysadmin-share-to-group.js | 10 +- .../sysadmin-dialog/sysadmin-share-to-user.js | 14 +- .../dialog/sysadmin-dialog/update-user.js | 2 +- frontend/src/components/dialog/tag-color.js | 6 +- frontend/src/components/dialog/tag-name.js | 3 +- .../components/dialog/terms-editor-dialog.js | 4 +- .../components/dialog/terms-preview-dialog.js | 2 +- .../src/components/dialog/transfer-dialog.js | 6 +- .../dialog/transfer-group-dialog.js | 2 +- .../components/dialog/zip-download-dialog.js | 4 +- .../dir-view-mode/dir-column-file.js | 2 +- .../dir-view-mode/dir-column-nav.js | 27 +- .../dir-view-mode/dir-column-view.js | 2 +- .../dirent-detail/dirent-details.js | 2 +- .../components/dirent-detail/file-details.js | 2 +- .../components/dirent-detail/lib-details.js | 4 +- .../dirent-grid-view/dirent-grid-item.js | 24 +- .../dirent-grid-view/dirent-grid-view.js | 38 +-- .../dirent-list-view/dirent-list-item.js | 66 ++-- .../dirent-list-view/dirent-list-view.js | 48 +-- .../dirent-list-view/dirent-none-view.js | 18 +- .../components/dirent-list-view/file-tag.js | 5 +- .../dropdown-menu/item-dropdown-menu.js | 10 +- .../components/file-chooser/file-chooser.js | 24 +- .../components/file-chooser/repo-list-item.js | 18 +- .../file-chooser/searched-list-item.js | 4 +- .../file-chooser/searched-list-view.js | 2 +- .../components/file-chooser/tree-list-item.js | 8 +- .../components/file-chooser/tree-list-view.js | 4 +- .../src/components/file-content-view/image.js | 2 +- frontend/src/components/file-tag-list.js | 2 +- .../components/file-uploader/file-uploader.js | 53 ++- .../file-uploader/upload-list-item.js | 10 +- .../file-uploader/upload-progress-dialog.js | 8 +- .../src/components/file-view/file-toolbar.js | 12 +- .../src/components/file-view/file-view.js | 4 +- frontend/src/components/group-members.js | 2 +- .../history-list-view/history-list-item.js | 12 +- .../history-list-view/history-list-view.js | 8 +- .../history-trash-file-view/file-view.js | 2 +- frontend/src/components/icon-button.js | 2 +- .../components/list-and-add-group-members.js | 4 +- frontend/src/components/main-side-nav.js | 8 +- frontend/src/components/op-icon.js | 21 +- .../internal-link-operation/index.js | 2 +- frontend/src/components/pdf-viewer.js | 18 +- .../src/components/permission-denied-tip.js | 6 +- .../popover/edit-filetag-popover.js | 2 +- frontend/src/components/popover/tag-item.js | 4 +- .../src/components/popover/tag-list-footer.js | 6 +- .../src/components/popover/tag-list-item.js | 5 +- .../components/popover/virtual-tag-color.js | 6 +- .../popover/virtual-tag-list-item.js | 3 +- .../components/popover/virtual-tag-name.js | 5 +- frontend/src/components/rename.js | 2 +- frontend/src/components/repo-info-bar.js | 2 +- .../components/sdoc-wiki-page-viewer/index.js | 4 +- .../seafile-markdown-viewer/index.js | 6 +- .../src/components/search/search-by-name.js | 3 +- .../components/search/search-result-item.js | 4 +- .../search/search-result-library.js | 2 +- .../add-seatable-account-setting.js | 15 +- .../delete-seatables-dialog.js | 2 +- .../seatable-account-setting-item.js | 10 +- .../components/select-editor/select-editor.js | 8 +- .../select-editor/share-permission-editor.js | 2 +- frontend/src/components/send-link.js | 3 +- .../src/components/set-link-expiration.js | 2 +- .../src/components/share-link-panel/index.js | 8 +- .../share-link-panel/link-creation.js | 53 +-- .../share-link-panel/link-details.js | 20 +- .../components/share-link-panel/link-item.js | 4 +- .../components/share-link-panel/link-list.js | 2 +- .../shared-file-view/shared-file-view.js | 4 +- .../file-uploader.js | 35 +- .../upload-list-item.js | 10 +- .../upload-progress-dialog.js | 8 +- .../shared-repo-list-item.js | 56 ++-- .../shared-repo-list-view.js | 4 +- frontend/src/components/side-panel.js | 2 +- frontend/src/components/subscription.js | 25 +- .../src/components/system-notification.js | 14 +- .../src/components/terms-preview-widget.js | 2 +- .../toolbar/dir-operation-toolbar.js | 30 +- .../toolbar/selected-dirents-toolbar.js | 8 +- .../toolbar/single-dropdown-toolbar.js | 4 +- .../components/toolbar/view-file-toolbar.js | 18 +- frontend/src/components/tree-section/index.js | 4 +- .../src/components/tree-view/tree-helper.js | 14 +- .../components/tree-view/tree-node-view.js | 28 +- .../src/components/tree-view/tree-node.js | 4 +- .../src/components/tree-view/tree-view.js | 20 +- .../components/user-settings/email-notice.js | 14 +- .../user-settings/language-setting.js | 2 +- .../user-settings/linked-devices.js | 4 +- .../user-settings/social-login-dingtalk.js | 2 +- .../components/user-settings/social-login.js | 2 +- .../user-settings/two-factor-auth.js | 9 +- .../user-settings/user-avatar-form.js | 10 +- .../user-settings/web-api-auth-token.js | 5 +- frontend/src/components/view-modes.js | 4 +- .../wiki-card-view/wiki-card-item.js | 4 +- .../wiki-dir-list-view/wiki-dir-list-item.js | 4 +- .../wiki-dir-list-view/wiki-dir-list-view.js | 10 +- frontend/src/file-history-old.js | 18 +- frontend/src/file-history.js | 6 +- frontend/src/metadata/api.js | 6 +- .../popover/filter-popover/index.js | 3 +- .../components/table/container.js | 5 +- .../metadata-view/components/table/index.js | 2 +- .../table/table-main/records/index.js | 3 +- .../record/cell/operation-btn/index.js | 2 +- .../table-main/records/records-group-body.jsx | 3 +- .../metadata-view/hooks/collaborators.js | 2 +- frontend/src/metadata/metadata-view/index.js | 2 +- .../src/metadata/metadata-view/store/index.js | 3 +- .../utils/selected-cell-utils.js | 3 +- frontend/src/models/dirent.js | 4 +- frontend/src/models/group.js | 2 +- frontend/src/models/repo-info.js | 2 +- frontend/src/pages/dashboard/activity-item.js | 8 +- .../src/pages/dashboard/files-activities.js | 6 +- .../pages/file-history-old/history-item.js | 4 +- frontend/src/pages/file-history/side-panel.js | 8 +- frontend/src/pages/groups/group-item.js | 2 +- frontend/src/pages/groups/group-view.js | 50 +-- .../src/pages/institution-admin/api/index.js | 6 +- .../institution-admin/user-content/index.js | 8 +- .../user-content/user-info.js | 4 +- .../institution-admin/user-list/user-item.js | 2 +- .../pages/institution-admin/utils/index.js | 4 +- .../src/pages/invitations/invitations-view.js | 8 +- .../lib-content-view/lib-content-container.js | 8 +- .../lib-content-view/lib-content-view.js | 146 ++++---- frontend/src/pages/libraries/index.js | 24 +- .../pages/linked-devices/linked-devices.js | 6 +- .../markdown-editor/detail-list-view/index.js | 2 +- .../src/pages/markdown-editor/editor-api.js | 10 +- .../header-toolbar/button-item.js | 8 +- .../header-toolbar/collab-users-button.js | 2 +- .../header-toolbar/header-toolbar.js | 8 +- .../header-toolbar/more-menu.js | 4 +- frontend/src/pages/markdown-editor/index.js | 34 +- frontend/src/pages/my-libs/my-libs-deleted.js | 13 +- frontend/src/pages/my-libs/my-libs.js | 16 +- .../src/pages/my-libs/mylib-repo-list-item.js | 45 +-- .../src/pages/my-libs/mylib-repo-list-view.js | 4 +- frontend/src/pages/my-libs/mylib-repo-menu.js | 10 +- .../pages/ocm-via-webdav/ocm-via-webdav.js | 2 +- .../departments/department-libraries.js | 4 +- .../org-admin/departments/department-list.js | 8 +- .../departments/department-members.js | 6 +- .../pages/org-admin/departments/department.js | 8 +- .../pages/org-admin/departments/group-item.js | 6 +- .../org-admin/departments/sub-departments.js | 6 +- .../org-admin/devices/devices-by-platform.js | 12 +- .../pages/org-admin/devices/devices-errors.js | 6 +- .../pages/org-admin/devices/devices-nav.js | 6 +- frontend/src/pages/org-admin/index.js | 6 +- frontend/src/pages/org-admin/input-item.js | 6 +- .../org-admin/libraries/org-all-repos.js | 16 +- .../pages/org-admin/libraries/org-repo-nav.js | 4 +- .../org-admin/libraries/org-repo-trash.js | 24 +- .../src/pages/org-admin/org-admin-list.js | 6 +- .../src/pages/org-admin/org-group-repos.js | 4 +- .../org-admin/org-groups-search-groups.js | 15 +- frontend/src/pages/org-admin/org-groups.js | 10 +- frontend/src/pages/org-admin/org-info.js | 6 +- frontend/src/pages/org-admin/org-links.js | 10 +- .../pages/org-admin/org-logs-file-audit.js | 3 +- .../pages/org-admin/org-logs-file-update.js | 3 +- frontend/src/pages/org-admin/org-logs.js | 6 +- .../src/pages/org-admin/org-saml-config.js | 4 +- frontend/src/pages/org-admin/org-user-item.js | 12 +- .../src/pages/org-admin/org-user-repos.js | 4 +- .../pages/org-admin/org-user-shared-repos.js | 2 +- .../src/pages/org-admin/org-users-admins.js | 8 +- .../src/pages/org-admin/org-users-list.js | 8 +- frontend/src/pages/org-admin/org-users-nav.js | 4 +- .../pages/org-admin/org-users-search-users.js | 20 +- .../src/pages/org-admin/org-users-users.js | 29 +- frontend/src/pages/org-admin/section.js | 2 +- .../src/pages/org-admin/statistic/picker.js | 2 +- .../org-admin/statistic/statistic-chart.js | 6 +- .../statistic/statistic-common-tool.js | 16 +- .../org-admin/statistic/statistic-file.js | 20 +- .../org-admin/statistic/statistic-nav.js | 10 +- .../org-admin/statistic/statistic-reports.js | 4 +- .../org-admin/statistic/statistic-storage.js | 10 +- .../statistic/statistic-traffic-users.js | 2 +- .../org-admin/statistic/statistic-traffic.js | 42 +-- .../org-admin/statistic/statistic-users.js | 6 +- .../org-admin/statistic/traffic-table-body.js | 8 +- .../org-admin/web-settings/input-item.js | 6 +- .../pages/org-admin/web-settings/section.js | 2 +- .../org-admin/web-settings/web-settings.js | 4 +- .../sdoc/sdoc-file-history/history-version.js | 35 +- frontend/src/pages/search/advanced-search.js | 2 +- frontend/src/pages/search/main-panel.js | 4 +- frontend/src/pages/search/search-results.js | 8 +- frontend/src/pages/share-admin/folders.js | 20 +- frontend/src/pages/share-admin/libraries.js | 12 +- frontend/src/pages/share-admin/share-links.js | 44 +-- .../src/pages/share-admin/upload-links.js | 20 +- .../share-with-ocm/remote-dir-content.js | 8 +- .../pages/share-with-ocm/remote-dir-path.js | 2 +- .../pages/share-with-ocm/remote-dir-view.js | 6 +- .../pages/share-with-ocm/shared-with-ocm.js | 4 +- frontend/src/pages/shared-libs/shared-libs.js | 24 +- frontend/src/pages/shared-with-all/index.js | 18 +- frontend/src/pages/starred/starred.js | 16 +- frontend/src/pages/sys-admin/abuse-reports.js | 14 +- .../pages/sys-admin/admin-logs/login-logs.js | 2 +- .../pages/sys-admin/admin-logs/logs-nav.js | 4 +- .../sys-admin/admin-logs/operation-logs.js | 16 +- .../sys-admin/departments/department-list.js | 6 +- .../departments/department-members.js | 2 +- .../pages/sys-admin/departments/department.js | 8 +- .../pages/sys-admin/departments/group-item.js | 6 +- .../sys-admin/departments/sub-departments.js | 8 +- .../sys-admin/devices/devices-by-platform.js | 12 +- .../pages/sys-admin/devices/devices-errors.js | 6 +- .../pages/sys-admin/devices/devices-nav.js | 6 +- .../pages/sys-admin/dingtalk-departments.js | 12 +- .../dingtalk-department-members-list.js | 6 +- .../dingtalk-departments-tree-node.js | 3 +- .../pages/sys-admin/groups/group-members.js | 14 +- .../src/pages/sys-admin/groups/group-nav.js | 4 +- .../src/pages/sys-admin/groups/group-repos.js | 10 +- .../pages/sys-admin/groups/groups-content.js | 12 +- frontend/src/pages/sys-admin/groups/groups.js | 4 +- .../pages/sys-admin/groups/search-groups.js | 4 +- frontend/src/pages/sys-admin/index.js | 8 +- frontend/src/pages/sys-admin/info.js | 4 +- .../institutions/institution-admins.js | 14 +- .../institutions/institution-info.js | 6 +- .../sys-admin/institutions/institution-nav.js | 6 +- .../institutions/institution-users.js | 18 +- .../sys-admin/institutions/institutions.js | 14 +- .../sys-admin/invitations/invitations.js | 10 +- .../src/pages/sys-admin/links/links-nav.js | 4 +- .../src/pages/sys-admin/links/share-links.js | 6 +- .../src/pages/sys-admin/links/upload-links.js | 4 +- .../sys-admin/logs-page/file-access-logs.js | 8 +- .../logs-page/file-access-toggle-filter.js | 2 +- .../sys-admin/logs-page/file-update-logs.js | 4 +- .../pages/sys-admin/logs-page/login-logs.js | 4 +- .../src/pages/sys-admin/logs-page/logs-nav.js | 8 +- .../logs-page/share-permission-logs.js | 6 +- .../src/pages/sys-admin/main-panel-topbar.js | 3 +- .../sys-admin/notifications/notifications.js | 20 +- .../src/pages/sys-admin/orgs/org-groups.js | 11 +- frontend/src/pages/sys-admin/orgs/org-info.js | 20 +- frontend/src/pages/sys-admin/orgs/org-nav.js | 12 +- .../src/pages/sys-admin/orgs/org-repos.js | 10 +- .../src/pages/sys-admin/orgs/org-users.js | 34 +- .../src/pages/sys-admin/orgs/orgs-content.js | 8 +- frontend/src/pages/sys-admin/orgs/orgs.js | 8 +- .../src/pages/sys-admin/orgs/search-orgs.js | 8 +- .../src/pages/sys-admin/repos/all-repos.js | 8 +- .../src/pages/sys-admin/repos/dir-content.js | 6 +- .../src/pages/sys-admin/repos/dir-path-bar.js | 2 +- .../src/pages/sys-admin/repos/dir-view.js | 6 +- .../src/pages/sys-admin/repos/repos-nav.js | 6 +- frontend/src/pages/sys-admin/repos/repos.js | 24 +- .../src/pages/sys-admin/repos/search-repos.js | 6 +- .../src/pages/sys-admin/repos/system-repo.js | 2 +- .../src/pages/sys-admin/repos/trash-repos.js | 24 +- frontend/src/pages/sys-admin/search.js | 2 +- .../src/pages/sys-admin/statistic/picker.js | 2 +- .../sys-admin/statistic/statistic-chart.js | 6 +- .../statistic/statistic-common-tool.js | 16 +- .../sys-admin/statistic/statistic-file.js | 20 +- .../sys-admin/statistic/statistic-nav.js | 10 +- .../sys-admin/statistic/statistic-reports.js | 4 +- .../sys-admin/statistic/statistic-storage.js | 10 +- .../statistic/statistic-traffic-orgs.js | 4 +- .../statistic/statistic-traffic-users.js | 2 +- .../sys-admin/statistic/statistic-traffic.js | 42 +-- .../sys-admin/statistic/statistic-users.js | 6 +- .../sys-admin/statistic/traffic-table-body.js | 8 +- .../sys-admin/terms-and-conditions/content.js | 4 +- .../sys-admin/terms-and-conditions/item.js | 14 +- .../terms-and-conditions.js | 8 +- .../src/pages/sys-admin/users/ldap-users.js | 2 +- .../src/pages/sys-admin/users/search-users.js | 20 +- .../src/pages/sys-admin/users/user-groups.js | 8 +- .../src/pages/sys-admin/users/user-info.js | 14 +- .../src/pages/sys-admin/users/user-links.js | 16 +- .../src/pages/sys-admin/users/user-nav.js | 10 +- .../src/pages/sys-admin/users/user-repos.js | 16 +- .../sys-admin/users/user-shared-repos.js | 2 +- .../pages/sys-admin/users/users-content.js | 44 +-- .../src/pages/sys-admin/users/users-nav.js | 8 +- frontend/src/pages/sys-admin/users/users.js | 26 +- .../sys-admin/virus-scan/all-virus-files.js | 12 +- .../src/pages/sys-admin/virus-scan/nav.js | 4 +- .../virus-scan/unhandled-virus-files.js | 12 +- .../sys-admin/web-settings/input-item.js | 8 +- .../pages/sys-admin/web-settings/section.js | 2 +- .../sys-admin/web-settings/web-settings.js | 8 +- .../sys-admin/work-weixin-departments.js | 14 +- .../work-weixin-department-members-list.js | 6 +- .../work-weixin-departments-tree-node.js | 3 +- .../src/pages/upload-link/file-uploader.js | 31 +- frontend/src/pages/upload-link/index.js | 7 +- .../src/pages/upload-link/upload-list-item.js | 10 +- .../upload-link/upload-progress-dialog.js | 4 +- .../src/pages/wiki/index-md-viewer/index.js | 4 +- .../pages/wiki/index-md-viewer/nav-item.js | 6 +- frontend/src/pages/wiki/index.js | 58 ++-- frontend/src/pages/wiki/side-panel.js | 4 +- .../src/pages/wiki/utils/generate-navs.js | 2 - .../src/pages/wiki2/common/nav-item-icon.js | 2 +- frontend/src/pages/wiki2/side-panel.js | 2 +- .../wiki2/wiki-right-header/page-cover.js | 2 +- .../wiki2/wiki-right-header/page-icon.js | 2 +- .../wiki2/wiki-right-header/page-title.js | 2 +- frontend/src/pages/wikis/wikis.js | 8 +- frontend/src/repo-folder-trash.js | 30 +- frontend/src/repo-history.js | 36 +- frontend/src/repo-snapshot.js | 28 +- frontend/src/settings.js | 24 +- frontend/src/shared-dir-view.js | 35 +- frontend/src/shared-file-view-document.js | 2 +- frontend/src/shared-file-view-markdown.js | 2 +- frontend/src/shared-file-view-sdoc.js | 4 +- frontend/src/tc-accept.js | 6 +- frontend/src/tc-view.js | 2 +- frontend/src/user-notifications.js | 16 +- frontend/src/utils/constants.js | 8 +- frontend/src/utils/date-format-utils.js | 2 +- frontend/src/utils/editor-utilities.js | 6 +- frontend/src/utils/extra-attributes.js | 12 +- frontend/src/utils/markdown-utils.js | 10 +- frontend/src/utils/search-api.js | 4 +- frontend/src/utils/subscription-api.js | 2 +- frontend/src/utils/system-admin-api.js | 6 +- frontend/src/utils/text-translation.js | 60 ++-- frontend/src/utils/utils.js | 312 +++++++++--------- frontend/src/utils/wiki-api.js | 8 +- frontend/src/view-file-text.js | 4 +- 450 files changed, 2425 insertions(+), 2385 deletions(-) diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json index fc5072ef7c..31e4a1db66 100644 --- a/frontend/.eslintrc.json +++ b/frontend/.eslintrc.json @@ -6,59 +6,52 @@ "eslint:recommended" ], "rules": { - "indent": [ - "warn", - 2, - { "SwitchCase": 1 } - ], - "default-case": "off", - "linebreak-style": [ - "warn", - "unix" - ], - "quotes": [ - "warn", - "single" - ], - "semi": [ - "warn", - "always" - ], - + "jsx-a11y/anchor-is-valid": "off", + "react-hooks/exhaustive-deps": "off", + "no-loop-func": "off", "eqeqeq": "off", + "default-case": "off", + "jsx-a11y/anchor-has-content": "off", + "no-mixed-operators": "off", + "no-useless-concat": "off", "no-useless-constructor": "off", - "no-restricted-globals": "off", "no-unused-expressions": "off", - "no-case-declarations": "warn", - "no-cond-assign": "warn", - "no-redeclare": "warn", + "no-prototype-builtins": "off", + "no-restricted-globals": "off", + "brace-style": "off", + "no-console": "off", + "no-cond-assign": "off", + "no-var": "off", + "no-case-declarations": "off", + "no-redeclare": "off", + "indent": ["warn", 2, { + "SwitchCase": 1, + "ignoreComments": false + }], + "linebreak-style": ["warn", "unix"], + "quotes": ["warn", "single"], + "semi": ["warn", "always"], "no-unreachable": "warn", "no-class-assign": "warn", "no-unused-vars": "warn", + "no-useless-escape": "off", "no-irregular-whitespace": "warn", - "no-console": "warn", - "no-self-assign": ["error", {"props": false}], - "no-useless-escape": "warn", "no-trailing-spaces": "warn", - "react/jsx-indent": ["warn", 2], - "react/prop-types": "warn", - "react/display-name": "warn", - "no-mixed-operators": "off", - "no-useless-concat": "off", - "jsx-a11y/anchor-has-content": "off", - "jsx-a11y/href-no-hash": "off", - "jsx-a11y/anchor-is-valid": "off", - "space-before-blocks": ["warn", "always"], - "space-in-parens": ["warn", "never"], - "keyword-spacing": ["warn", { - "before": true, - "after": true, - "overrides": { - "if" : { - "after": true - } - } - }] + "eol-last": "error", + "space-before-function-paren": ["warn", {"named": "never"}], + "array-bracket-spacing": ["warn", "never"], + "object-curly-spacing": ["warn", "always"], + "spaced-comment": "warn", + "keyword-spacing": ["warn", {"before": true}], + "space-infix-ops": "error", + "key-spacing": ["error", { "beforeColon": false }], + "arrow-spacing": ["error", { "before": true, "after": true }], + "comma-spacing": ["error", { "before": false, "after": true }], + "no-duplicate-imports": "error", + "one-var": ["error", "never"], + "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1 }], + "no-multi-spaces": "error", + "react/jsx-closing-tag-location": "error" } } diff --git a/frontend/src/app.js b/frontend/src/app.js index 33cf841504..afad459feb 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -68,7 +68,7 @@ class App extends Component { onpopstate = (event) => { if (event.state && event.state.currentTab && event.state.pathPrefix) { let { currentTab, pathPrefix } = event.state; - this.setState({currentTab, pathPrefix}); + this.setState({ currentTab, pathPrefix }); } }; @@ -80,12 +80,12 @@ class App extends Component { } } - navigateClientUrlToLib = () =>{ + navigateClientUrlToLib = () => { if (window.location.hash && window.location.hash.indexOf('common/lib') != -1) { let splitUrlArray = window.location.hash.split('/'); let repoID = splitUrlArray[splitUrlArray.length - 2]; let url = siteRoot + 'library/' + repoID + '/'; - navigate(url, {repalce: true}); + navigate(url, { repalce: true }); } }; @@ -102,7 +102,7 @@ class App extends Component { let href = window.location.href.split('/'); currentTab = href[href.length - 2]; } - this.setState({currentTab: currentTab}); + this.setState({ currentTab: currentTab }); } onCloseSidePanel = () => { @@ -119,9 +119,9 @@ class App extends Component { onSearchedClick = (selectedItem) => { if (selectedItem.is_dir === true) { - this.setState({currentTab: '', pathPrefix: []}); + this.setState({ currentTab: '', pathPrefix: [] }); let url = siteRoot + 'library/' + selectedItem.repo_id + '/' + selectedItem.repo_name + selectedItem.path; - navigate(url, {repalce: true}); + navigate(url, { repalce: true }); } else { let url = siteRoot + 'lib/' + selectedItem.repo_id + '/file' + Utils.encodePath(selectedItem.path); let isWeChat = Utils.isWeChat(); @@ -135,7 +135,7 @@ class App extends Component { }; onGroupChanged = (groupID) => { - setTimeout(function() { + setTimeout(function () { let url; if (groupID) { url = siteRoot + 'group/' + groupID + '/'; @@ -157,7 +157,7 @@ class App extends Component { pathPrefix: pathPrefix }, () => { let { currentTab, pathPrefix } = this.state; - window.history.replaceState({currentTab: currentTab, pathPrefix: pathPrefix}, null); + window.history.replaceState({ currentTab: currentTab, pathPrefix: pathPrefix }, null); }); if (!Utils.isDesktop() && !this.state.isSidePanelClosed) { this.setState({ isSidePanelClosed: true }); diff --git a/frontend/src/components/btn-qr-code.js b/frontend/src/components/btn-qr-code.js index 9ea10ee93e..1c0c4d402e 100644 --- a/frontend/src/components/btn-qr-code.js +++ b/frontend/src/components/btn-qr-code.js @@ -17,7 +17,7 @@ class ButtonQR extends React.Component { isPopoverOpen: false }; - this.btnID = 'btn-' + Math.random().toString().substr(2,5); + this.btnID = 'btn-' + Math.random().toString().substr(2, 5); } togglePopover = () => { @@ -35,7 +35,7 @@ class ButtonQR extends React.Component { -

{gettext('Scan the QR code to view the shared content directly')}

+

{gettext('Scan the QR code to view the shared content directly')}

diff --git a/frontend/src/components/common/account.js b/frontend/src/components/common/account.js index 7afc6c23f3..13ab2f413a 100644 --- a/frontend/src/components/common/account.js +++ b/frontend/src/components/common/account.js @@ -94,7 +94,7 @@ class Account extends Component { }); this.isFirstMounted = false; } else { - this.setState({showInfo: !this.state.showInfo}); + this.setState({ showInfo: !this.state.showInfo }); } }; @@ -153,7 +153,7 @@ class Account extends Component { {this.renderAvatar()} -
+
@@ -165,7 +165,7 @@ class Account extends Component {

{gettext('Used:')}{' '}{this.state.quotaUsage} / {this.state.quotaTotal}

-
+
{gettext('Settings')} diff --git a/frontend/src/components/common/event-bus-type.js b/frontend/src/components/common/event-bus-type.js index 18960d493c..ff04767358 100644 --- a/frontend/src/components/common/event-bus-type.js +++ b/frontend/src/components/common/event-bus-type.js @@ -29,9 +29,9 @@ export const EVENT_BUS_TYPE = { // modify view MODIFY_FILTERS: 'modify_filters', - MODIFY_SORTS:'modify_sorts', - MODIFY_GROUPBYS:'modify_groupbys', - MODIFY_HIDDEN_COLUMNS:'modify_hidden_columns', + MODIFY_SORTS: 'modify_sorts', + MODIFY_GROUPBYS: 'modify_groupbys', + MODIFY_HIDDEN_COLUMNS: 'modify_hidden_columns', // change VIEW_CHANGED: 'view_changed', diff --git a/frontend/src/components/common/logout.js b/frontend/src/components/common/logout.js index fa197ab2f1..6f87ec608b 100644 --- a/frontend/src/components/common/logout.js +++ b/frontend/src/components/common/logout.js @@ -4,7 +4,7 @@ import { siteRoot, gettext } from '../../utils/constants'; export default function Logout() { return ( - + ); } diff --git a/frontend/src/components/common/notice-item.js b/frontend/src/components/common/notice-item.js index 58d5a3f74f..f1f94b53e2 100644 --- a/frontend/src/components/common/notice-item.js +++ b/frontend/src/components/common/notice-item.js @@ -25,7 +25,7 @@ const MSG_TYPE_REPO_SHARE_PERM_DELETE = 'repo_share_perm_delete'; class NoticeItem extends React.Component { - generatorNoticeInfo () { + generatorNoticeInfo() { let noticeItem = this.props.noticeItem; let noticeType = noticeItem.type; let detail = noticeItem.detail; @@ -48,7 +48,7 @@ class NoticeItem extends React.Component { notice = notice.replace('{user_link}', userLink); notice = notice.replace('{group_link}', groupLink); - return {avatar_url, notice}; + return { avatar_url, notice }; } if (noticeType === MSG_TYPE_REPO_SHARE) { @@ -58,7 +58,7 @@ class NoticeItem extends React.Component { let shareFrom = detail.share_from_user_name; let repoName = detail.repo_name; - let repoUrl = siteRoot + 'library/' + detail.repo_id + '/' + repoName + '/'; + let repoUrl = siteRoot + 'library/' + detail.repo_id + '/' + repoName + '/'; let path = detail.path; let notice = ''; @@ -78,7 +78,7 @@ class NoticeItem extends React.Component { notice = notice.replace('{tagA}', ``); notice = notice.replace('{/tagA}', ''); - return {avatar_url, notice}; + return { avatar_url, notice }; } if (noticeType === MSG_TYPE_REPO_SHARE_PERM_CHANGE) { @@ -87,7 +87,7 @@ class NoticeItem extends React.Component { let shareFrom = detail.share_from_user_name; let permission = detail.permission; let repoName = detail.repo_name; - let repoUrl = siteRoot + 'library/' + detail.repo_id + '/' + repoName + '/'; + let repoUrl = siteRoot + 'library/' + detail.repo_id + '/' + repoName + '/'; let path = detail.path; let notice = ''; // 1. handle translate @@ -107,7 +107,7 @@ class NoticeItem extends React.Component { notice = notice.replace('{tagA}', ``); notice = notice.replace('{/tagA}', ''); - return {avatar_url, notice}; + return { avatar_url, notice }; } if (noticeType === MSG_TYPE_REPO_SHARE_PERM_DELETE) { @@ -128,7 +128,7 @@ class NoticeItem extends React.Component { notice = notice.replace('{share_from}', shareFrom); notice = notice.replace('{repo_name}', repoName); notice = Utils.HTMLescape(notice); - return {avatar_url, notice}; + return { avatar_url, notice }; } if (noticeType === MSG_TYPE_REPO_SHARE_TO_GROUP) { @@ -147,9 +147,9 @@ class NoticeItem extends React.Component { let notice = ''; // 1. handle translate if (path === '/') { - notice = gettext('{share_from} has shared a library named {repo_link} to group {group_link}.'); + notice = gettext('{share_from} has shared a library named {repo_link} to group {group_link}.'); } else { - notice = gettext('{share_from} has shared a folder named {repo_link} to group {group_link}.'); + notice = gettext('{share_from} has shared a folder named {repo_link} to group {group_link}.'); } // 2. handle xss(cross-site scripting) @@ -163,7 +163,7 @@ class NoticeItem extends React.Component { notice = notice.replace('{/tagA}', ''); notice = notice.replace('{tagB}', ``); notice = notice.replace('{/tagB}', ''); - return {avatar_url, notice}; + return { avatar_url, notice }; } if (noticeType === MSG_TYPE_REPO_TRANSFER) { @@ -185,7 +185,7 @@ class NoticeItem extends React.Component { // 3. add jump link notice = notice.replace('{tagA}', ``); notice = notice.replace('{/tagA}', ''); - return {avatar_url, notice}; + return { avatar_url, notice }; } if (noticeType === MSG_TYPE_FILE_UPLOADED) { @@ -218,7 +218,7 @@ class NoticeItem extends React.Component { notice = notice.replace('{upload_file_link}', `${fileName}`); notice = Utils.HTMLescape(notice); } - return {avatar_url, notice}; + return { avatar_url, notice }; } if (noticeType === MSG_TYPE_FOLDER_UPLOADED) { @@ -251,7 +251,7 @@ class NoticeItem extends React.Component { notice = notice.replace('{upload_folder_link}', `${folderName}`); notice = Utils.HTMLescape(notice); } - return {avatar_url, notice}; + return { avatar_url, notice }; } if (noticeType === MSG_TYPE_REPO_MONITOR) { @@ -348,21 +348,21 @@ class NoticeItem extends React.Component { let notice = gettext('Your library {libraryName} has recently deleted a large number of files.'); notice = notice.replace('{libraryName}', repoLink); - return { avatar_url : null, notice }; + return { avatar_url: null, notice }; } if (noticeType === MSG_TYPE_SAML_SSO_FAILED) { const { error_msg } = detail; let notice = gettext(error_msg); - return { avatar_url : null, notice }; + return { avatar_url: null, notice }; } // if (noticeType === MSG_TYPE_GUEST_INVITATION_ACCEPTED) { // } - return {avatar_url : null, notice : null}; + return { avatar_url: null, notice: null }; } onNoticeItemClick = () => { @@ -387,7 +387,7 @@ class NoticeItem extends React.Component { -

+

{moment(noticeItem.time).fromNow()} @@ -398,7 +398,7 @@ class NoticeItem extends React.Component {
-

+

{moment(noticeItem.time).fromNow()}

diff --git a/frontend/src/components/common/notification.js b/frontend/src/components/common/notification.js index ed318ce0ce..fca7dd4520 100644 --- a/frontend/src/components/common/notification.js +++ b/frontend/src/components/common/notification.js @@ -20,7 +20,7 @@ class Notification extends React.Component { componentDidMount() { seafileAPI.getUnseenNotificationCount().then(res => { - this.setState({unseenCount: res.data.unseen_count}); + this.setState({ unseenCount: res.data.unseen_count }); }); } @@ -34,7 +34,7 @@ class Notification extends React.Component { }); } else { this.loadNotices(); - this.setState({showNotice: true}); + this.setState({ showNotice: true }); } }; @@ -43,7 +43,7 @@ class Notification extends React.Component { let perPage = 5; seafileAPI.listNotifications(page, perPage).then(res => { let noticeList = res.data.notification_list; - this.setState({noticeList: noticeList}); + this.setState({ noticeList: noticeList }); }); }; @@ -71,11 +71,11 @@ class Notification extends React.Component { onNotificationDialogToggle = () => { let newSearch = this.state.isShowNotificationDialog ? null : 'all'; Utils.updateSearchParameter('notifications', newSearch); - this.setState({isShowNotificationDialog: !this.state.isShowNotificationDialog}); + this.setState({ isShowNotificationDialog: !this.state.isShowNotificationDialog }); }; onNotificationListToggle = () => { - this.setState({showNotice: false}); + this.setState({ showNotice: false }); }; onMarkAllNotifications = () => { diff --git a/frontend/src/components/common/search-input.js b/frontend/src/components/common/search-input.js index 428089010f..ecf26b9fc6 100644 --- a/frontend/src/components/common/search-input.js +++ b/frontend/src/components/common/search-input.js @@ -40,7 +40,7 @@ class SearchInput extends Component { UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.value !== this.props.value) { - this.setState({searchValue: nextProps.value}); + this.setState({ searchValue: nextProps.value }); } } @@ -58,7 +58,7 @@ class SearchInput extends Component { this.timer && clearTimeout(this.timer); const { onChange, wait } = this.props; let text = e.target.value; - this.setState({searchValue: text || ''}, () => { + this.setState({ searchValue: text || '' }, () => { if (this.isInputtingChinese) return; this.timer = setTimeout(() => { onChange && onChange(this.state.searchValue.trim()); @@ -73,7 +73,7 @@ class SearchInput extends Component { clearSearch = () => { const { clearValue } = this.props; - this.setState({searchValue: ''}, () => { + this.setState({ searchValue: '' }, () => { clearValue && clearValue(); }); }; @@ -98,7 +98,7 @@ class SearchInput extends Component { if (!isClearable || !searchValue) return null; const { ClearIndicator } = components; if (React.isValidElement(ClearIndicator)) { - return React.cloneElement(ClearIndicator, {clearValue: this.clearSearch}); + return React.cloneElement(ClearIndicator, { clearValue: this.clearSearch }); } else if (this.isFunction(ClearIndicator)) { return ; } diff --git a/frontend/src/components/common/select/no-group-message.js b/frontend/src/components/common/select/no-group-message.js index 7a9abcc9fa..362f72a5e3 100644 --- a/frontend/src/components/common/select/no-group-message.js +++ b/frontend/src/components/common/select/no-group-message.js @@ -4,7 +4,7 @@ import { gettext } from '../../../utils/constants'; const NoGroupMessage = (props) => { return ( -
{gettext('Group not found')}
+
{gettext('Group not found')}
); }; diff --git a/frontend/src/components/common/select/seahub-select-style.js b/frontend/src/components/common/select/seahub-select-style.js index e86c7e6474..f7722afb4b 100644 --- a/frontend/src/components/common/select/seahub-select-style.js +++ b/frontend/src/components/common/select/seahub-select-style.js @@ -16,7 +16,7 @@ const MenuSelectStyle = { cursor: 'pointer', lineHeight: '1.5', }), - menuPortal: base => ({ ...base, zIndex: 9999 }), + menuPortal: base => ({ ...base, zIndex: 9999 }), indicatorSeparator: () => {}, }; diff --git a/frontend/src/components/common/switch/index.js b/frontend/src/components/common/switch/index.js index 938c206bb0..fbf4d700c3 100644 --- a/frontend/src/components/common/switch/index.js +++ b/frontend/src/components/common/switch/index.js @@ -6,7 +6,7 @@ import '../../../css/switch.css'; function Switch(props) { const { onChange, checked, placeholder, disabled, className, size, textPosition, setRef } = props; - return( + return (