From 6f61fefec5ed0ec9eac187a95fb1cda09cce59d3 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Thu, 4 Nov 2021 09:16:08 +0100 Subject: [PATCH] Improve a11y (#1841) Improve accessibility by removing unnecessary tags without hrefs. Also remove many eslint errors and warnings. --- gradle/changelog/improve_a11y.yaml | 4 + .../src/main/js/RepositoryConfig.tsx | 48 +- .../scm-git-plugin/src/main/js/index.test.ts | 10 +- .../src/main/js/HgConfigurationForm.tsx | 8 +- .../main/js/HgRepositoryConfigurationForm.tsx | 2 +- .../scm-hg-plugin/src/main/js/hooks.ts | 10 +- .../src/main/js/SvnConfigurationForm.tsx | 6 +- scm-ui/ui-api/src/ApiProvider.test.tsx | 4 +- scm-ui/ui-api/src/ApiProvider.tsx | 6 +- scm-ui/ui-api/src/LegacyContext.test.tsx | 2 +- scm-ui/ui-api/src/admin.test.ts | 4 +- scm-ui/ui-api/src/apiclient.test.ts | 20 +- scm-ui/ui-api/src/apiclient.ts | 47 +- scm-ui/ui-api/src/base.test.ts | 68 +- scm-ui/ui-api/src/config.test.ts | 14 +- scm-ui/ui-api/src/config.ts | 10 +- scm-ui/ui-api/src/diff.test.ts | 95 +- scm-ui/ui-api/src/errors.test.ts | 6 +- scm-ui/ui-api/src/groups.test.ts | 52 +- scm-ui/ui-api/src/links.test.ts | 36 +- scm-ui/ui-api/src/login.test.ts | 28 +- scm-ui/ui-api/src/login.ts | 22 +- scm-ui/ui-api/src/namespaces.test.ts | 18 +- scm-ui/ui-api/src/namespaces.ts | 2 +- scm-ui/ui-api/src/plugins.ts | 80 +- scm-ui/ui-api/src/repository-roles.test.ts | 49 +- scm-ui/ui-api/src/reset.ts | 2 +- scm-ui/ui-api/src/sources.test.ts | 62 +- scm-ui/ui-api/src/sources.ts | 18 +- scm-ui/ui-api/src/tags.test.ts | 44 +- .../src/tests/createInfiniteCachingClient.ts | 6 +- scm-ui/ui-api/src/tests/indexLinks.ts | 10 +- scm-ui/ui-api/src/urls.test.ts | 11 +- scm-ui/ui-api/src/users.test.ts | 66 +- scm-ui/ui-api/src/utils.ts | 2 +- scm-ui/ui-components/src/Autocomplete.tsx | 12 +- .../src/BranchSelector.stories.tsx | 2 +- scm-ui/ui-components/src/Breadcrumb.tsx | 5 +- .../ui-components/src/CardColumn.stories.tsx | 4 +- scm-ui/ui-components/src/CardColumn.tsx | 3 +- scm-ui/ui-components/src/HelpIcon.tsx | 4 +- scm-ui/ui-components/src/Icon.stories.tsx | 6 +- .../src/Notification.stories.tsx | 2 +- scm-ui/ui-components/src/Paginator.test.tsx | 32 +- scm-ui/ui-components/src/ProtectedRoute.tsx | 6 +- scm-ui/ui-components/src/Tag.tsx | 2 +- .../src/__resources__/Diff.markdown.ts | 40 +- .../src/__resources__/changesets.tsx | 182 ++- .../src/__resources__/repository.ts | 16 +- .../src/__snapshots__/storyshots.test.ts.snap | 1079 ++++++++--------- scm-ui/ui-components/src/buttons/Button.tsx | 139 +-- .../src/buttons/ButtonAddons.tsx | 2 +- .../ui-components/src/buttons/ButtonGroup.tsx | 2 +- .../src/buttons/SubmitButton.tsx | 2 +- .../src/buttons/index.stories.tsx | 4 +- scm-ui/ui-components/src/comparators.test.ts | 12 +- scm-ui/ui-components/src/comparators.ts | 2 +- scm-ui/ui-components/src/devBuild.ts | 2 +- .../AutocompleteAddEntryToTableField.tsx | 2 +- .../src/forms/Checkbox.stories.tsx | 6 +- .../src/forms/DropDown.stories.tsx | 6 +- scm-ui/ui-components/src/forms/DropDown.tsx | 2 +- .../ui-components/src/forms/FilterInput.tsx | 2 +- .../src/forms/MemberNameTagGroup.tsx | 6 +- .../src/forms/PasswordConfirmation.tsx | 8 +- .../ui-components/src/forms/Radio.stories.tsx | 2 +- .../src/forms/Select.stories.tsx | 7 +- scm-ui/ui-components/src/languages.ts | 2 +- .../src/layout/Footer.stories.tsx | 4 +- .../src/layout/SecondaryNavigationColumn.tsx | 2 +- scm-ui/ui-components/src/layout/Title.tsx | 4 +- .../src/markdown/MarkdownCodeRenderer.tsx | 2 +- .../src/markdown/MarkdownHeadingRenderer.tsx | 4 +- .../markdown/MarkdownLinkRenderer.test.tsx | 2 +- .../src/markdown/MarkdownLinkRenderer.tsx | 2 +- .../src/markdown/MarkdownView.stories.tsx | 8 +- .../src/markdown/MarkdownView.tsx | 18 +- .../src/markdown/createComponentList.ts | 2 +- .../src/markdown/createMdastPlugin.ts | 2 +- .../src/markdown/markdownExtensions.ts | 2 +- .../remarkChangesetShortLinkParser.ts | 14 +- .../remarkToRehypeRendererAdapters.ts | 19 +- .../src/modals/ConfirmAlert.stories.tsx | 8 +- .../ui-components/src/modals/ConfirmAlert.tsx | 4 +- .../src/modals/CreateTagModal.tsx | 8 +- .../src/navigation/MenuContext.tsx | 4 +- .../src/navigation/NavAction.tsx | 6 +- .../SecondaryNavigation.stories.tsx | 6 +- .../src/navigation/SubNavigation.tsx | 4 +- .../src/popover/Popover.stories.tsx | 72 +- .../ui-components/src/popover/usePopover.ts | 20 +- .../src/repos/DiffExpander.test.ts | 80 +- .../ui-components/src/repos/DiffExpander.ts | 20 +- .../src/repos/RepositoryFlag.tsx | 2 +- .../src/repos/Tokenize.worker.ts | 6 +- .../src/repos/TokenizedDiffView.tsx | 2 +- .../src/repos/annotate/Annotate.stories.tsx | 56 +- .../src/repos/changesets/ChangesetAuthor.tsx | 8 +- .../repos/changesets/ChangesetDescription.tsx | 4 +- .../repos/changesets/ChangesetDiff.test.ts | 36 +- .../src/repos/changesets/ChangesetId.tsx | 2 +- .../src/repos/changesets/ChangesetList.tsx | 2 +- .../changesets/ChangesetTagsCollapsed.tsx | 2 +- .../repos/changesets/Changesets.stories.tsx | 325 ++--- .../src/repos/changesets/SignatureIcon.tsx | 8 +- .../src/repos/changesets/changesets.ts | 2 +- scm-ui/ui-components/src/repos/diffs.test.ts | 6 +- .../src/repos/refractorAdapter.ts | 6 +- scm-ui/ui-components/src/repositories.test.ts | 36 +- scm-ui/ui-components/src/storyshots.test.ts | 6 +- .../ui-components/src/table/Table.stories.tsx | 12 +- scm-ui/ui-components/src/table/Table.tsx | 2 +- scm-ui/ui-components/src/table/TextColumn.tsx | 2 +- .../src/textSplitAndReplace.test.ts | 6 +- .../ui-components/src/textSplitAndReplace.ts | 4 +- scm-ui/ui-components/src/toast/Toast.tsx | 4 +- .../ui-components/src/toast/index.stories.tsx | 4 +- scm-ui/ui-components/src/toast/themes.ts | 12 +- scm-ui/ui-components/src/useDateFormatter.ts | 6 +- scm-ui/ui-components/src/validation.test.ts | 12 +- scm-ui/ui-components/src/validation.ts | 5 +- scm-ui/ui-webapp/src/LegacyReduxProvider.tsx | 12 +- .../ui-webapp/src/ReduxAwareApiProvider.tsx | 2 +- .../src/admin/components/form/ConfigForm.tsx | 6 +- .../admin/components/form/GeneralSettings.tsx | 6 +- .../admin/components/form/LoginAttempt.tsx | 6 +- .../form/NamespaceStrategySelect.tsx | 4 +- .../admin/components/form/ProxySettings.tsx | 12 +- .../components/table/ArrayConfigTable.tsx | 4 +- .../ui-webapp/src/admin/containers/Admin.tsx | 4 +- .../src/admin/containers/AdminDetails.tsx | 10 +- .../src/admin/containers/GlobalConfig.tsx | 2 +- .../components/PendingPluginsQueue.tsx | 2 +- .../plugins/components/PluginActionModal.tsx | 10 +- .../admin/plugins/components/PluginModal.tsx | 2 +- .../components/SuccessNotification.tsx | 6 +- .../plugins/components/groupByCategory.ts | 2 +- .../components/PermissionRoleDetails.tsx | 2 +- .../roles/containers/DeleteRepositoryRole.tsx | 6 +- .../roles/containers/RepositoryRoleForm.tsx | 6 +- .../roles/containers/RepositoryRoles.tsx | 2 +- .../roles/containers/SingleRepositoryRole.tsx | 2 +- .../ui-webapp/src/components/HeaderButton.tsx | 1 - scm-ui/ui-webapp/src/containers/Logout.tsx | 4 +- .../src/containers/NavigationBar.tsx | 1 - .../ui-webapp/src/containers/ProfileInfo.tsx | 9 +- .../src/groups/components/GroupForm.tsx | 34 +- .../navLinks/EditGroupNavLink.test.tsx | 8 +- .../src/groups/containers/DeleteGroup.tsx | 6 +- .../src/groups/containers/Groups.tsx | 2 +- scm-ui/ui-webapp/src/i18n.ts | 12 +- .../components/PermissionsWrapper.tsx | 4 +- .../repos/branches/components/BranchForm.tsx | 12 +- .../repos/branches/components/BranchRow.tsx | 10 +- .../repos/branches/components/BranchTable.tsx | 8 +- .../repos/branches/components/BranchView.tsx | 2 +- .../branches/containers/BranchesOverview.tsx | 4 +- .../repos/branches/util/orderBranches.test.ts | 14 +- .../components/CodeViewSwitcher.tsx | 2 +- .../codeSection/utils/filepathSearch.test.ts | 2 +- .../repos/codeSection/utils/filepathSearch.ts | 6 +- .../repos/components/EditRepoNavLink.test.tsx | 8 +- .../repos/components/ImportFullRepository.tsx | 2 +- .../components/ImportRepositoryFromBundle.tsx | 2 +- .../components/ImportRepositoryFromUrl.tsx | 2 +- .../components/ImportRepositoryTypeSelect.tsx | 8 +- .../components/NamespaceAndNameFields.tsx | 2 +- .../components/PermissionsNavLink.test.tsx | 8 +- .../repos/components/RepositoryDetails.tsx | 2 +- .../components/RepositoryNavLink.test.tsx | 8 +- .../changesets/ChangesetShortLink.tsx | 4 +- .../changesets/ContributorTable.tsx | 8 +- .../components/changesets/CreateTagModal.tsx | 14 +- .../form/repositoryValidation.test.ts | 6 +- .../components/list/groupByNamespace.test.ts | 28 +- .../repos/components/list/groupByNamespace.ts | 4 +- .../src/repos/containers/ArchiveRepo.tsx | 6 +- .../src/repos/containers/Changesets.tsx | 2 +- .../src/repos/containers/ChangesetsRoot.tsx | 6 +- .../repos/containers/CreateRepositoryRoot.tsx | 10 +- .../src/repos/containers/DeleteRepo.tsx | 8 +- .../src/repos/containers/UnarchiveRepo.tsx | 6 +- .../src/repos/importlog/ImportLog.tsx | 16 +- .../namespaces/containers/NamespaceRoot.tsx | 4 +- .../components/DeletePermissionButton.tsx | 6 +- .../components/PermissionsTable.tsx | 4 +- .../permissions/components/RoleSelector.tsx | 4 +- .../containers/AdvancedPermissionsDialog.tsx | 4 +- .../containers/CreatePermissionForm.tsx | 24 +- .../permissions/containers/Permissions.tsx | 2 +- .../containers/SinglePermission.tsx | 10 +- .../permissions/utils/findVerbsForRole.ts | 2 +- .../utils/permissionValidation.test.ts | 8 +- .../components/TruncatedNotification.tsx | 2 +- .../src/repos/sources/containers/Sources.tsx | 2 +- .../src/repos/sources/utils/files.test.ts | 6 +- .../src/repos/tags/components/TagRow.tsx | 12 +- .../src/repos/tags/components/TagView.tsx | 2 +- .../src/repos/tags/container/DeleteTag.tsx | 6 +- .../src/repos/tags/orderTags.test.ts | 6 +- scm-ui/ui-webapp/src/tokenExpired.ts | 2 +- .../src/users/components/UserForm.tsx | 40 +- .../users/components/apiKeys/ApiKeyEntry.tsx | 10 +- .../navLinks/EditUserNavLink.test.tsx | 8 +- .../navLinks/SetPasswordNavLink.test.tsx | 8 +- .../navLinks/SetPasswordNavLink.tsx | 2 +- .../navLinks/SetPermissionsNavLink.test.tsx | 8 +- .../navLinks/SetPermissionsNavLink.tsx | 4 +- .../components/publicKeys/PublicKeyEntry.tsx | 8 +- .../src/users/components/table/Details.tsx | 7 +- .../users/components/userValidation.test.ts | 2 +- .../src/users/containers/DeleteUser.tsx | 6 +- .../ui-webapp/src/users/containers/Users.tsx | 4 +- 213 files changed, 1924 insertions(+), 2068 deletions(-) create mode 100644 gradle/changelog/improve_a11y.yaml diff --git a/gradle/changelog/improve_a11y.yaml b/gradle/changelog/improve_a11y.yaml new file mode 100644 index 0000000000..505d163c14 --- /dev/null +++ b/gradle/changelog/improve_a11y.yaml @@ -0,0 +1,4 @@ +- type: fixed + description: Fix tags without hrefs ([#1841](https://github.com/scm-manager/scm-manager/pull/1841)) +- type: fixed + description: Fix eslint errors and warnings ([#1841](https://github.com/scm-manager/scm-manager/pull/1841)) diff --git a/scm-plugins/scm-git-plugin/src/main/js/RepositoryConfig.tsx b/scm-plugins/scm-git-plugin/src/main/js/RepositoryConfig.tsx index 73b2fcd151..f8f76db250 100644 --- a/scm-plugins/scm-git-plugin/src/main/js/RepositoryConfig.tsx +++ b/scm-plugins/scm-git-plugin/src/main/js/RepositoryConfig.tsx @@ -32,7 +32,7 @@ import { Loading, Subtitle, Level, - SubmitButton + SubmitButton, } from "@scm-manager/ui-components"; type Props = WithTranslation & { @@ -67,40 +67,40 @@ class RepositoryConfig extends React.Component { nonFastForwardDisallowed: false, changesSubmitted: false, disabled: true, - changed: false + changed: false, }; } componentDidMount() { const { repository } = this.props; this.setState({ - loadingBranches: true + loadingBranches: true, }); const branchesLink = repository._links.branches as Link; apiClient .get(branchesLink.href) - .then(response => response.json()) - .then(payload => payload._embedded.branches) - .then(branches => + .then((response) => response.json()) + .then((payload) => payload._embedded.branches) + .then((branches) => this.setState({ branches, - loadingBranches: false + loadingBranches: false, }) ) - .catch(error => + .catch((error) => this.setState({ - error + error, }) ); const configurationLink = repository._links.configuration as Link; this.setState({ - loadingDefaultBranch: true + loadingDefaultBranch: true, }); apiClient .get(configurationLink.href) - .then(response => response.json()) - .then(payload => { + .then((response) => response.json()) + .then((payload) => { const defaultBranch = payload.defaultBranch || this.state.branches?.filter((b: Branch) => b.defaultBranch)[0]?.name; this.setState({ @@ -108,12 +108,12 @@ class RepositoryConfig extends React.Component { nonFastForwardDisallowed: payload.nonFastForwardDisallowed, disabled: !payload._links.update, loadingDefaultBranch: false, - changed: false + changed: false, }); }) - .catch(error => + .catch((error) => this.setState({ - error + error, }) ); } @@ -123,13 +123,13 @@ class RepositoryConfig extends React.Component { this.setState({ selectedBranchName: "", changesSubmitted: false, - changed: true + changed: true, }); } else { this.setState({ selectedBranchName: branch.name, changesSubmitted: false, - changed: true + changed: true, }); } }; @@ -137,7 +137,7 @@ class RepositoryConfig extends React.Component { onNonFastForwardDisallowed = (value: boolean) => { this.setState({ nonFastForwardDisallowed: value, - changed: true + changed: true, }); }; @@ -148,10 +148,10 @@ class RepositoryConfig extends React.Component { const { selectedBranchName, nonFastForwardDisallowed } = this.state; const newConfig = { defaultBranch: selectedBranchName, - nonFastForwardDisallowed + nonFastForwardDisallowed, }; this.setState({ - submitPending: true + submitPending: true, }); const configurationLink = repository._links.configuration as Link; apiClient @@ -160,12 +160,12 @@ class RepositoryConfig extends React.Component { this.setState({ submitPending: false, changesSubmitted: true, - changed: false + changed: false, }) ) - .catch(error => + .catch((error) => this.setState({ - error + error, }) ); }; @@ -233,7 +233,7 @@ class RepositoryConfig extends React.Component { onClick={() => this.setState({ changesSubmitted: false, - changed: false + changed: false, }) } /> diff --git a/scm-plugins/scm-git-plugin/src/main/js/index.test.ts b/scm-plugins/scm-git-plugin/src/main/js/index.test.ts index 0069701e1f..ed35c83cfe 100644 --- a/scm-plugins/scm-git-plugin/src/main/js/index.test.ts +++ b/scm-plugins/scm-git-plugin/src/main/js/index.test.ts @@ -31,14 +31,14 @@ describe("test git predicate", () => { expect(gitPredicate({})).toBe(false); expect( gitPredicate({ - repository: {} + repository: {}, }) ).toBe(false); expect( gitPredicate({ repository: { - type: "hg" - } + type: "hg", + }, }) ).toBe(false); }); @@ -47,8 +47,8 @@ describe("test git predicate", () => { expect( gitPredicate({ repository: { - type: "git" - } + type: "git", + }, }) ).toBe(true); }); diff --git a/scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.tsx b/scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.tsx index 68b5e78f0d..6f4cf6552f 100644 --- a/scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.tsx +++ b/scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.tsx @@ -50,7 +50,7 @@ class HgConfigurationForm extends React.Component { super(props); this.state = { ...props.initialConfiguration, - validationErrors: [] + validationErrors: [], }; } @@ -66,7 +66,7 @@ class HgConfigurationForm extends React.Component { } this.setState({ - validationErrors + validationErrors, }); return validationErrors.length === 0; @@ -83,7 +83,7 @@ class HgConfigurationForm extends React.Component { this.setState( // @ts-ignore { - [name]: value + [name]: value, }, () => this.props.onConfigurationChange(this.state, this.updateValidationStatus()) ); @@ -99,7 +99,7 @@ class HgConfigurationForm extends React.Component { .then(() => apiClient .get((this.props.initialConfiguration._links.self as Link).href) - .then(r => r.json()) + .then((r) => r.json()) .then((config: Configuration) => this.setState({ hgBinary: config.hgBinary })) ) .then(() => this.updateValidationStatus()); diff --git a/scm-plugins/scm-hg-plugin/src/main/js/HgRepositoryConfigurationForm.tsx b/scm-plugins/scm-hg-plugin/src/main/js/HgRepositoryConfigurationForm.tsx index d8e94c3eec..3425d02673 100644 --- a/scm-plugins/scm-hg-plugin/src/main/js/HgRepositoryConfigurationForm.tsx +++ b/scm-plugins/scm-hg-plugin/src/main/js/HgRepositoryConfigurationForm.tsx @@ -52,7 +52,7 @@ const HgRepositoryConfigurationForm: FC = ({ repository }) => { const encoding = value ? value : undefined; setConfiguration({ ...configuration, - encoding + encoding, }); }; diff --git a/scm-plugins/scm-hg-plugin/src/main/js/hooks.ts b/scm-plugins/scm-hg-plugin/src/main/js/hooks.ts index de6f7a1366..c3a34eeea7 100644 --- a/scm-plugins/scm-hg-plugin/src/main/js/hooks.ts +++ b/scm-plugins/scm-hg-plugin/src/main/js/hooks.ts @@ -41,11 +41,11 @@ export const useHgRepositoryConfiguration = (repository: Repository) => { setLoading(true); apiClient .get(link) - .then(response => response.json()) + .then((response) => response.json()) .then((config: HgRepositoryConfiguration) => { setData(config); }) - .catch(e => setError(e)) + .catch((e) => setError(e)) .finally(() => setLoading(false)); } }, [link]); @@ -53,7 +53,7 @@ export const useHgRepositoryConfiguration = (repository: Repository) => { return { isLoading, error, - data + data, }; }; @@ -73,7 +73,7 @@ export const useUpdateHgRepositoryConfiguration = () => { apiClient .put(link, configuration, "application/vnd.scmm-hgConfig-repo+json;v=2") .then(() => setUpdated(true)) - .catch(e => setError(e)) + .catch((e) => setError(e)) .finally(() => setLoading(false)); }; @@ -81,6 +81,6 @@ export const useUpdateHgRepositoryConfiguration = () => { isLoading, error, update, - updated + updated, }; }; diff --git a/scm-plugins/scm-svn-plugin/src/main/js/SvnConfigurationForm.tsx b/scm-plugins/scm-svn-plugin/src/main/js/SvnConfigurationForm.tsx index 2928db25a2..ed54c08c19 100644 --- a/scm-plugins/scm-svn-plugin/src/main/js/SvnConfigurationForm.tsx +++ b/scm-plugins/scm-svn-plugin/src/main/js/SvnConfigurationForm.tsx @@ -45,7 +45,7 @@ class SvnConfigurationForm extends React.Component { constructor(props: Props) { super(props); this.state = { - ...props.initialConfiguration + ...props.initialConfiguration, }; } @@ -56,7 +56,7 @@ class SvnConfigurationForm extends React.Component { this.setState( // @ts-ignore { - [name]: value + [name]: value, }, () => this.props.onConfigurationChange(this.state, true) ); @@ -73,7 +73,7 @@ class SvnConfigurationForm extends React.Component { compatibilityOption = (value: string) => { return { value, - label: this.props.t("scm-svn-plugin.config.compatibility-values." + value.toLowerCase()) + label: this.props.t("scm-svn-plugin.config.compatibility-values." + value.toLowerCase()), }; }; diff --git a/scm-ui/ui-api/src/ApiProvider.test.tsx b/scm-ui/ui-api/src/ApiProvider.test.tsx index e944885260..f9e7e5e462 100644 --- a/scm-ui/ui-api/src/ApiProvider.test.tsx +++ b/scm-ui/ui-api/src/ApiProvider.test.tsx @@ -36,7 +36,7 @@ describe("ApiProvider tests", () => { it("should register QueryClient", () => { const { result } = renderHook(() => useQueryClient(), { - wrapper: createWrapper() + wrapper: createWrapper(), }); expect(result.current).toBeDefined(); }); @@ -48,7 +48,7 @@ describe("ApiProvider tests", () => { }; const { result } = renderHook(() => useLegacyContext(), { - wrapper: createWrapper({ onIndexFetched }) + wrapper: createWrapper({ onIndexFetched }), }); if (result.current?.onIndexFetched) { diff --git a/scm-ui/ui-api/src/ApiProvider.tsx b/scm-ui/ui-api/src/ApiProvider.tsx index 8319f55cb5..2622164e07 100644 --- a/scm-ui/ui-api/src/ApiProvider.tsx +++ b/scm-ui/ui-api/src/ApiProvider.tsx @@ -31,9 +31,9 @@ import { reset } from "./reset"; const queryClient = new QueryClient({ defaultOptions: { queries: { - retry: false - } - } + retry: false, + }, + }, }); type Props = LegacyContext & { diff --git a/scm-ui/ui-api/src/LegacyContext.test.tsx b/scm-ui/ui-api/src/LegacyContext.test.tsx index 1498a9a60c..48b0a10114 100644 --- a/scm-ui/ui-api/src/LegacyContext.test.tsx +++ b/scm-ui/ui-api/src/LegacyContext.test.tsx @@ -34,7 +34,7 @@ describe("LegacyContext tests", () => { it("should return provided context", () => { const { result } = renderHook(() => useLegacyContext(), { - wrapper: createWrapper() + wrapper: createWrapper(), }); expect(result.current).toBeDefined(); }); diff --git a/scm-ui/ui-api/src/admin.test.ts b/scm-ui/ui-api/src/admin.test.ts index 35b85bbb26..18a0045565 100644 --- a/scm-ui/ui-api/src/admin.test.ts +++ b/scm-ui/ui-api/src/admin.test.ts @@ -35,7 +35,7 @@ describe("Test admin hooks", () => { it("should get update info", async () => { const updateInfo: UpdateInfo = { latestVersion: "x.y.z", - link: "http://heartofgold@hitchhiker.com/x.y.z" + link: "http://heartofgold@hitchhiker.com/x.y.z", }; fetchMock.getOnce("/api/v2/updateInfo", updateInfo); @@ -43,7 +43,7 @@ describe("Test admin hooks", () => { setIndexLink(queryClient, "updateInfo", "/updateInfo"); const { result, waitFor } = renderHook(() => useUpdateInfo(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => { return !!result.current.data; diff --git a/scm-ui/ui-api/src/apiclient.test.ts b/scm-ui/ui-api/src/apiclient.test.ts index 9277540653..86f1c7b187 100644 --- a/scm-ui/ui-api/src/apiclient.test.ts +++ b/scm-ui/ui-api/src/apiclient.test.ts @@ -45,9 +45,9 @@ describe("error handling tests", () => { context: [ { type: "planet", - id: "earth" - } - ] + id: "earth", + }, + ], }; afterEach(() => { @@ -55,9 +55,9 @@ describe("error handling tests", () => { fetchMock.restore(); }); - it("should create a normal error, if the content type is not scmm-error", done => { + it("should create a normal error, if the content type is not scmm-error", (done) => { fetchMock.getOnce("/api/v2/error", { - status: 404 + status: 404, }); apiClient.get("/error").catch((err: Error) => { @@ -67,13 +67,13 @@ describe("error handling tests", () => { }); }); - it("should create an backend error, if the content type is scmm-error", done => { + it("should create an backend error, if the content type is scmm-error", (done) => { fetchMock.getOnce("/api/v2/error", { status: 404, headers: { - "Content-Type": "application/vnd.scmm-error+json;v=2" + "Content-Type": "application/vnd.scmm-error+json;v=2", }, - body: earthNotFoundError + body: earthNotFoundError, }); apiClient.get("/error").catch((err: BackendError) => { @@ -87,8 +87,8 @@ describe("error handling tests", () => { expect(err.context).toEqual([ { type: "planet", - id: "earth" - } + id: "earth", + }, ]); done(); }); diff --git a/scm-ui/ui-api/src/apiclient.ts b/scm-ui/ui-api/src/apiclient.ts index 547f6a9476..330b52cd4d 100644 --- a/scm-ui/ui-api/src/apiclient.ts +++ b/scm-ui/ui-api/src/apiclient.ts @@ -30,7 +30,7 @@ import { isBackendError, TOKEN_EXPIRED_ERROR_CODE, TokenExpiredError, - UnauthorizedError + UnauthorizedError, } from "./errors"; type SubscriptionEvent = { @@ -62,12 +62,7 @@ type SubscriptionArgument = MessageListeners | SubscriptionContext; type Cancel = () => void; -const sessionId = ( - Date.now().toString(36) + - Math.random() - .toString(36) - .substr(2, 5) -).toUpperCase(); +const sessionId = (Date.now().toString(36) + Math.random().toString(36).substr(2, 5)).toUpperCase(); const extractXsrfTokenFromJwt = (jwt: string) => { const parts = jwt.split("."); @@ -102,7 +97,7 @@ const createRequestHeaders = () => { // identify the web interface "X-SCM-Client": "WUI", // identify the window session - "X-SCM-Session-ID": sessionId + "X-SCM-Session-ID": sessionId, }; const xsrf = extractXsrfToken(); @@ -112,10 +107,10 @@ const createRequestHeaders = () => { return headers; }; -const applyFetchOptions: (p: RequestInit) => RequestInit = o => { +const applyFetchOptions: (p: RequestInit) => RequestInit = (o) => { if (o.headers) { o.headers = { - ...createRequestHeaders() + ...createRequestHeaders(), }; } else { o.headers = createRequestHeaders(); @@ -174,9 +169,7 @@ class ApiClient { requestListeners: RequestListener[] = []; get = (url: string): Promise => { - return this.request(url, applyFetchOptions({})) - .then(handleFailure) - .catch(this.notifyAndRethrow); + return this.request(url, applyFetchOptions({})).then(handleFailure).catch(this.notifyAndRethrow); }; post = ( @@ -203,7 +196,7 @@ class ApiClient { const options: RequestInit = { method: "POST", body: formData, - headers: additionalHeaders + headers: additionalHeaders, }; return this.httpRequestWithBinaryBody(options, url); }; @@ -214,22 +207,18 @@ class ApiClient { head = (url: string) => { let options: RequestInit = { - method: "HEAD" + method: "HEAD", }; options = applyFetchOptions(options); - return this.request(url, options) - .then(handleFailure) - .catch(this.notifyAndRethrow); + return this.request(url, options).then(handleFailure).catch(this.notifyAndRethrow); }; delete = (url: string): Promise => { let options: RequestInit = { - method: "DELETE" + method: "DELETE", }; options = applyFetchOptions(options); - return this.request(url, options) - .then(handleFailure) - .catch(this.notifyAndRethrow); + return this.request(url, options).then(handleFailure).catch(this.notifyAndRethrow); }; httpRequestWithJSONBody = ( @@ -241,7 +230,7 @@ class ApiClient { ): Promise => { const options: RequestInit = { method: method, - headers: additionalHeaders + headers: additionalHeaders, }; if (payload) { options.body = JSON.stringify(payload); @@ -257,7 +246,7 @@ class ApiClient { ) => { const options: RequestInit = { method: method, - headers: additionalHeaders + headers: additionalHeaders, }; options.body = payload; return this.httpRequestWithBinaryBody(options, url, "text/plain"); @@ -273,14 +262,12 @@ class ApiClient { options.headers["Content-Type"] = contentType; } - return this.request(url, options) - .then(handleFailure) - .catch(this.notifyAndRethrow); + return this.request(url, options).then(handleFailure).catch(this.notifyAndRethrow); }; subscribe(url: string, argument: SubscriptionArgument): Cancel { const es = new EventSource(createUrlWithIdentifiers(url), { - withCredentials: true + withCredentials: true, }); let listeners: MessageListeners; @@ -321,11 +308,11 @@ class ApiClient { }; private notifyRequestListeners = (url: string, options: RequestInit) => { - this.requestListeners.forEach(requestListener => requestListener(url, options)); + this.requestListeners.forEach((requestListener) => requestListener(url, options)); }; private notifyAndRethrow = (error: Error): never => { - this.errorListeners.forEach(errorListener => errorListener(error)); + this.errorListeners.forEach((errorListener) => errorListener(error)); throw error; }; } diff --git a/scm-ui/ui-api/src/base.test.ts b/scm-ui/ui-api/src/base.test.ts index 1b9a7d14c6..2103e5cb6c 100644 --- a/scm-ui/ui-api/src/base.test.ts +++ b/scm-ui/ui-api/src/base.test.ts @@ -34,7 +34,7 @@ describe("Test base api hooks", () => { describe("useIndex tests", () => { fetchMock.get("/api/v2/", { version: "x.y.z", - _links: {} + _links: {}, }); it("should return index", async () => { @@ -48,9 +48,9 @@ describe("Test base api hooks", () => { it("should call onIndexFetched of LegacyContext", async () => { let index: IndexResources; const context: LegacyContext = { - onIndexFetched: fetchedIndex => { + onIndexFetched: (fetchedIndex) => { index = fetchedIndex; - } + }, }; const { result, waitFor } = renderHook(() => useIndex(), { wrapper: createWrapper(context) }); await waitFor(() => { @@ -70,10 +70,10 @@ describe("Test base api hooks", () => { const queryClient = new QueryClient(); queryClient.setQueryData("index", { version: "x.y.z", - _links: {} + _links: {}, }); const { result } = renderHook(() => useIndexLink("spaceships"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); expect(result.current).toBeUndefined(); }); @@ -86,17 +86,17 @@ describe("Test base api hooks", () => { spaceships: [ { name: "heartOfGold", - href: "/spaceships/heartOfGold" + href: "/spaceships/heartOfGold", }, { name: "razorCrest", - href: "/spaceships/razorCrest" - } - ] - } + href: "/spaceships/razorCrest", + }, + ], + }, }); const { result } = renderHook(() => useIndexLink("spaceships"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); expect(result.current).toBeUndefined(); }); @@ -107,12 +107,12 @@ describe("Test base api hooks", () => { version: "x.y.z", _links: { spaceships: { - href: "/api/spaceships" - } - } + href: "/api/spaceships", + }, + }, }); const { result } = renderHook(() => useIndexLink("spaceships"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); expect(result.current).toBe("/api/spaceships"); }); @@ -130,12 +130,12 @@ describe("Test base api hooks", () => { version: "x.y.z", _links: { spaceships: { - href: "/api/spaceships" - } - } + href: "/api/spaceships", + }, + }, }); const { result } = renderHook(() => useIndexLinks(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); expect((result.current!.spaceships as Link).href).toBe("/api/spaceships"); }); @@ -150,10 +150,10 @@ describe("Test base api hooks", () => { it("should return version", () => { const queryClient = new QueryClient(); queryClient.setQueryData("index", { - version: "x.y.z" + version: "x.y.z", }); const { result } = renderHook(() => useVersion(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); expect(result.current).toBe("x.y.z"); }); @@ -164,10 +164,10 @@ describe("Test base api hooks", () => { const queryClient = new QueryClient(); queryClient.setQueryData("index", { version: "x.y.z", - _links: {} + _links: {}, }); const { result } = renderHook(() => useRequiredIndexLink("spaceships"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); expect(result.error).toBeDefined(); }); @@ -178,12 +178,12 @@ describe("Test base api hooks", () => { version: "x.y.z", _links: { spaceships: { - href: "/api/spaceships" - } - } + href: "/api/spaceships", + }, + }, }); const { result } = renderHook(() => useRequiredIndexLink("spaceships"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); expect(result.current).toBe("/api/spaceships"); }); @@ -196,19 +196,19 @@ describe("Test base api hooks", () => { version: "x.y.z", _links: { spaceships: { - href: "/spaceships" - } - } + href: "/spaceships", + }, + }, }); const spaceship = { - name: "heartOfGold" + name: "heartOfGold", }; fetchMock.get("/api/v2/spaceships", spaceship); const { result, waitFor } = renderHook(() => useIndexJsonResource("spaceships"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => { @@ -223,11 +223,11 @@ describe("Test base api hooks", () => { const queryClient = new QueryClient(); queryClient.setQueryData("index", { version: "x.y.z", - _links: {} + _links: {}, }); const { result } = renderHook(() => useIndexJsonResource<{}>("spaceships"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); expect(result.current.isLoading).toBe(false); diff --git a/scm-ui/ui-api/src/config.test.ts b/scm-ui/ui-api/src/config.test.ts index 8b357b8354..900c297fc2 100644 --- a/scm-ui/ui-api/src/config.test.ts +++ b/scm-ui/ui-api/src/config.test.ts @@ -60,9 +60,9 @@ describe("Test config hooks", () => { skipFailedAuthenticators: false, _links: { update: { - href: "/config" - } - } + href: "/config", + }, + }, }; afterEach(() => { @@ -75,7 +75,7 @@ describe("Test config hooks", () => { setIndexLink(queryClient, "config", "/config"); fetchMock.get("/api/v2/config", config); const { result, waitFor } = renderHook(() => useConfig(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(config); @@ -89,15 +89,15 @@ describe("Test config hooks", () => { const newConfig = { ...config, - baseUrl: "/hog" + baseUrl: "/hog", }; fetchMock.putOnce("/api/v2/config", { - status: 200 + status: 200, }); const { result, waitForNextUpdate } = renderHook(() => useUpdateConfig(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { diff --git a/scm-ui/ui-api/src/config.ts b/scm-ui/ui-api/src/config.ts index 78bdd81239..6355cbb132 100644 --- a/scm-ui/ui-api/src/config.ts +++ b/scm-ui/ui-api/src/config.ts @@ -30,20 +30,20 @@ import { requiredLink } from "./links"; export const useConfig = (): ApiResult => { const indexLink = useIndexLink("config"); - return useQuery("config", () => apiClient.get(indexLink!).then(response => response.json()), { - enabled: !!indexLink + return useQuery("config", () => apiClient.get(indexLink!).then((response) => response.json()), { + enabled: !!indexLink, }); }; export const useUpdateConfig = () => { const queryClient = useQueryClient(); const { mutate, isLoading, error, data, reset } = useMutation( - config => { + (config) => { const updateUrl = requiredLink(config, "update"); return apiClient.put(updateUrl, config, "application/vnd.scmm-config+json;v=2"); }, { - onSuccess: () => queryClient.invalidateQueries("config") + onSuccess: () => queryClient.invalidateQueries("config"), } ); return { @@ -51,6 +51,6 @@ export const useUpdateConfig = () => { isLoading, error, isUpdated: !!data, - reset + reset, }; }; diff --git a/scm-ui/ui-api/src/diff.test.ts b/scm-ui/ui-api/src/diff.test.ts index fb81058441..c40ba9b636 100644 --- a/scm-ui/ui-api/src/diff.test.ts +++ b/scm-ui/ui-api/src/diff.test.ts @@ -50,26 +50,25 @@ describe("Test diff", () => { content: "0", type: "insert", lineNumber: 1, - isInsert: true - } - ] - } + isInsert: true, + }, + ], + }, ], _links: { lines: { - href: - "/api/v2/repositories/scmadmin/HeartOfGold-git/content/one_to_onehundred/0.txt?start={start}&end={end}", - templated: true - } - } - } + href: "/api/v2/repositories/scmadmin/HeartOfGold-git/content/one_to_onehundred/0.txt?start={start}&end={end}", + templated: true, + }, + }, + }, ], partial: false, _links: { self: { - href: "/api/v2/diff" - } - } + href: "/api/v2/diff", + }, + }, }; const partialDiff1: Diff = { @@ -93,29 +92,28 @@ describe("Test diff", () => { content: "0", type: "insert", lineNumber: 1, - isInsert: true - } - ] - } + isInsert: true, + }, + ], + }, ], _links: { lines: { - href: - "/api/v2/repositories/scmadmin/HeartOfGold-git/content/one_to_onehundred/0.txt?start={start}&end={end}", - templated: true - } - } - } + href: "/api/v2/repositories/scmadmin/HeartOfGold-git/content/one_to_onehundred/0.txt?start={start}&end={end}", + templated: true, + }, + }, + }, ], partial: true, _links: { self: { - href: "/diff" + href: "/diff", }, next: { - href: "/diff?offset=1&limit=1" - } - } + href: "/diff?offset=1&limit=1", + }, + }, }; const partialDiff2: Diff = { @@ -139,26 +137,25 @@ describe("Test diff", () => { content: "1", type: "insert", lineNumber: 1, - isInsert: true - } - ] - } + isInsert: true, + }, + ], + }, ], _links: { lines: { - href: - "/api/v2/repositories/scmadmin/HeartOfGold-git/content/one_to_onehundred/1.txt?start={start}&end={end}", - templated: true - } - } - } + href: "/api/v2/repositories/scmadmin/HeartOfGold-git/content/one_to_onehundred/1.txt?start={start}&end={end}", + templated: true, + }, + }, + }, ], partial: false, _links: { self: { - href: "/diff" - } - } + href: "/diff", + }, + }, }; beforeEach(() => { @@ -168,10 +165,10 @@ describe("Test diff", () => { it("should return simple parsed diff", async () => { fetchMock.getOnce("/api/v2/diff", { body: simpleDiff, - headers: { "Content-Type": "application/vnd.scmm-diffparsed+json;v=2" } + headers: { "Content-Type": "application/vnd.scmm-diffparsed+json;v=2" }, }); const { result, waitFor } = renderHook(() => useDiff("/diff"), { - wrapper: createWrapper() + wrapper: createWrapper(), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(simpleDiff); @@ -188,10 +185,10 @@ describe("Test diff", () => { +i am new! \\ No newline at end of file `, - headers: { "Content-Type": "text/plain" } + headers: { "Content-Type": "text/plain" }, }); const { result, waitFor } = renderHook(() => useDiff("/diff"), { - wrapper: createWrapper() + wrapper: createWrapper(), }); await waitFor(() => !!result.current.data); expect(result.current.data?.files).toHaveLength(1); @@ -200,14 +197,14 @@ describe("Test diff", () => { it("should return parsed diff in multiple chunks", async () => { fetchMock.getOnce("/api/v2/diff?limit=1", { body: partialDiff1, - headers: { "Content-Type": "application/vnd.scmm-diffparsed+json;v=2" } + headers: { "Content-Type": "application/vnd.scmm-diffparsed+json;v=2" }, }); fetchMock.getOnce("/api/v2/diff?offset=1&limit=1", { body: partialDiff2, - headers: { "Content-Type": "application/vnd.scmm-diffparsed+json;v=2" } + headers: { "Content-Type": "application/vnd.scmm-diffparsed+json;v=2" }, }); const { result, waitFor, waitForNextUpdate } = renderHook(() => useDiff("/diff?limit=1"), { - wrapper: createWrapper() + wrapper: createWrapper(), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(partialDiff1); @@ -226,10 +223,10 @@ describe("Test diff", () => { it("should append query parameters to url which has already query params", async () => { fetchMock.getOnce("/api/v2/diff?format=GIT&limit=25", { body: simpleDiff, - headers: { "Content-Type": "application/vnd.scmm-diffparsed+json;v=2" } + headers: { "Content-Type": "application/vnd.scmm-diffparsed+json;v=2" }, }); const { result, waitFor } = renderHook(() => useDiff("/diff?format=GIT", { limit: 25 }), { - wrapper: createWrapper() + wrapper: createWrapper(), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(simpleDiff); diff --git a/scm-ui/ui-api/src/errors.test.ts b/scm-ui/ui-api/src/errors.test.ts index 9c9ea0149e..a61c7d7a6e 100644 --- a/scm-ui/ui-api/src/errors.test.ts +++ b/scm-ui/ui-api/src/errors.test.ts @@ -32,10 +32,10 @@ describe("test createBackendError", () => { context: [ { type: "planet", - id: "earth" - } + id: "earth", + }, ], - violations: [] + violations: [], }; it("should return a default backend error", () => { diff --git a/scm-ui/ui-api/src/groups.test.ts b/scm-ui/ui-api/src/groups.test.ts index b8eba35f26..9d75ddcf22 100644 --- a/scm-ui/ui-api/src/groups.test.ts +++ b/scm-ui/ui-api/src/groups.test.ts @@ -40,21 +40,21 @@ describe("Test group hooks", () => { type: "xml", _links: { delete: { - href: "/groups/jedis" + href: "/groups/jedis", }, update: { - href: "/groups/jedis" - } + href: "/groups/jedis", + }, }, _embedded: { - members: [] - } + members: [], + }, }; const jedisCollection = { _embedded: { - groups: [jedis] - } + groups: [jedis], + }, }; afterEach(() => { @@ -67,7 +67,7 @@ describe("Test group hooks", () => { setIndexLink(queryClient, "groups", "/groups"); fetchMock.get("/api/v2/groups", jedisCollection); const { result, waitFor } = renderHook(() => useGroups(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(jedisCollection); @@ -78,11 +78,11 @@ describe("Test group hooks", () => { setIndexLink(queryClient, "groups", "/groups"); fetchMock.get("/api/v2/groups", jedisCollection, { query: { - page: "42" - } + page: "42", + }, }); const { result, waitFor } = renderHook(() => useGroups({ page: 42 }), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(jedisCollection); @@ -93,11 +93,11 @@ describe("Test group hooks", () => { setIndexLink(queryClient, "groups", "/groups"); fetchMock.get("/api/v2/groups", jedisCollection, { query: { - q: "jedis" - } + q: "jedis", + }, }); const { result, waitFor } = renderHook(() => useGroups({ search: "jedis" }), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(jedisCollection); @@ -108,7 +108,7 @@ describe("Test group hooks", () => { setIndexLink(queryClient, "groups", "/groups"); fetchMock.get("/api/v2/groups", jedisCollection); const { result, waitFor } = renderHook(() => useGroups(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(queryClient.getQueryData(["group", "jedis"])).toEqual(jedis); @@ -121,7 +121,7 @@ describe("Test group hooks", () => { setIndexLink(queryClient, "groups", "/groups"); fetchMock.get("/api/v2/groups/jedis", jedis); const { result, waitFor } = renderHook(() => useGroup("jedis"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(jedis); @@ -136,14 +136,14 @@ describe("Test group hooks", () => { fetchMock.postOnce("/api/v2/groups", { status: 201, headers: { - Location: "/groups/jedis" - } + Location: "/groups/jedis", + }, }); fetchMock.getOnce("/api/v2/groups/jedis", jedis); const { result, waitForNextUpdate } = renderHook(() => useCreateGroup(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -160,13 +160,13 @@ describe("Test group hooks", () => { setIndexLink(queryClient, "groups", "/groups"); fetchMock.postOnce("/api/v2/groups", { - status: 201 + status: 201, }); fetchMock.getOnce("/api/v2/groups/jedis", jedis); const { result, waitForNextUpdate } = renderHook(() => useCreateGroup(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -185,11 +185,11 @@ describe("Test group hooks", () => { setIndexLink(queryClient, "groups", "/groups"); fetchMock.deleteOnce("/api/v2/groups/jedis", { - status: 200 + status: 200, }); const { result, waitForNextUpdate } = renderHook(() => useDeleteGroup(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -212,17 +212,17 @@ describe("Test group hooks", () => { const newJedis = { ...jedis, - description: "may the 4th be with you" + description: "may the 4th be with you", }; fetchMock.putOnce("/api/v2/groups/jedis", { - status: 200 + status: 200, }); fetchMock.getOnce("/api/v2/groups/jedis", newJedis); const { result, waitForNextUpdate } = renderHook(() => useUpdateGroup(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { diff --git a/scm-ui/ui-api/src/links.test.ts b/scm-ui/ui-api/src/links.test.ts index 26c1b75d2e..0f49d8643f 100644 --- a/scm-ui/ui-api/src/links.test.ts +++ b/scm-ui/ui-api/src/links.test.ts @@ -29,9 +29,9 @@ describe("requireLink tests", () => { { _links: { spaceship: { - href: "/v2/ship" - } - } + href: "/v2/ship", + }, + }, }, "spaceship" ); @@ -49,14 +49,14 @@ describe("requireLink tests", () => { spaceship: [ { name: "one", - href: "/v2/one" + href: "/v2/one", }, { name: "two", - href: "/v2/two" - } - ] - } + href: "/v2/two", + }, + ], + }, }; expect(() => requiredLink(object, "spaceship")).toThrowError(); }); @@ -67,14 +67,14 @@ describe("requireLink tests", () => { spaceship: [ { name: "one", - href: "/v2/one" + href: "/v2/one", }, { name: "two", - href: "/v2/two" - } - ] - } + href: "/v2/two", + }, + ], + }, }; expect(requiredLink(object, "spaceship", "one")).toBe("/v2/one"); }); @@ -85,14 +85,14 @@ describe("requireLink tests", () => { spaceship: [ { name: "one", - href: "/v2/one" + href: "/v2/one", }, { name: "two", - href: "/v2/two" - } - ] - } + href: "/v2/two", + }, + ], + }, }; expect(() => requiredLink(object, "spaceship", "three")).toThrowError(); }); diff --git a/scm-ui/ui-api/src/login.test.ts b/scm-ui/ui-api/src/login.test.ts index 9b332d6a52..cefc9d0a32 100644 --- a/scm-ui/ui-api/src/login.test.ts +++ b/scm-ui/ui-api/src/login.test.ts @@ -37,7 +37,7 @@ describe("Test login hooks", () => { name: "tricia", displayName: "Tricia", groups: [], - _links: {} + _links: {}, }; describe("useMe tests", () => { @@ -45,7 +45,7 @@ describe("Test login hooks", () => { name: "tricia", displayName: "Tricia", groups: [], - _links: {} + _links: {}, }); it("should return me", async () => { @@ -65,9 +65,9 @@ describe("Test login hooks", () => { let me: Me; const context: LegacyContext = { - onMeFetched: fetchedMe => { + onMeFetched: (fetchedMe) => { me = fetchedMe; - } + }, }; const { result, waitFor } = renderHook(() => useMe(), { wrapper: createWrapper(context, queryClient) }); @@ -130,7 +130,7 @@ describe("Test login hooks", () => { name: "_anonymous", displayName: "Anonymous", groups: [], - _links: {} + _links: {}, }); const { result } = renderHook(() => useSubject(), { wrapper: createWrapper(undefined, queryClient) }); @@ -158,8 +158,8 @@ describe("Test login hooks", () => { cookie: true, grant_type: "password", username: "tricia", - password: "hitchhikersSecret!" - } + password: "hitchhikersSecret!", + }, }); // required because we invalidate the whole cache and react-query refetches the index @@ -167,13 +167,13 @@ describe("Test login hooks", () => { version: "x.y.z", _links: { login: { - href: "/second/login" - } - } + href: "/second/login", + }, + }, }); const { result, waitForNextUpdate } = renderHook(() => useLogin(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); const { login } = result.current; expect(login).toBeDefined(); @@ -194,7 +194,7 @@ describe("Test login hooks", () => { queryClient.setQueryData("me", tricia); const { result } = renderHook(() => useLogin(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); expect(result.current.login).toBeUndefined(); @@ -209,7 +209,7 @@ describe("Test login hooks", () => { fetchMock.deleteOnce("/api/v2/logout", {}); const { result, waitForNextUpdate } = renderHook(() => useLogout(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); const { logout } = result.current; expect(logout).toBeDefined(); @@ -229,7 +229,7 @@ describe("Test login hooks", () => { setEmptyIndex(queryClient); const { result } = renderHook(() => useLogout(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); const { logout } = result.current; diff --git a/scm-ui/ui-api/src/login.ts b/scm-ui/ui-api/src/login.ts index dd56507eee..d68432ce39 100644 --- a/scm-ui/ui-api/src/login.ts +++ b/scm-ui/ui-api/src/login.ts @@ -32,13 +32,13 @@ import { useReset } from "./reset"; export const useMe = (): ApiResult => { const legacy = useLegacyContext(); const link = useIndexLink("me"); - return useQuery("me", () => apiClient.get(link!).then(response => response.json()), { + return useQuery("me", () => apiClient.get(link!).then((response) => response.json()), { enabled: !!link, - onSuccess: me => { + onSuccess: (me) => { if (legacy.onMeFetched) { legacy.onMeFetched(me); } - } + }, }); }; @@ -60,7 +60,7 @@ export const useSubject = () => { isAnonymous, isLoading, error, - me + me, }; }; @@ -75,9 +75,9 @@ export const useLogin = () => { const link = useIndexLink("login"); const reset = useReset(); const { mutate, isLoading, error } = useMutation( - credentials => apiClient.post(link!, credentials), + (credentials) => apiClient.post(link!, credentials), { - onSuccess: reset + onSuccess: reset, } ); @@ -91,7 +91,7 @@ export const useLogin = () => { return { login: link ? login : undefined, isLoading, - error + error, }; }; @@ -104,14 +104,14 @@ export const useLogout = () => { const reset = useReset(); const { mutate, isLoading, error, data } = useMutation( - () => apiClient.delete(link!).then(r => (r.status === 200 ? r.json() : {})), + () => apiClient.delete(link!).then((r) => (r.status === 200 ? r.json() : {})), { - onSuccess: response => { + onSuccess: (response) => { if (response?.logoutRedirect) { window.location.assign(response.logoutRedirect); } return reset(); - } + }, } ); @@ -122,6 +122,6 @@ export const useLogout = () => { return { logout: link && !data ? logout : undefined, isLoading, - error + error, }; }; diff --git a/scm-ui/ui-api/src/namespaces.test.ts b/scm-ui/ui-api/src/namespaces.test.ts index badc05cb13..abb24640bb 100644 --- a/scm-ui/ui-api/src/namespaces.test.ts +++ b/scm-ui/ui-api/src/namespaces.test.ts @@ -38,14 +38,14 @@ describe("Test namespace hooks", () => { namespaces: [ { namespace: "spaceships", - _links: {} - } - ] - } + _links: {}, + }, + ], + }, }); const { result, waitFor } = renderHook(() => useNamespaces(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => { return !!result.current.data; @@ -61,11 +61,11 @@ describe("Test namespace hooks", () => { fetchMock.get("/api/v2/ns", { current: "awesome", available: [], - _links: {} + _links: {}, }); const { result, waitFor } = renderHook(() => useNamespaceStrategies(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => { return !!result.current.data; @@ -80,11 +80,11 @@ describe("Test namespace hooks", () => { setIndexLink(queryClient, "namespaces", "/ns"); fetchMock.get("/api/v2/ns/awesome", { namespace: "awesome", - _links: {} + _links: {}, }); const { result, waitFor } = renderHook(() => useNamespace("awesome"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => { return !!result.current.data; diff --git a/scm-ui/ui-api/src/namespaces.ts b/scm-ui/ui-api/src/namespaces.ts index 6554f9d5b9..7f36f8805c 100644 --- a/scm-ui/ui-api/src/namespaces.ts +++ b/scm-ui/ui-api/src/namespaces.ts @@ -34,7 +34,7 @@ export const useNamespaces = () => { export const useNamespace = (name: string): ApiResult => { const namespacesLink = useRequiredIndexLink("namespaces"); return useQuery(["namespace", name], () => - apiClient.get(concat(namespacesLink, name)).then(response => response.json()) + apiClient.get(concat(namespacesLink, name)).then((response) => response.json()) ); }; diff --git a/scm-ui/ui-api/src/plugins.ts b/scm-ui/ui-api/src/plugins.ts index 634b5dcedb..d3f93307f8 100644 --- a/scm-ui/ui-api/src/plugins.ts +++ b/scm-ui/ui-api/src/plugins.ts @@ -40,26 +40,28 @@ const waitForRestartAfter = ( const endTime = Number(new Date()) + 60000; let started = false; - const executor = (data: T) => (resolve: (result: T) => void, reject: (error: Error) => void) => { - // we need some initial delay - if (!started) { - started = true; - setTimeout(executor(data), initialDelay, resolve, reject); - } else { - apiClient - .get("") - .then(() => resolve(data)) - .catch(() => { - if (Number(new Date()) < endTime) { - setTimeout(executor(data), timeout, resolve, reject); - } else { - reject(new Error("timeout reached")); - } - }); - } - }; + const executor = + (data: T) => + (resolve: (result: T) => void, reject: (error: Error) => void) => { + // we need some initial delay + if (!started) { + started = true; + setTimeout(executor(data), initialDelay, resolve, reject); + } else { + apiClient + .get("") + .then(() => resolve(data)) + .catch(() => { + if (Number(new Date()) < endTime) { + setTimeout(executor(data), timeout, resolve, reject); + } else { + reject(new Error("timeout reached")); + } + }); + } + }; - return promise.then(data => new Promise(executor(data))); + return promise.then((data) => new Promise(executor(data))); }; export type UseAvailablePluginsOptions = { @@ -70,10 +72,10 @@ export const useAvailablePlugins = ({ enabled }: UseAvailablePluginsOptions = {} const indexLink = useRequiredIndexLink("availablePlugins"); return useQuery( ["plugins", "available"], - () => apiClient.get(indexLink).then(response => response.json()), + () => apiClient.get(indexLink).then((response) => response.json()), { enabled, - retry: 3 + retry: 3, } ); }; @@ -86,10 +88,10 @@ export const useInstalledPlugins = ({ enabled }: UseInstalledPluginsOptions = {} const indexLink = useRequiredIndexLink("installedPlugins"); return useQuery( ["plugins", "installed"], - () => apiClient.get(indexLink).then(response => response.json()), + () => apiClient.get(indexLink).then((response) => response.json()), { enabled, - retry: 3 + retry: 3, } ); }; @@ -98,10 +100,10 @@ export const usePendingPlugins = (): ApiResult => { const indexLink = useIndexLink("pendingPlugins"); return useQuery( ["plugins", "pending"], - () => apiClient.get(indexLink!).then(response => response.json()), + () => apiClient.get(indexLink!).then((response) => response.json()), { enabled: !!indexLink, - retry: 3 + retry: 3, } ); }; @@ -133,19 +135,19 @@ export const useInstallPlugin = () => { return promise; }, { - onSuccess: () => queryClient.invalidateQueries("plugins") + onSuccess: () => queryClient.invalidateQueries("plugins"), } ); return { install: (plugin: Plugin, restartOptions: RestartOptions = {}) => mutate({ plugin, - restartOptions + restartOptions, }), isLoading, error, data, - isInstalled: !!data + isInstalled: !!data, }; }; @@ -160,18 +162,18 @@ export const useUninstallPlugin = () => { return promise; }, { - onSuccess: () => queryClient.invalidateQueries("plugins") + onSuccess: () => queryClient.invalidateQueries("plugins"), } ); return { uninstall: (plugin: Plugin, restartOptions: RestartOptions = {}) => mutate({ plugin, - restartOptions + restartOptions, }), isLoading, error, - isUninstalled: !!data + isUninstalled: !!data, }; }; @@ -194,18 +196,18 @@ export const useUpdatePlugins = () => { return promise; }, { - onSuccess: () => queryClient.invalidateQueries("plugins") + onSuccess: () => queryClient.invalidateQueries("plugins"), } ); return { update: (plugin: Plugin | PluginCollection, restartOptions: RestartOptions = {}) => mutate({ plugins: plugin, - restartOptions + restartOptions, }), isLoading, error, - isUpdated: !!data + isUpdated: !!data, }; }; @@ -220,7 +222,7 @@ export const useExecutePendingPlugins = () => { ({ pending, restartOptions }) => waitForRestartAfter(apiClient.post(requiredLink(pending, "execute")), restartOptions), { - onSuccess: () => queryClient.invalidateQueries("plugins") + onSuccess: () => queryClient.invalidateQueries("plugins"), } ); return { @@ -228,22 +230,22 @@ export const useExecutePendingPlugins = () => { mutate({ pending, restartOptions }), isLoading, error, - isExecuted: !!data + isExecuted: !!data, }; }; export const useCancelPendingPlugins = () => { const queryClient = useQueryClient(); const { mutate, isLoading, error, data } = useMutation( - pending => apiClient.post(requiredLink(pending, "cancel")), + (pending) => apiClient.post(requiredLink(pending, "cancel")), { - onSuccess: () => queryClient.invalidateQueries("plugins") + onSuccess: () => queryClient.invalidateQueries("plugins"), } ); return { update: (pending: PendingPlugins) => mutate(pending), isLoading, error, - isCancelled: !!data + isCancelled: !!data, }; }; diff --git a/scm-ui/ui-api/src/repository-roles.test.ts b/scm-ui/ui-api/src/repository-roles.test.ts index 10a05474ea..0f274ad096 100644 --- a/scm-ui/ui-api/src/repository-roles.test.ts +++ b/scm-ui/ui-api/src/repository-roles.test.ts @@ -32,8 +32,9 @@ import { act } from "react-test-renderer"; import { useCreateRepositoryRole, useDeleteRepositoryRole, - useRepositoryRole, useRepositoryRoles, - useUpdateRepositoryRole + useRepositoryRole, + useRepositoryRoles, + useUpdateRepositoryRole, } from "./repository-roles"; describe("Test repository-roles hooks", () => { @@ -43,12 +44,12 @@ describe("Test repository-roles hooks", () => { verbs: ["rocking"], _links: { delete: { - href: "/repositoryRoles/theroleingstones" + href: "/repositoryRoles/theroleingstones", }, update: { - href: "/repositoryRoles/theroleingstones" - } - } + href: "/repositoryRoles/theroleingstones", + }, + }, }; const roleCollection: RepositoryRoleCollection = { @@ -56,8 +57,8 @@ describe("Test repository-roles hooks", () => { pageTotal: 0, _links: {}, _embedded: { - repositoryRoles: [role] - } + repositoryRoles: [role], + }, }; afterEach(() => { @@ -70,7 +71,7 @@ describe("Test repository-roles hooks", () => { setIndexLink(queryClient, "repositoryRoles", "/repositoryRoles"); fetchMock.get("/api/v2/repositoryRoles", roleCollection); const { result, waitFor } = renderHook(() => useRepositoryRoles(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(roleCollection); @@ -81,11 +82,11 @@ describe("Test repository-roles hooks", () => { setIndexLink(queryClient, "repositoryRoles", "/repositoryRoles"); fetchMock.get("/api/v2/repositoryRoles", roleCollection, { query: { - page: "42" - } + page: "42", + }, }); const { result, waitFor } = renderHook(() => useRepositoryRoles({ page: 42 }), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(roleCollection); @@ -96,7 +97,7 @@ describe("Test repository-roles hooks", () => { setIndexLink(queryClient, "repositoryRoles", "/repositoryRoles"); fetchMock.get("/api/v2/repositoryRoles", roleCollection); const { result, waitFor } = renderHook(() => useRepositoryRoles(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(queryClient.getQueryData(["repositoryRole", roleName])).toEqual(role); @@ -109,7 +110,7 @@ describe("Test repository-roles hooks", () => { setIndexLink(queryClient, "repositoryRoles", "/repositoryRoles"); fetchMock.get("/api/v2/repositoryRoles/" + roleName, role); const { result, waitFor } = renderHook(() => useRepositoryRole(roleName), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(role); @@ -124,14 +125,14 @@ describe("Test repository-roles hooks", () => { fetchMock.postOnce("/api/v2/repositoryRoles", { status: 201, headers: { - Location: "/repositoryRoles/" + roleName - } + Location: "/repositoryRoles/" + roleName, + }, }); fetchMock.getOnce("/api/v2/repositoryRoles/" + roleName, role); const { result, waitForNextUpdate } = renderHook(() => useCreateRepositoryRole(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -148,13 +149,13 @@ describe("Test repository-roles hooks", () => { setIndexLink(queryClient, "repositoryRoles", "/repositoryRoles"); fetchMock.postOnce("/api/v2/repositoryRoles", { - status: 201 + status: 201, }); fetchMock.getOnce("/api/v2/repositoryRoles/" + roleName, role); const { result, waitForNextUpdate } = renderHook(() => useCreateRepositoryRole(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -173,11 +174,11 @@ describe("Test repository-roles hooks", () => { setIndexLink(queryClient, "repositoryRoles", "/repositoryRoles"); fetchMock.deleteOnce("/api/v2/repositoryRoles/" + roleName, { - status: 200 + status: 200, }); const { result, waitForNextUpdate } = renderHook(() => useDeleteRepositoryRole(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -200,15 +201,15 @@ describe("Test repository-roles hooks", () => { const newRole: RepositoryRole = { ...role, - name: "newname" + name: "newname", }; fetchMock.putOnce("/api/v2/repositoryRoles/" + roleName, { - status: 200 + status: 200, }); const { result, waitForNextUpdate } = renderHook(() => useUpdateRepositoryRole(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { diff --git a/scm-ui/ui-api/src/reset.ts b/scm-ui/ui-api/src/reset.ts index 4c043abbb7..4a033df076 100644 --- a/scm-ui/ui-api/src/reset.ts +++ b/scm-ui/ui-api/src/reset.ts @@ -25,7 +25,7 @@ import { QueryClient, useQueryClient } from "react-query"; export const reset = (queryClient: QueryClient) => { queryClient.removeQueries({ - predicate: ({ queryKey }) => queryKey !== "index" + predicate: ({ queryKey }) => queryKey !== "index", }); return queryClient.invalidateQueries("index"); }; diff --git a/scm-ui/ui-api/src/sources.test.ts b/scm-ui/ui-api/src/sources.test.ts index bb87d3dbc2..bafb5b6f51 100644 --- a/scm-ui/ui-api/src/sources.test.ts +++ b/scm-ui/ui-api/src/sources.test.ts @@ -35,9 +35,9 @@ describe("Test sources hooks", () => { type: "git", _links: { sources: { - href: "/src" - } - } + href: "/src", + }, + }, }; const readmeMd: File = { @@ -49,8 +49,8 @@ describe("Test sources hooks", () => { description: "Awesome readme", _links: {}, _embedded: { - children: [] - } + children: [], + }, }; const rootDirectory: File = { @@ -60,8 +60,8 @@ describe("Test sources hooks", () => { revision: "abc", _links: {}, _embedded: { - children: [readmeMd] - } + children: [readmeMd], + }, }; const sepecialMd: File = { @@ -73,20 +73,20 @@ describe("Test sources hooks", () => { description: "Awesome special file", _links: {}, _embedded: { - children: [] - } + children: [], + }, }; const sepecialMdPartial: File = { ...sepecialMd, partialResult: true, - computationAborted: false + computationAborted: false, }; const sepecialMdComputationAborted: File = { ...sepecialMd, partialResult: true, - computationAborted: true + computationAborted: true, }; const mainDirectoryTruncated: File = { @@ -97,20 +97,20 @@ describe("Test sources hooks", () => { truncated: true, _links: { proceed: { - href: "src/2" - } + href: "src/2", + }, }, _embedded: { - children: [] - } + children: [], + }, }; const mainDirectory: File = { ...mainDirectoryTruncated, truncated: false, _embedded: { - children: [sepecialMd] - } + children: [sepecialMd], + }, }; beforeEach(() => { @@ -128,7 +128,7 @@ describe("Test sources hooks", () => { const queryClient = createInfiniteCachingClient(); fetchMock.getOnce("/api/v2/src", rootDirectory); const { result, waitFor } = renderHook(() => useSources(puzzle42), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(rootDirectory); @@ -138,7 +138,7 @@ describe("Test sources hooks", () => { const queryClient = createInfiniteCachingClient(); fetchMock.getOnce("/api/v2/src/abc/README.md", readmeMd); const { result, waitFor } = renderHook(() => useSources(puzzle42, { revision: "abc", path: "README.md" }), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(readmeMd); @@ -149,7 +149,7 @@ describe("Test sources hooks", () => { fetchMock.getOnce("/api/v2/src", mainDirectoryTruncated); fetchMock.getOnce("/api/v2/src/2", mainDirectory); const { result, waitFor, waitForNextUpdate } = renderHook(() => useSources(puzzle42), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); @@ -172,11 +172,11 @@ describe("Test sources hooks", () => { { ...mainDirectory, _embedded: { - children: [sepecialMdPartial] - } + children: [sepecialMdPartial], + }, }, { - repeat: 1 + repeat: 1, } ); fetchMock.get( @@ -184,17 +184,17 @@ describe("Test sources hooks", () => { { ...mainDirectory, _embedded: { - children: [sepecialMd] - } + children: [sepecialMd], + }, }, { repeat: 1, - overwriteRoutes: false + overwriteRoutes: false, } ); const { result, waitFor } = renderHook(() => useSources(puzzle42, { refetchPartialInterval: 100 }), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!firstChild(result.current.data)); @@ -210,23 +210,23 @@ describe("Test sources hooks", () => { // should never be called fetchMock.getOnce("/api/v2/src/abc/main/special.md", sepecialMd, { repeat: 1, - overwriteRoutes: false + overwriteRoutes: false, }); const { result, waitFor } = renderHook( () => useSources(puzzle42, { revision: "abc", path: "main/special.md", - refetchPartialInterval: 100 + refetchPartialInterval: 100, }), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), } ); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(sepecialMdComputationAborted); - await new Promise(r => setTimeout(r, 200)); + await new Promise((r) => setTimeout(r, 200)); expect(result.current.data).toEqual(sepecialMdComputationAborted); }); }); diff --git a/scm-ui/ui-api/src/sources.ts b/scm-ui/ui-api/src/sources.ts index c6800f6d73..9a48bc541f 100644 --- a/scm-ui/ui-api/src/sources.ts +++ b/scm-ui/ui-api/src/sources.ts @@ -37,25 +37,25 @@ export type UseSourcesOptions = { const UseSourcesDefaultOptions: UseSourcesOptions = { enabled: true, - refetchPartialInterval: 3000 + refetchPartialInterval: 3000, }; export const useSources = (repository: Repository, opts: UseSourcesOptions = UseSourcesDefaultOptions) => { const options = { ...UseSourcesDefaultOptions, - ...opts + ...opts, }; const link = createSourcesLink(repository, options); const { isLoading, error, data, isFetchingNextPage, fetchNextPage, refetch } = useInfiniteQuery( repoQueryKey(repository, "sources", options.revision || "", options.path || ""), ({ pageParam }) => { - return apiClient.get(pageParam || link).then(response => response.json()); + return apiClient.get(pageParam || link).then((response) => response.json()); }, { enabled: options.enabled, - getNextPageParam: lastPage => { + getNextPageParam: (lastPage) => { return (lastPage._links.proceed as Link)?.href; - } + }, } ); @@ -64,7 +64,7 @@ export const useSources = (repository: Repository, opts: UseSourcesOptions = Use const intervalId = setInterval(() => { if (isPartial(file)) { refetch({ - throwOnError: true + throwOnError: true, }); } }, options.refetchPartialInterval); @@ -79,7 +79,7 @@ export const useSources = (repository: Repository, opts: UseSourcesOptions = Use fetchNextPage: () => { // wrapped because we do not want to leak react-query types in our api fetchNextPage(); - } + }, }; }; @@ -108,8 +108,8 @@ const merge = (files?: File[]): File | undefined => { ...lastPage, _embedded: { ...lastPage._embedded, - children - } + children, + }, }; }; diff --git a/scm-ui/ui-api/src/tags.test.ts b/scm-ui/ui-api/src/tags.test.ts index e027eb73e3..165548fb1b 100644 --- a/scm-ui/ui-api/src/tags.test.ts +++ b/scm-ui/ui-api/src/tags.test.ts @@ -36,9 +36,9 @@ describe("Test Tag hooks", () => { type: "git", _links: { tags: { - href: "/hog/tags" - } - } + href: "/hog/tags", + }, + }, }; const changeset: Changeset = { @@ -46,14 +46,14 @@ describe("Test Tag hooks", () => { description: "Awesome change", date: new Date(), author: { - name: "Arthur Dent" + name: "Arthur Dent", }, _embedded: {}, _links: { tag: { - href: "/hog/tag" - } - } + href: "/hog/tag", + }, + }, }; const tagOneDotZero = { @@ -61,17 +61,17 @@ describe("Test Tag hooks", () => { revision: "42", signatures: [], _links: { - "delete": { - href: "/hog/tags/1.0" - } - } + delete: { + href: "/hog/tags/1.0", + }, + }, }; const tags: TagCollection = { _embedded: { - tags: [tagOneDotZero] + tags: [tagOneDotZero], }, - _links: {} + _links: {}, }; const queryClient = createInfiniteCachingClient(); @@ -87,7 +87,7 @@ describe("Test Tag hooks", () => { fetchMock.getOnce("/api/v2/hog/tags", tags); const { result, waitFor } = renderHook(() => useTags(repository), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => { return !!result.current.data; @@ -114,7 +114,7 @@ describe("Test Tag hooks", () => { fetchMock.getOnce("/api/v2/hog/tags/1.0", tagOneDotZero); const { result, waitFor } = renderHook(() => useTag(repository, "1.0"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => { return !!result.current.data; @@ -141,14 +141,14 @@ describe("Test Tag hooks", () => { fetchMock.postOnce("/api/v2/hog/tag", { status: 201, headers: { - Location: "/hog/tags/1.0" - } + Location: "/hog/tags/1.0", + }, }); fetchMock.getOnce("/api/v2/hog/tags/1.0", tagOneDotZero); const { result, waitForNextUpdate } = renderHook(() => useCreateTag(repository, changeset), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -195,11 +195,11 @@ describe("Test Tag hooks", () => { it("should fail without location header", async () => { fetchMock.postOnce("/api/v2/hog/tag", { - status: 201 + status: 201, }); const { result, waitForNextUpdate } = renderHook(() => useCreateTag(repository, changeset), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -215,11 +215,11 @@ describe("Test Tag hooks", () => { describe("useDeleteTags tests", () => { const deleteTag = async () => { fetchMock.deleteOnce("/api/v2/hog/tags/1.0", { - status: 204 + status: 204, }); const { result, waitForNextUpdate } = renderHook(() => useDeleteTag(repository), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { diff --git a/scm-ui/ui-api/src/tests/createInfiniteCachingClient.ts b/scm-ui/ui-api/src/tests/createInfiniteCachingClient.ts index 88f56b9d38..b6ade7e571 100644 --- a/scm-ui/ui-api/src/tests/createInfiniteCachingClient.ts +++ b/scm-ui/ui-api/src/tests/createInfiniteCachingClient.ts @@ -28,9 +28,9 @@ const createInfiniteCachingClient = () => { return new QueryClient({ defaultOptions: { queries: { - staleTime: Infinity - } - } + staleTime: Infinity, + }, + }, }); }; diff --git a/scm-ui/ui-api/src/tests/indexLinks.ts b/scm-ui/ui-api/src/tests/indexLinks.ts index b55b874fbd..9be9fa3eef 100644 --- a/scm-ui/ui-api/src/tests/indexLinks.ts +++ b/scm-ui/ui-api/src/tests/indexLinks.ts @@ -22,22 +22,22 @@ * SOFTWARE. */ -import { QueryClient} from "react-query"; +import { QueryClient } from "react-query"; export const setIndexLink = (queryClient: QueryClient, name: string, href: string) => { queryClient.setQueryData("index", { version: "x.y.z", _links: { [name]: { - href: href - } - } + href: href, + }, + }, }); }; export const setEmptyIndex = (queryClient: QueryClient) => { queryClient.setQueryData("index", { version: "x.y.z", - _links: {} + _links: {}, }); }; diff --git a/scm-ui/ui-api/src/urls.test.ts b/scm-ui/ui-api/src/urls.test.ts index 79557a2b02..ea088d184f 100644 --- a/scm-ui/ui-api/src/urls.test.ts +++ b/scm-ui/ui-api/src/urls.test.ts @@ -22,12 +22,7 @@ * SOFTWARE. */ -import { - concat, - getNamespaceAndPageFromMatch, - getQueryStringFromLocation, - withEndingSlash -} from "./urls"; +import { concat, getNamespaceAndPageFromMatch, getQueryStringFromLocation, withEndingSlash } from "./urls"; describe("tests for withEndingSlash", () => { it("should append missing slash", () => { @@ -50,7 +45,7 @@ describe("concat tests", () => { describe("tests for getNamespaceAndPageFromMatch", () => { function createMatch(namespace?: string, page?: string) { return { - params: { namespace, page } + params: { namespace, page }, }; } @@ -88,7 +83,7 @@ describe("tests for getNamespaceAndPageFromMatch", () => { describe("tests for getQueryStringFromLocation", () => { function createLocation(search: string) { return { - search + search, }; } diff --git a/scm-ui/ui-api/src/users.test.ts b/scm-ui/ui-api/src/users.test.ts index c3b34da2af..e7e0c462ab 100644 --- a/scm-ui/ui-api/src/users.test.ts +++ b/scm-ui/ui-api/src/users.test.ts @@ -36,7 +36,7 @@ import { useDeleteUser, useUpdateUser, useUser, - useUsers + useUsers, } from "./users"; describe("Test user hooks", () => { @@ -48,21 +48,21 @@ describe("Test user hooks", () => { name: "yoda", _links: { delete: { - href: "/users/yoda" + href: "/users/yoda", }, update: { - href: "/users/yoda" + href: "/users/yoda", }, convertToInternal: { - href: "/users/yoda/convertToInternal" + href: "/users/yoda/convertToInternal", }, convertToExternal: { - href: "/users/yoda/convertToExternal" - } + href: "/users/yoda/convertToExternal", + }, }, _embedded: { - members: [] - } + members: [], + }, }; const userCollection: UserCollection = { @@ -70,8 +70,8 @@ describe("Test user hooks", () => { page: 0, pageTotal: 0, _embedded: { - users: [yoda] - } + users: [yoda], + }, }; afterEach(() => { @@ -84,7 +84,7 @@ describe("Test user hooks", () => { setIndexLink(queryClient, "users", "/users"); fetchMock.get("/api/v2/users", userCollection); const { result, waitFor } = renderHook(() => useUsers(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(userCollection); @@ -95,11 +95,11 @@ describe("Test user hooks", () => { setIndexLink(queryClient, "users", "/users"); fetchMock.get("/api/v2/users", userCollection, { query: { - page: "42" - } + page: "42", + }, }); const { result, waitFor } = renderHook(() => useUsers({ page: 42 }), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(userCollection); @@ -110,11 +110,11 @@ describe("Test user hooks", () => { setIndexLink(queryClient, "users", "/users"); fetchMock.get("/api/v2/users", userCollection, { query: { - q: "yoda" - } + q: "yoda", + }, }); const { result, waitFor } = renderHook(() => useUsers({ search: "yoda" }), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(userCollection); @@ -125,7 +125,7 @@ describe("Test user hooks", () => { setIndexLink(queryClient, "users", "/users"); fetchMock.get("/api/v2/users", userCollection); const { result, waitFor } = renderHook(() => useUsers(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(queryClient.getQueryData(["user", "yoda"])).toEqual(yoda); @@ -138,7 +138,7 @@ describe("Test user hooks", () => { setIndexLink(queryClient, "users", "/users"); fetchMock.get("/api/v2/users/yoda", yoda); const { result, waitFor } = renderHook(() => useUser("yoda"), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await waitFor(() => !!result.current.data); expect(result.current.data).toEqual(yoda); @@ -153,14 +153,14 @@ describe("Test user hooks", () => { fetchMock.postOnce("/api/v2/users", { status: 201, headers: { - Location: "/users/yoda" - } + Location: "/users/yoda", + }, }); fetchMock.getOnce("/api/v2/users/yoda", yoda); const { result, waitForNextUpdate } = renderHook(() => useCreateUser(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -177,13 +177,13 @@ describe("Test user hooks", () => { setIndexLink(queryClient, "users", "/users"); fetchMock.postOnce("/api/v2/users", { - status: 201 + status: 201, }); fetchMock.getOnce("/api/v2/users/yoda", yoda); const { result, waitForNextUpdate } = renderHook(() => useCreateUser(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -202,11 +202,11 @@ describe("Test user hooks", () => { setIndexLink(queryClient, "users", "/users"); fetchMock.deleteOnce("/api/v2/users/yoda", { - status: 200 + status: 200, }); const { result, waitForNextUpdate } = renderHook(() => useDeleteUser(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -229,17 +229,17 @@ describe("Test user hooks", () => { const newJedis = { ...yoda, - description: "may the 4th be with you" + description: "may the 4th be with you", }; fetchMock.putOnce("/api/v2/users/yoda", { - status: 200 + status: 200, }); fetchMock.getOnce("/api/v2/users/yoda", newJedis); const { result, waitForNextUpdate } = renderHook(() => useUpdateUser(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -261,11 +261,11 @@ describe("Test user hooks", () => { const queryClient = createInfiniteCachingClient(); fetchMock.putOnce("/api/v2/users/yoda/convertToInternal", { - status: 200 + status: 200, }); const { result, waitForNextUpdate } = renderHook(() => useConvertToInternal(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { @@ -287,11 +287,11 @@ describe("Test user hooks", () => { const queryClient = createInfiniteCachingClient(); fetchMock.putOnce("/api/v2/users/yoda/convertToExternal", { - status: 200 + status: 200, }); const { result, waitForNextUpdate } = renderHook(() => useConvertToExternal(), { - wrapper: createWrapper(undefined, queryClient) + wrapper: createWrapper(undefined, queryClient), }); await act(() => { diff --git a/scm-ui/ui-api/src/utils.ts b/scm-ui/ui-api/src/utils.ts index 711c140ca0..df24e9d810 100644 --- a/scm-ui/ui-api/src/utils.ts +++ b/scm-ui/ui-api/src/utils.ts @@ -24,6 +24,6 @@ export const createQueryString = (params: Record) => { return Object.keys(params) - .map(k => encodeURIComponent(k) + "=" + encodeURIComponent(params[k])) + .map((k) => encodeURIComponent(k) + "=" + encodeURIComponent(params[k])) .join("&"); }; diff --git a/scm-ui/ui-components/src/Autocomplete.tsx b/scm-ui/ui-components/src/Autocomplete.tsx index 8d4270cd73..a415f39802 100644 --- a/scm-ui/ui-components/src/Autocomplete.tsx +++ b/scm-ui/ui-components/src/Autocomplete.tsx @@ -47,7 +47,7 @@ class Autocomplete extends React.Component { static defaultProps = { placeholder: "Type here", loadingMessage: "Loading...", - noOptionsMessage: "No suggestion available" + noOptionsMessage: "No suggestion available", }; handleInputChange = (newValue: ValueType, action: ActionMeta) => { @@ -64,7 +64,7 @@ class Autocomplete extends React.Component { selectValue: ValueType, selectOptions: readonly SelectValue[] ): boolean => { - const isNotDuplicated = !selectOptions.map(option => option.label).includes(inputValue); + const isNotDuplicated = !selectOptions.map((option) => option.label).includes(inputValue); const isNotEmpty = inputValue !== ""; return isNotEmpty && isNotDuplicated; }; @@ -79,7 +79,7 @@ class Autocomplete extends React.Component { noOptionsMessage, loadSuggestions, creatable, - className + className, } = this.props; return (
@@ -95,13 +95,13 @@ class Autocomplete extends React.Component { loadingMessage={() => loadingMessage} noOptionsMessage={() => noOptionsMessage} isValidNewOption={this.isValidNewOption} - onCreateOption={value => { + onCreateOption={(value) => { this.selectValue({ label: value, value: { id: value, - displayName: value - } + displayName: value, + }, }); }} /> diff --git a/scm-ui/ui-components/src/BranchSelector.stories.tsx b/scm-ui/ui-components/src/BranchSelector.stories.tsx index 9e27554df2..88f62fb60d 100644 --- a/scm-ui/ui-components/src/BranchSelector.stories.tsx +++ b/scm-ui/ui-components/src/BranchSelector.stories.tsx @@ -41,5 +41,5 @@ const Wrapper = styled.div` `; storiesOf("BranchSelector", module) - .addDecorator(storyFn => {storyFn()}) + .addDecorator((storyFn) => {storyFn()}) .add("Default", () => ); diff --git a/scm-ui/ui-components/src/Breadcrumb.tsx b/scm-ui/ui-components/src/Breadcrumb.tsx index 07f53dab44..68a605917d 100644 --- a/scm-ui/ui-components/src/Breadcrumb.tsx +++ b/scm-ui/ui-components/src/Breadcrumb.tsx @@ -128,7 +128,10 @@ const Breadcrumb: FC = ({ if (path) { const paths = path.split("/"); return paths.map((pathFragment, index) => { - let currPath = paths.slice(0, index + 1).map(encodeURIComponent).join("/"); + let currPath = paths + .slice(0, index + 1) + .map(encodeURIComponent) + .join("/"); if (!currPath.endsWith("/")) { currPath = currPath + "/"; } diff --git a/scm-ui/ui-components/src/CardColumn.stories.tsx b/scm-ui/ui-components/src/CardColumn.stories.tsx index cfeaa59334..451c58b97c 100644 --- a/scm-ui/ui-components/src/CardColumn.stories.tsx +++ b/scm-ui/ui-components/src/CardColumn.stories.tsx @@ -43,8 +43,8 @@ const footerRight = right footer; const baseDate = "2020-03-26T12:13:42+02:00"; storiesOf("CardColumn", module) - .addDecorator(story => {story()}) - .addDecorator(storyFn => {storyFn()}) + .addDecorator((story) => {story()}) + .addDecorator((storyFn) => {storyFn()}) .add("Default", () => ( = ({ createLink = ; } else if (action) { createLink = ( - { e.preventDefault(); action(); }} - href="#" /> ); } diff --git a/scm-ui/ui-components/src/HelpIcon.tsx b/scm-ui/ui-components/src/HelpIcon.tsx index 3cb20574b2..d984b7d184 100644 --- a/scm-ui/ui-components/src/HelpIcon.tsx +++ b/scm-ui/ui-components/src/HelpIcon.tsx @@ -28,6 +28,8 @@ type Props = { className?: string; }; -const HelpIcon: FC = ({ className }) => ; +const HelpIcon: FC = ({ className }) => ( + +); export default HelpIcon; diff --git a/scm-ui/ui-components/src/Icon.stories.tsx b/scm-ui/ui-components/src/Icon.stories.tsx index 88fdff7731..78e6f986e6 100644 --- a/scm-ui/ui-components/src/Icon.stories.tsx +++ b/scm-ui/ui-components/src/Icon.stories.tsx @@ -36,7 +36,7 @@ const colors = ["primary", "link", "info", "success", "warning", "danger", "whit const sizing = ["xs", "sm", "lg", "2x", "3x", "5x", "7x", "10x"]; storiesOf("Icon", module) - .addDecorator(storyFn => {storyFn()}) + .addDecorator((storyFn) => {storyFn()}) .add("Default", () => ( <> @@ -48,7 +48,7 @@ storiesOf("Icon", module) .add("Colors", () => ( <> - {colors.map(color => ( + {colors.map((color) => ( ))} @@ -56,7 +56,7 @@ storiesOf("Icon", module) .add("Sizing", () => ( <> - {sizing.map(size => ( + {sizing.map((size) => ( ))} diff --git a/scm-ui/ui-components/src/Notification.stories.tsx b/scm-ui/ui-components/src/Notification.stories.tsx index efce4ee6c5..a1cc14ad95 100644 --- a/scm-ui/ui-components/src/Notification.stories.tsx +++ b/scm-ui/ui-components/src/Notification.stories.tsx @@ -44,7 +44,7 @@ const RoutingDecorator = (story: () => ReactNode) => {storyFn()}) + .addDecorator((storyFn) => {storyFn()}) .add("Primary", () => {content}) .add("Success", () => {content}) .add("Info", () => {content}) diff --git a/scm-ui/ui-components/src/Paginator.test.tsx b/scm-ui/ui-components/src/Paginator.test.tsx index 247c9ccdca..288b58ad62 100644 --- a/scm-ui/ui-components/src/Paginator.test.tsx +++ b/scm-ui/ui-components/src/Paginator.test.tsx @@ -28,7 +28,7 @@ import Paginator from "./Paginator"; xdescribe("paginator rendering tests", () => { const dummyLink = { - href: "https://dummy" + href: "https://dummy", }; it("should render all buttons but disabled, without links", () => { @@ -36,13 +36,13 @@ xdescribe("paginator rendering tests", () => { page: 10, pageTotal: 20, _links: {}, - _embedded: {} + _embedded: {}, }; const paginator = shallow(); const buttons = paginator.find("Button"); expect(buttons.length).toBe(7); - buttons.forEach(button => { + buttons.forEach((button) => { // @ts-ignore ??? expect(button.props.disabled).toBeTruthy(); }); @@ -55,9 +55,9 @@ xdescribe("paginator rendering tests", () => { _links: { first: dummyLink, next: dummyLink, - last: dummyLink + last: dummyLink, }, - _embedded: {} + _embedded: {}, }; const paginator = shallow(); @@ -92,9 +92,9 @@ xdescribe("paginator rendering tests", () => { first: dummyLink, prev: dummyLink, next: dummyLink, - last: dummyLink + last: dummyLink, }, - _embedded: {} + _embedded: {}, }; const paginator = shallow(); @@ -132,9 +132,9 @@ xdescribe("paginator rendering tests", () => { pageTotal: 148, _links: { first: dummyLink, - prev: dummyLink + prev: dummyLink, }, - _embedded: {} + _embedded: {}, }; const paginator = shallow(); @@ -169,9 +169,9 @@ xdescribe("paginator rendering tests", () => { first: dummyLink, prev: dummyLink, next: dummyLink, - last: dummyLink + last: dummyLink, }, - _embedded: {} + _embedded: {}, }; const paginator = shallow(); @@ -211,9 +211,9 @@ xdescribe("paginator rendering tests", () => { first: dummyLink, prev: dummyLink, next: dummyLink, - last: dummyLink + last: dummyLink, }, - _embedded: {} + _embedded: {}, }; const paginator = shallow(); @@ -258,12 +258,12 @@ xdescribe("paginator rendering tests", () => { _links: { first: dummyLink, prev: { - href: "https://www.scm-manager.org" + href: "https://www.scm-manager.org", }, next: dummyLink, - last: dummyLink + last: dummyLink, }, - _embedded: {} + _embedded: {}, }; let urlToOpen; diff --git a/scm-ui/ui-components/src/ProtectedRoute.tsx b/scm-ui/ui-components/src/ProtectedRoute.tsx index c371c49892..a883e4f686 100644 --- a/scm-ui/ui-components/src/ProtectedRoute.tsx +++ b/scm-ui/ui-components/src/ProtectedRoute.tsx @@ -33,7 +33,7 @@ class ProtectedRoute extends Component { constructor(props: Props) { super(props); this.state = { - error: undefined + error: undefined, }; } @@ -49,8 +49,8 @@ class ProtectedRoute extends Component { to={{ pathname: "/login", state: { - from: routeProps.location - } + from: routeProps.location, + }, }} /> ); diff --git a/scm-ui/ui-components/src/Tag.tsx b/scm-ui/ui-components/src/Tag.tsx index b1f0840c76..e8e81c3612 100644 --- a/scm-ui/ui-components/src/Tag.tsx +++ b/scm-ui/ui-components/src/Tag.tsx @@ -64,7 +64,7 @@ const Tag: FC = ({ } let showDelete = null; if (onRemove) { - showDelete = ; + showDelete =
`; @@ -475,6 +470,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + primary @@ -487,6 +483,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + link @@ -499,6 +496,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + info @@ -511,6 +509,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + success @@ -523,6 +522,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + warning @@ -535,6 +535,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + danger @@ -547,6 +548,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + white @@ -559,6 +561,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + light @@ -571,6 +574,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + dark @@ -583,6 +587,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + black @@ -595,6 +600,7 @@ exports[`Storyshots Buttons/Button Colors 1`] = ` onClick={[Function]} type="button" > + text @@ -613,6 +619,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + primary @@ -626,6 +633,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + link @@ -639,6 +647,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + info @@ -652,6 +661,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + success @@ -665,6 +675,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + warning @@ -678,6 +689,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + danger @@ -691,6 +703,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + white @@ -704,6 +717,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + light @@ -717,6 +731,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + dark @@ -730,6 +745,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + black @@ -743,6 +759,7 @@ exports[`Storyshots Buttons/Button Disabled 1`] = ` onClick={[Function]} type="button" > + text @@ -760,6 +777,7 @@ exports[`Storyshots Buttons/Button Loading 1`] = ` type="button" > + Loading Button @@ -778,6 +796,7 @@ exports[`Storyshots Buttons/CreateButton Default 1`] = ` type="button" > + Create @@ -793,19 +812,14 @@ exports[`Storyshots Buttons/DeleteButton Default 1`] = ` onClick={[Function]} type="button" > - - - - - - Delete - + + + + Delete `; @@ -868,6 +882,7 @@ exports[`Storyshots Buttons/EditButton Default 1`] = ` type="button" > + Edit @@ -884,6 +899,7 @@ exports[`Storyshots Buttons/SubmitButton Default 1`] = ` type="submit" > + Submit @@ -1917,19 +1933,14 @@ exports[`Storyshots Forms/AddKeyValueEntryToTableField Default 1`] = ` onClick={[Function]} type="button" > - - - - - Add to Table - - + + + Add to Table + @@ -1992,19 +2003,14 @@ exports[`Storyshots Forms/AddKeyValueEntryToTableField Disabled 1`] = ` onClick={[Function]} type="button" > - - - - - Add to Table - - + + + Add to Table + @@ -2242,6 +2248,7 @@ exports[`Storyshots Forms/Checkbox ReactHookForm 1`] = ` type="submit" > + Submit @@ -2277,6 +2284,7 @@ Array [ type="button" > + Toggle Checkbox , ] @@ -2538,6 +2546,7 @@ exports[`Storyshots Forms/FileInput Default 1`] = ` type="submit" > + Submit @@ -2615,6 +2624,7 @@ exports[`Storyshots Forms/InputField AutoFocusAndRef 1`] = ` type="button" > + Focus First InputField @@ -2782,6 +2792,7 @@ exports[`Storyshots Forms/InputField React Hook Form 1`] = ` type="submit" > + Submit @@ -2815,6 +2826,7 @@ exports[`Storyshots Forms/InputField Ref 1`] = ` type="button" > + Focus InputField @@ -3015,6 +3027,7 @@ exports[`Storyshots Forms/Radio ReactHookForm 1`] = ` type="submit" > + Submit @@ -3045,6 +3058,7 @@ Array [ type="button" > + Check InputField , ] @@ -3361,6 +3375,7 @@ exports[`Storyshots Forms/Select ReactHookForm 1`] = ` type="submit" > + Submit @@ -3405,6 +3420,7 @@ Array [ type="button" > + Focus Select Field , "false", @@ -3474,6 +3490,7 @@ Array [ type="button" > + Focus First InputField , ] @@ -3709,6 +3726,7 @@ exports[`Storyshots Forms/Textarea ReactHookForm 1`] = ` type="submit" > + Submit @@ -3738,6 +3756,7 @@ Array [ type="button" > + Focus InputField , ] @@ -3807,15 +3826,12 @@ exports[`Storyshots GroupEntry Default 1`] = ` title="Copy clone command to clipboard" type="button" > - - - + + @@ -3889,15 +3905,12 @@ exports[`Storyshots GroupEntry With long texts 1`] = ` title="Copy clone command to clipboard" type="button" > - - - + + @@ -19113,13 +19126,12 @@ exports[`Storyshots Popover Link 1`] = ` className="Popoverstories__Wrapper-sc-2pld2j-0 hcbLvl" >
- Trigger - +
`; @@ -20851,48 +20863,40 @@ exports[`Storyshots Repositories/Changesets Co-Authors with avatar 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -21014,48 +21018,40 @@ exports[`Storyshots Repositories/Changesets Commiter and Co-Authors with avatar

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -21135,48 +21131,40 @@ exports[`Storyshots Repositories/Changesets Default 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -21266,48 +21254,40 @@ exports[`Storyshots Repositories/Changesets Replacements 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -21399,48 +21379,40 @@ exports[`Storyshots Repositories/Changesets With Committer 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -21541,48 +21513,40 @@ exports[`Storyshots Repositories/Changesets With Committer and Co-Author 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -21675,48 +21639,40 @@ exports[`Storyshots Repositories/Changesets With avatar 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -21806,48 +21762,40 @@ exports[`Storyshots Repositories/Changesets With contactless signature 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -21937,48 +21885,40 @@ exports[`Storyshots Repositories/Changesets With invalid signature 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -22044,13 +21984,13 @@ exports[`Storyshots Repositories/Changesets With multiple Co-Authors 1`] = ` changeset.contributors.coAuthoredBy - changeset.contributors.more - +

@@ -22071,48 +22011,40 @@ exports[`Storyshots Repositories/Changesets With multiple Co-Authors 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -22202,48 +22134,40 @@ exports[`Storyshots Repositories/Changesets With multiple signatures and invalid

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -22333,48 +22257,40 @@ exports[`Storyshots Repositories/Changesets With multiple signatures and not fou

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -22464,48 +22380,40 @@ exports[`Storyshots Repositories/Changesets With multiple signatures and valid s

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -22595,48 +22503,40 @@ exports[`Storyshots Repositories/Changesets With unknown signature 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -22726,48 +22626,40 @@ exports[`Storyshots Repositories/Changesets With unowned signature 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -22857,48 +22749,40 @@ exports[`Storyshots Repositories/Changesets With valid signature 1`] = `

- + + + changeset.buttons.details + +

- + + + changeset.buttons.sources + +

@@ -23207,6 +23091,7 @@ exports[`Storyshots Repositories/Diff Changing Content 1`] = ` type="button" > + Change content
@@ -89978,9 +89863,9 @@ exports[`Storyshots Table Default 1`] = ` - + tricia@hitchhiker.com - + @@ -90001,9 +89886,9 @@ exports[`Storyshots Table Default 1`] = ` - + arthur@hitchhiker.com - + @@ -90457,6 +90342,7 @@ exports[`Storyshots Tooltip Default 1`] = ` onClick={[Function]} type="button" > + right @@ -90475,6 +90361,7 @@ exports[`Storyshots Tooltip Default 1`] = ` onClick={[Function]} type="button" > + top @@ -90493,6 +90380,7 @@ exports[`Storyshots Tooltip Default 1`] = ` onClick={[Function]} type="button" > + left @@ -90511,6 +90399,7 @@ exports[`Storyshots Tooltip Default 1`] = ` onClick={[Function]} type="button" > + bottom @@ -90543,6 +90432,7 @@ exports[`Storyshots Tooltip Multiline 1`] = ` onClick={[Function]} type="button" > + right @@ -90568,6 +90458,7 @@ exports[`Storyshots Tooltip Multiline 1`] = ` onClick={[Function]} type="button" > + top @@ -90593,6 +90484,7 @@ exports[`Storyshots Tooltip Multiline 1`] = ` onClick={[Function]} type="button" > + left @@ -90618,6 +90510,7 @@ exports[`Storyshots Tooltip Multiline 1`] = ` onClick={[Function]} type="button" > + bottom @@ -90645,6 +90538,7 @@ exports[`Storyshots Tooltip Short Multiline 1`] = ` onClick={[Function]} type="button" > + right @@ -90665,6 +90559,7 @@ exports[`Storyshots Tooltip Short Multiline 1`] = ` onClick={[Function]} type="button" > + top @@ -90685,6 +90580,7 @@ exports[`Storyshots Tooltip Short Multiline 1`] = ` onClick={[Function]} type="button" > + left @@ -90705,6 +90601,7 @@ exports[`Storyshots Tooltip Short Multiline 1`] = ` onClick={[Function]} type="button" > + bottom diff --git a/scm-ui/ui-components/src/buttons/Button.tsx b/scm-ui/ui-components/src/buttons/Button.tsx index 37edbe6660..d8846bf033 100644 --- a/scm-ui/ui-components/src/buttons/Button.tsx +++ b/scm-ui/ui-components/src/buttons/Button.tsx @@ -21,9 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -import React, { MouseEvent, ReactNode } from "react"; +import React, { FC, MouseEvent, ReactNode } from "react"; import classNames from "classnames"; -import { RouteComponentProps, withRouter } from "react-router-dom"; +import { Link } from "react-router-dom"; import Icon from "../Icon"; import { createAttributesForTesting } from "../devBuild"; @@ -42,90 +42,79 @@ export type ButtonProps = { testId?: string; }; -type Props = ButtonProps & - RouteComponentProps & { - type?: "button" | "submit" | "reset"; - color?: string; +type Props = ButtonProps & { + type?: "button" | "submit" | "reset"; + color?: string; +}; + +const Button: FC = ({ + link, + className, + icon, + fullWidth, + reducedMobile, + testId, + children, + label, + type = "button", + title, + loading, + disabled, + action, + color = "default", +}) => { + const renderIcon = () => { + return <>{icon ? : null}; }; -class Button extends React.Component { - static defaultProps: Partial = { - type: "button", - color: "default", - }; - - onClick = (event: React.MouseEvent) => { - const { action, link, history } = this.props; - if (action) { - action(event); - } else if (link) { - history.push(link); - } - }; - - render() { - const { - label, - title, - loading, - disabled, - type, - color, - className, - icon, - fullWidth, - reducedMobile, - children, - testId, - } = this.props; - if (icon) { - return ( - - ); - } - + if (link) { return ( - + {renderIcon()}{" "} + {(label || children) && ( + <> + {label} {children} + + )} + ); } -} -export default withRouter(Button); + return ( + + ); +}; + +export default Button; diff --git a/scm-ui/ui-components/src/buttons/ButtonAddons.tsx b/scm-ui/ui-components/src/buttons/ButtonAddons.tsx index d640c58352..a94995cec1 100644 --- a/scm-ui/ui-components/src/buttons/ButtonAddons.tsx +++ b/scm-ui/ui-components/src/buttons/ButtonAddons.tsx @@ -41,7 +41,7 @@ class ButtonAddons extends React.Component { const { className, children } = this.props; const childWrapper: ReactNode[] = []; - React.Children.forEach(children, child => { + React.Children.forEach(children, (child) => { if (child) { childWrapper.push(

diff --git a/scm-ui/ui-components/src/buttons/ButtonGroup.tsx b/scm-ui/ui-components/src/buttons/ButtonGroup.tsx index 0d43e82fba..83f7ff9c83 100644 --- a/scm-ui/ui-components/src/buttons/ButtonGroup.tsx +++ b/scm-ui/ui-components/src/buttons/ButtonGroup.tsx @@ -34,7 +34,7 @@ class ButtonGroup extends React.Component { const { className, children } = this.props; const childWrapper: ReactNode[] = []; - React.Children.forEach(children, child => { + React.Children.forEach(children, (child) => { if (child) { childWrapper.push(

diff --git a/scm-ui/ui-components/src/buttons/SubmitButton.tsx b/scm-ui/ui-components/src/buttons/SubmitButton.tsx index d03a15772f..82138eb75a 100644 --- a/scm-ui/ui-components/src/buttons/SubmitButton.tsx +++ b/scm-ui/ui-components/src/buttons/SubmitButton.tsx @@ -31,7 +31,7 @@ type SubmitButtonProps = ButtonProps & { class SubmitButton extends React.Component { static defaultProps = { - scrollToTop: true + scrollToTop: true, }; render() { diff --git a/scm-ui/ui-components/src/buttons/index.stories.tsx b/scm-ui/ui-components/src/buttons/index.stories.tsx index b5366ef06b..20fdcc205a 100644 --- a/scm-ui/ui-components/src/buttons/index.stories.tsx +++ b/scm-ui/ui-components/src/buttons/index.stories.tsx @@ -46,7 +46,7 @@ storiesOf("Buttons/Button", module) .addDecorator(RoutingDecorator) .add("Colors", () => (
- {colors.map(color => ( + {colors.map((color) => (

))}
diff --git a/scm-ui/ui-components/src/modals/CreateTagModal.tsx b/scm-ui/ui-components/src/modals/CreateTagModal.tsx index 8dd2ec1a41..3ea98d39fd 100644 --- a/scm-ui/ui-components/src/modals/CreateTagModal.tsx +++ b/scm-ui/ui-components/src/modals/CreateTagModal.tsx @@ -48,8 +48,8 @@ const CreateTagModal: FC = ({ t, onClose, tagCreationLink, existingTagsLi useEffect(() => { apiClient .get(existingTagsLink) - .then(response => response.json()) - .then(json => setTagNames(json._embedded.tags.map((tag: Tag) => tag.name))); + .then((response) => response.json()) + .then((json) => setTagNames(json._embedded.tags.map((tag: Tag) => tag.name))); }, [existingTagsLink]); const createTag = () => { @@ -57,7 +57,7 @@ const CreateTagModal: FC = ({ t, onClose, tagCreationLink, existingTagsLi apiClient .post(tagCreationLink, { revision, - name: newTagName + name: newTagName, }) .then(onCreated) .catch(onError) @@ -83,7 +83,7 @@ const CreateTagModal: FC = ({ t, onClose, tagCreationLink, existingTagsLi setNewTagName(val)} + onChange={(val) => setNewTagName(val)} value={newTagName} validationError={!!validationError} errorMessage={t(validationError)} diff --git a/scm-ui/ui-components/src/navigation/MenuContext.tsx b/scm-ui/ui-components/src/navigation/MenuContext.tsx index f02e5ab8d2..ff5c84d0ed 100644 --- a/scm-ui/ui-components/src/navigation/MenuContext.tsx +++ b/scm-ui/ui-components/src/navigation/MenuContext.tsx @@ -33,7 +33,7 @@ export const MenuContext = React.createContext({ isCollapsed() { return false; }, - setCollapsed() {} + setCollapsed() {}, }); export const StateMenuContextProvider: FC = ({ children }) => { @@ -43,7 +43,7 @@ export const StateMenuContextProvider: FC = ({ children }) => { isCollapsed() { return collapsed; }, - setCollapsed + setCollapsed, }; return {children}; diff --git a/scm-ui/ui-components/src/navigation/NavAction.tsx b/scm-ui/ui-components/src/navigation/NavAction.tsx index 394b30d961..3ade574590 100644 --- a/scm-ui/ui-components/src/navigation/NavAction.tsx +++ b/scm-ui/ui-components/src/navigation/NavAction.tsx @@ -39,17 +39,17 @@ class NavAction extends React.Component { if (icon) { showIcon = ( <> - {" "} + {" "} ); } return (
  • - +
  • ); } diff --git a/scm-ui/ui-components/src/navigation/SecondaryNavigation.stories.tsx b/scm-ui/ui-components/src/navigation/SecondaryNavigation.stories.tsx index 080789ea41..1efe03142b 100644 --- a/scm-ui/ui-components/src/navigation/SecondaryNavigation.stories.tsx +++ b/scm-ui/ui-components/src/navigation/SecondaryNavigation.stories.tsx @@ -53,8 +53,8 @@ const withRoute = (route: string) => { }; storiesOf("Secondary Navigation", module) - .addDecorator(story => {story()}) - .addDecorator(story => ( + .addDecorator((story) => {story()}) + .addDecorator((story) => (
    {story()}
    @@ -92,7 +92,7 @@ storiesOf("Secondary Navigation", module) route.location.pathname === "/hog"} + activeWhenMatch={(route) => route.location.pathname === "/hog"} to="/heart-of-gold" icon="fas fa-star" label="Heart Of Gold" diff --git a/scm-ui/ui-components/src/navigation/SubNavigation.tsx b/scm-ui/ui-components/src/navigation/SubNavigation.tsx index 008bf5db86..2614ba8d45 100644 --- a/scm-ui/ui-components/src/navigation/SubNavigation.tsx +++ b/scm-ui/ui-components/src/navigation/SubNavigation.tsx @@ -44,7 +44,7 @@ const SubNavigation: FC = ({ title, label, children, - testId + testId, }) => { const context = useMenuContext(); const collapsed = context.isCollapsed(); @@ -56,7 +56,7 @@ const SubNavigation: FC = ({ const active = useActiveMatch({ to: parent, activeOnlyWhenExact, - activeWhenMatch + activeWhenMatch, }); let defaultIcon = "fas fa-cog"; diff --git a/scm-ui/ui-components/src/popover/Popover.stories.tsx b/scm-ui/ui-components/src/popover/Popover.stories.tsx index c5fac9bcfa..f2d51a76ea 100644 --- a/scm-ui/ui-components/src/popover/Popover.stories.tsx +++ b/scm-ui/ui-components/src/popover/Popover.stories.tsx @@ -34,40 +34,42 @@ const Wrapper = styled.div` `; storiesOf("Popover", module) - .addDecorator(storyFn => {storyFn()}) - .add("Default", () => React.createElement(() => { - const { triggerProps, popoverProps } = usePopover(); + .addDecorator((storyFn) => {storyFn()}) + .add("Default", () => + React.createElement(() => { + const { triggerProps, popoverProps } = usePopover(); - return ( -
    - Spaceship Heart of Gold} width={512} {...popoverProps}> -

    - The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks - mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive, - which lets the ship pass through every point in every universe simultaneously. -

    -
    - -
    - ); - })) - .add("Link", () => React.createElement(() => { - const { triggerProps, popoverProps } = usePopover(); + return ( +
    + Spaceship Heart of Gold} width={512} {...popoverProps}> +

    + The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks + mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive, + which lets the ship pass through every point in every universe simultaneously. +

    +
    + +
    + ); + }) + ) + .add("Link", () => + React.createElement(() => { + const { triggerProps, popoverProps } = usePopover(); - return ( -
    - Spaceship Heart of Gold} width={512} {...popoverProps}> -

    - The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks - mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive, - which lets the ship pass through every point in every universe simultaneously. -

    -
    - - Trigger - -
    - ); - })); + return ( +
    + Spaceship Heart of Gold} width={512} {...popoverProps}> +

    + The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks + mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive, + which lets the ship pass through every point in every universe simultaneously. +

    +
    + +
    + ); + }) + ); diff --git a/scm-ui/ui-components/src/popover/usePopover.ts b/scm-ui/ui-components/src/popover/usePopover.ts index db73194916..d3dea847a8 100644 --- a/scm-ui/ui-components/src/popover/usePopover.ts +++ b/scm-ui/ui-components/src/popover/usePopover.ts @@ -53,7 +53,7 @@ type State = { const initialState = { onPopover: false, - onTrigger: false + onTrigger: false, }; const reducer = (state: State, action: Action): State => { @@ -66,14 +66,14 @@ const reducer = (state: State, action: Action): State => { offsetTop: action.offsetTop, offsetLeft: action.offsetLeft, onTrigger: true, - onPopover: false + onPopover: false, }; } case "leave-trigger": { if (state.onPopover) { return { ...state, - onTrigger: false + onTrigger: false, }; } return initialState; @@ -81,14 +81,14 @@ const reducer = (state: State, action: Action): State => { case "enter-popover": { return { ...state, - onPopover: true + onPopover: true, }; } case "leave-popover": { if (state.onTrigger) { return { ...state, - onPopover: false + onPopover: false, }; } return initialState; @@ -109,13 +109,13 @@ const usePopover = () => { dispatchDeferred(dispatch, { type: "enter-trigger", offsetTop: current.offsetTop, - offsetLeft: current.offsetLeft + current.offsetWidth / 2 + offsetLeft: current.offsetLeft + current.offsetWidth / 2, }); }; const onMouseLeave = () => { dispatchDeferred(dispatch, { - type: "leave-trigger" + type: "leave-trigger", }); }; @@ -123,14 +123,14 @@ const usePopover = () => { triggerProps: { onMouseOver, onMouseLeave, - ref: (node: HTMLElement | null) => (triggerRef.current = node) + ref: (node: HTMLElement | null) => (triggerRef.current = node), }, popoverProps: { dispatch, show: state.onPopover || state.onTrigger, offsetTop: state.offsetTop, - offsetLeft: state.offsetLeft - } + offsetLeft: state.offsetLeft, + }, }; }; diff --git a/scm-ui/ui-components/src/repos/DiffExpander.test.ts b/scm-ui/ui-components/src/repos/DiffExpander.test.ts index 7e4b2e73d6..95f8ea82e4 100644 --- a/scm-ui/ui-components/src/repos/DiffExpander.test.ts +++ b/scm-ui/ui-components/src/repos/DiffExpander.test.ts @@ -42,8 +42,8 @@ const HUNK_0: Hunk = { { content: "line", type: "insert", lineNumber: 5, isInsert: true }, { content: "line", type: "normal", oldLineNumber: 6, newLineNumber: 6, isNormal: true }, { content: "line", type: "normal", oldLineNumber: 7, newLineNumber: 7, isNormal: true }, - { content: "line", type: "normal", oldLineNumber: 8, newLineNumber: 8, isNormal: true } - ] + { content: "line", type: "normal", oldLineNumber: 8, newLineNumber: 8, isNormal: true }, + ], }; const HUNK_1: Hunk = { content: "@@ -14,6 +14,7 @@", @@ -58,8 +58,8 @@ const HUNK_1: Hunk = { { content: "line", type: "insert", lineNumber: 17, isInsert: true }, { content: "line", type: "normal", oldLineNumber: 17, newLineNumber: 18, isNormal: true }, { content: "line", type: "normal", oldLineNumber: 18, newLineNumber: 19, isNormal: true }, - { content: "line", type: "normal", oldLineNumber: 19, newLineNumber: 20, isNormal: true } - ] + { content: "line", type: "normal", oldLineNumber: 19, newLineNumber: 20, isNormal: true }, + ], }; const HUNK_2: Hunk = { content: "@@ -21,7 +22,7 @@", @@ -75,8 +75,8 @@ const HUNK_2: Hunk = { { content: "line", type: "insert", lineNumber: 25, isInsert: true }, { content: "line", type: "normal", oldLineNumber: 25, newLineNumber: 26, isNormal: true }, { content: "line", type: "normal", oldLineNumber: 26, newLineNumber: 27, isNormal: true }, - { content: "line", type: "normal", oldLineNumber: 27, newLineNumber: 28, isNormal: true } - ] + { content: "line", type: "normal", oldLineNumber: 27, newLineNumber: 28, isNormal: true }, + ], }; const HUNK_3: Hunk = { content: "@@ -33,6 +34,7 @@", @@ -91,8 +91,8 @@ const HUNK_3: Hunk = { { content: "line", type: "insert", lineNumber: 37, isInsert: true }, { content: "line", type: "normal", oldLineNumber: 36, newLineNumber: 38, isNormal: true }, { content: "line", type: "normal", oldLineNumber: 37, newLineNumber: 39, isNormal: true }, - { content: "line", type: "normal", oldLineNumber: 38, newLineNumber: 40, isNormal: true } - ] + { content: "line", type: "normal", oldLineNumber: 38, newLineNumber: 40, isNormal: true }, + ], }; const TEST_CONTENT_WITH_HUNKS: FileDiff = { hunks: [HUNK_0, HUNK_1, HUNK_2, HUNK_3], @@ -107,9 +107,9 @@ const TEST_CONTENT_WITH_HUNKS: FileDiff = { _links: { lines: { href: "http://localhost:8081/scm/api/v2/content/abc/CommitMessage.js?start={start}&end={end}", - templated: true - } - } + templated: true, + }, + }, }; const TEST_CONTENT_WITH_NEW_BINARY_FILE: FileDiff = { @@ -119,7 +119,7 @@ const TEST_CONTENT_WITH_NEW_BINARY_FILE: FileDiff = { newEndingNewLine: true, oldRevision: "0000000000000000000000000000000000000000", newRevision: "86c370aae0727d628a5438f79a5cdd45752b9d99", - type: "add" + type: "add", }; const TEST_CONTENT_WITH_NEW_TEXT_FILE: FileDiff = { @@ -138,17 +138,16 @@ const TEST_CONTENT_WITH_NEW_TEXT_FILE: FileDiff = { newLines: 2, changes: [ { content: "line 1", type: "insert", lineNumber: 1, isInsert: true }, - { content: "line 2", type: "insert", lineNumber: 2, isInsert: true } - ] - } + { content: "line 2", type: "insert", lineNumber: 2, isInsert: true }, + ], + }, ], _links: { lines: { - href: - "http://localhost:8081/scm/api/v2/repositories/scm-manager/scm-editor-plugin/content/c63898d35520ee47bcc3a8291660979918715762/src/main/markdown/README.md?start={start}&end={end}", - templated: true - } - } + href: "http://localhost:8081/scm/api/v2/repositories/scm-manager/scm-editor-plugin/content/c63898d35520ee47bcc3a8291660979918715762/src/main/markdown/README.md?start={start}&end={end}", + templated: true, + }, + }, }; const TEST_CONTENT_WITH_DELETED_TEXT_FILE: FileDiff = { @@ -165,10 +164,10 @@ const TEST_CONTENT_WITH_DELETED_TEXT_FILE: FileDiff = { content: "@@ -1 +0,0 @@", oldStart: 1, oldLines: 1, - changes: [{ content: "# scm-editor-plugin", type: "delete", lineNumber: 1, isDelete: true }] - } + changes: [{ content: "# scm-editor-plugin", type: "delete", lineNumber: 1, isDelete: true }], + }, ], - _links: { lines: { href: "http://localhost:8081/dev/null?start={start}&end={end}", templated: true } } + _links: { lines: { href: "http://localhost:8081/dev/null?start={start}&end={end}", templated: true } }, }; const TEST_CONTENT_WITH_DELETED_LINES_AT_END: FileDiff = { @@ -202,16 +201,16 @@ const TEST_CONTENT_WITH_DELETED_LINES_AT_END: FileDiff = { { content: "line", type: "delete", lineNumber: 119, isDelete: true }, { content: "line", type: "delete", lineNumber: 120, isDelete: true }, { content: "line", type: "delete", lineNumber: 121, isDelete: true }, - { content: "line", type: "delete", lineNumber: 122, isDelete: true } - ] - } + { content: "line", type: "delete", lineNumber: 122, isDelete: true }, + ], + }, ], _links: { lines: { href: "http://localhost:8081/scm/api/v2/content/abc/CommitMessage.js?start={start}&end={end}", - templated: true - } - } + templated: true, + }, + }, }; const TEST_CONTENT_WITH_ALL_LINES_REMOVED_FROM_FILE: FileDiff = { @@ -231,17 +230,16 @@ const TEST_CONTENT_WITH_ALL_LINES_REMOVED_FROM_FILE: FileDiff = { changes: [ { content: "line", type: "delete", lineNumber: 1, isDelete: true }, { content: "line", type: "delete", lineNumber: 2, isDelete: true }, - { content: "line", type: "delete", lineNumber: 3, isDelete: true } - ] - } + { content: "line", type: "delete", lineNumber: 3, isDelete: true }, + ], + }, ], _links: { lines: { - href: - "http://localhost:8081/scm/api/v2/repositories/scm-manager/scm-editor-plugin/content/b313a7690f028c77df98417c1ed6cba67e5692ec/pom.xml?start={start}&end={end}", - templated: true - } - } + href: "http://localhost:8081/scm/api/v2/repositories/scm-manager/scm-editor-plugin/content/b313a7690f028c77df98417c1ed6cba67e5692ec/pom.xml?start={start}&end={end}", + templated: true, + }, + }, }; describe("with hunks the diff expander", () => { @@ -285,7 +283,7 @@ describe("with hunks the diff expander", () => { await diffExpander .getHunk(1) .expandBottom(1) - .then(file => (newFile = file)); + .then((file) => (newFile = file)); expect(fetchMock.done()).toBe(true); expect(newFile!.hunks!.length).toBe(oldHunkCount + 1); expect(newFile!.hunks![1]).toBe(expandedHunk); @@ -310,7 +308,7 @@ describe("with hunks the diff expander", () => { await diffExpander .getHunk(1) .expandHead(5) - .then(file => (newFile = file)); + .then((file) => (newFile = file)); expect(fetchMock.done()).toBe(true); expect(newFile!.hunks!.length).toBe(oldHunkCount + 1); expect(newFile!.hunks![0]).toBe(preceedingHunk); @@ -339,7 +337,7 @@ describe("with hunks the diff expander", () => { await diffExpander .getHunk(3) .expandBottom(10) - .then(file => (newFile = file)); + .then((file) => (newFile = file)); expect(newFile!.hunks!.length).toBe(oldHunkCount + 1); expect(newFile!.hunks![4].fullyExpanded).toBe(true); }); @@ -352,7 +350,7 @@ describe("with hunks the diff expander", () => { await diffExpander .getHunk(3) .expandBottom(-1) - .then(file => (newFile = file)); + .then((file) => (newFile = file)); await fetchMock.flush(true); expect(newFile!.hunks![4].fullyExpanded).toBe(true); }); diff --git a/scm-ui/ui-components/src/repos/DiffExpander.ts b/scm-ui/ui-components/src/repos/DiffExpander.ts index 7e468eb819..8c8b17ff32 100644 --- a/scm-ui/ui-components/src/repos/DiffExpander.ts +++ b/scm-ui/ui-components/src/repos/DiffExpander.ts @@ -75,7 +75,7 @@ class DiffExpander { expandHead: (n: number, count: number) => Promise = (n, count) => { const start = this.minLineNumber(n) - Math.min(count, this.computeMaxExpandHeadRange(n)) - 1; const end = this.minLineNumber(n) - 1; - return this.loadLines(start, end).then(lines => { + return this.loadLines(start, end).then((lines) => { const hunk = this.file.hunks![n]; const newHunk = this.createNewHunk( @@ -96,7 +96,7 @@ class DiffExpander { count > 0 ? start + Math.min(count, maxExpandBottomRange > 0 ? maxExpandBottomRange : Number.MAX_SAFE_INTEGER) : -1; - return this.loadLines(start, end).then(lines => { + return this.loadLines(start, end).then((lines) => { const hunk = this.file.hunks![n]; const newHunk: Hunk = this.createNewHunk( @@ -116,9 +116,9 @@ class DiffExpander { .replace("{end}", end.toString()); return apiClient .get(lineRequestUrl) - .then(response => response.text()) - .then(text => text.split("\n")) - .then(lines => (lines[lines.length - 1] === "" ? lines.slice(0, lines.length - 1) : lines)); + .then((response) => response.text()) + .then((text) => text.split("\n")) + .then((lines) => (lines[lines.length - 1] === "" ? lines.slice(0, lines.length - 1) : lines)); }; addHunkToFile = (newHunk: Hunk, position: number) => { @@ -141,13 +141,13 @@ class DiffExpander { let oldLineNumber: number = oldFirstLineNumber; let newLineNumber: number = newFirstLineNumber; - lines.forEach(line => { + lines.forEach((line) => { newChanges.push({ content: line, type: "normal", oldLineNumber, newLineNumber, - isNormal: true + isNormal: true, }); oldLineNumber += 1; newLineNumber += 1; @@ -161,7 +161,7 @@ class DiffExpander { oldLines: lines.length, newLines: lines.length, expansion: true, - fullyExpanded: requestedLines < 0 || lines.length < requestedLines + fullyExpanded: requestedLines < 0 || lines.length < requestedLines, }; }; @@ -175,13 +175,13 @@ class DiffExpander { return lastChange.newLineNumber || lastChange.lineNumber!; }; - getHunk: (n: number) => ExpandableHunk = n => { + getHunk: (n: number) => ExpandableHunk = (n) => { return { maxExpandHeadRange: this.computeMaxExpandHeadRange(n), maxExpandBottomRange: this.computeMaxExpandBottomRange(n), expandHead: (count: number) => this.expandHead(n, count), expandBottom: (count: number) => this.expandBottom(n, count), - hunk: this.file?.hunks![n] + hunk: this.file?.hunks![n], }; }; } diff --git a/scm-ui/ui-components/src/repos/RepositoryFlag.tsx b/scm-ui/ui-components/src/repos/RepositoryFlag.tsx index 303b5da46e..f79ac8805a 100644 --- a/scm-ui/ui-components/src/repos/RepositoryFlag.tsx +++ b/scm-ui/ui-components/src/repos/RepositoryFlag.tsx @@ -24,7 +24,7 @@ import React, { FC } from "react"; import { Color, Size } from "../styleConstants"; -import Tooltip, {TooltipLocation} from "../Tooltip"; +import Tooltip, { TooltipLocation } from "../Tooltip"; import Tag from "../Tag"; type Props = { diff --git a/scm-ui/ui-components/src/repos/Tokenize.worker.ts b/scm-ui/ui-components/src/repos/Tokenize.worker.ts index 72f74b39b1..e4a8adbae7 100644 --- a/scm-ui/ui-components/src/repos/Tokenize.worker.ts +++ b/scm-ui/ui-components/src/repos/Tokenize.worker.ts @@ -49,7 +49,7 @@ function runTokenize({ id, payload }: TokenizeMessage) { const options = { highlight: language !== "text", language: language, - refractor + refractor, }; const doTokenization = (worker: Worker) => { @@ -57,13 +57,13 @@ function runTokenize({ id, payload }: TokenizeMessage) { const tokens = tokenize(hunks, options); const payload = { success: true, - tokens: tokens + tokens: tokens, }; worker.postMessage({ id, payload }); } catch (ex) { const payload = { success: false, - reason: ex.message + reason: ex.message, }; worker.postMessage({ id, payload }); } diff --git a/scm-ui/ui-components/src/repos/TokenizedDiffView.tsx b/scm-ui/ui-components/src/repos/TokenizedDiffView.tsx index 19e9290852..1c3dd89601 100644 --- a/scm-ui/ui-components/src/repos/TokenizedDiffView.tsx +++ b/scm-ui/ui-components/src/repos/TokenizedDiffView.tsx @@ -73,7 +73,7 @@ type Props = { const TokenizedDiffView: FC = ({ file, viewType, className, children }) => { const { tokens } = useTokenizeWorker(tokenize, { hunks: file.hunks, - language: determineLanguage(file.language) + language: determineLanguage(file.language), }); return ( diff --git a/scm-ui/ui-components/src/repos/annotate/Annotate.stories.tsx b/scm-ui/ui-components/src/repos/annotate/Annotate.stories.tsx index 31c1fd7071..9f1e71035d 100644 --- a/scm-ui/ui-components/src/repos/annotate/Annotate.stories.tsx +++ b/scm-ui/ui-components/src/repos/annotate/Annotate.stories.tsx @@ -40,30 +40,30 @@ const commitCreateNewApp = { revision: "0d8c1d328f4599b363755671afe667c7ace52bae", author: { name: "Arthur Dent", - mail: "arthur.dent@hitchhiker.com" + mail: "arthur.dent@hitchhiker.com", }, description: "create new app", - when: new Date("2020-04-09T13:07:42Z") + when: new Date("2020-04-09T13:07:42Z"), }; const commitFixedMissingImport = { revision: "fab38559ce3ab8c388e067712b4bd7ab94b9fa9b", author: { name: "Tricia Marie McMillan", - mail: "trillian@hitchhiker.com" + mail: "trillian@hitchhiker.com", }, description: "fixed missing import", - when: new Date("2020-05-10T09:18:42Z") + when: new Date("2020-05-10T09:18:42Z"), }; const commitImplementMain = { revision: "5203292ab2bc0c020dd22adc4d3897da4930e43f", author: { name: "Ford Prefect", - mail: "ford.prefect@hitchhiker.com" + mail: "ford.prefect@hitchhiker.com", }, description: "implemented main function", - when: new Date("2020-04-12T16:29:42Z") + when: new Date("2020-04-12T16:29:42Z"), }; const source: AnnotatedSource = { @@ -72,44 +72,44 @@ const source: AnnotatedSource = { { lineNumber: 1, code: "package main", - ...commitCreateNewApp + ...commitCreateNewApp, }, { lineNumber: 2, code: "", - ...commitCreateNewApp + ...commitCreateNewApp, }, { lineNumber: 3, code: 'import "fmt"', - ...commitFixedMissingImport + ...commitFixedMissingImport, }, { lineNumber: 4, code: "", - ...commitFixedMissingImport + ...commitFixedMissingImport, }, { lineNumber: 5, code: "func main() {", - ...commitCreateNewApp + ...commitCreateNewApp, }, { lineNumber: 6, code: ' fmt.Println("Hello World")', - ...commitImplementMain + ...commitImplementMain, }, { lineNumber: 7, code: "}", - ...commitCreateNewApp + ...commitCreateNewApp, }, { lineNumber: 8, code: "", - ...commitCreateNewApp - } - ] + ...commitCreateNewApp, + }, + ], }; const markdownSource: AnnotatedSource = { @@ -118,44 +118,44 @@ const markdownSource: AnnotatedSource = { { lineNumber: 1, code: "# Title", - ...commitCreateNewApp + ...commitCreateNewApp, }, { lineNumber: 2, code: "", - ...commitCreateNewApp + ...commitCreateNewApp, }, { lineNumber: 3, code: "This is a short Markdown text.", - ...commitFixedMissingImport + ...commitFixedMissingImport, }, { lineNumber: 4, code: "", - ...commitFixedMissingImport + ...commitFixedMissingImport, }, { lineNumber: 5, code: "With **bold** and __italic__ words.", - ...commitCreateNewApp + ...commitCreateNewApp, }, { lineNumber: 6, code: "", - ...commitImplementMain + ...commitImplementMain, }, { lineNumber: 7, code: "> This should be a quote", - ...commitCreateNewApp + ...commitCreateNewApp, }, { lineNumber: 8, code: "", - ...commitCreateNewApp - } - ] + ...commitCreateNewApp, + }, + ], }; const Robohash: FC = ({ children }) => { @@ -165,8 +165,8 @@ const Robohash: FC = ({ children }) => { }; storiesOf("Repositories/Annotate", module) - .addDecorator(storyFn => {storyFn()}) - .addDecorator(storyFn => {storyFn()}) + .addDecorator((storyFn) => {storyFn()}) + .addDecorator((storyFn) => {storyFn()}) .add("Default", () => ( )) diff --git a/scm-ui/ui-components/src/repos/changesets/ChangesetAuthor.tsx b/scm-ui/ui-components/src/repos/changesets/ChangesetAuthor.tsx index 1dd19da914..c2c513eed1 100644 --- a/scm-ui/ui-components/src/repos/changesets/ChangesetAuthor.tsx +++ b/scm-ui/ui-components/src/repos/changesets/ChangesetAuthor.tsx @@ -115,7 +115,7 @@ const Contributors: FC = ({ persons, label, displayTextOnly }) => <> {t(label)}{" "} - {persons.map(p => ( + {persons.map((p) => ( ))} @@ -125,9 +125,9 @@ const Contributors: FC = ({ persons, label, displayTextOnly }) => return ( <> {t(label)}{" "} - "- " + person.name).join("\n")}> + "- " + person.name).join("\n")}> {t("changeset.contributors.more", { count: persons.length })} - + ); } @@ -148,7 +148,7 @@ const ChangesetAuthor: FC = ({ changeset }) => { const filterContributorsByType = (type: string) => { if (changeset.contributors) { - return changeset.contributors.filter(p => p.type === type).map(contributor => contributor.person); + return changeset.contributors.filter((p) => p.type === type).map((contributor) => contributor.person); } return emptyListOfContributors; }; diff --git a/scm-ui/ui-components/src/repos/changesets/ChangesetDescription.tsx b/scm-ui/ui-components/src/repos/changesets/ChangesetDescription.tsx index 3a76689eac..eac2c00823 100644 --- a/scm-ui/ui-components/src/repos/changesets/ChangesetDescription.tsx +++ b/scm-ui/ui-components/src/repos/changesets/ChangesetDescription.tsx @@ -39,11 +39,11 @@ const ChangesetDescription: FC = ({ changeset, value }) => { "changeset.description.tokens", { changeset, - value + value, } ); - return r(changeset, value))} />; + return r(changeset, value))} />; }; export default ChangesetDescription; diff --git a/scm-ui/ui-components/src/repos/changesets/ChangesetDiff.test.ts b/scm-ui/ui-components/src/repos/changesets/ChangesetDiff.test.ts index e06670864d..a39171986b 100644 --- a/scm-ui/ui-components/src/repos/changesets/ChangesetDiff.test.ts +++ b/scm-ui/ui-components/src/repos/changesets/ChangesetDiff.test.ts @@ -29,9 +29,9 @@ describe("isDiffSupported tests", () => { const supported = isDiffSupported({ _links: { diff: { - href: "http://diff" - } - } + href: "http://diff", + }, + }, }); expect(supported).toBe(true); @@ -41,9 +41,9 @@ describe("isDiffSupported tests", () => { const supported = isDiffSupported({ _links: { diffParsed: { - href: "http://diff" - } - } + href: "http://diff", + }, + }, }); expect(supported).toBe(true); @@ -51,7 +51,7 @@ describe("isDiffSupported tests", () => { it("should return false if not diff link was provided", () => { const supported = isDiffSupported({ - _links: {} + _links: {}, }); expect(supported).toBe(false); @@ -63,9 +63,9 @@ describe("createUrl tests", () => { const url = createUrl({ _links: { diff: { - href: "http://diff" - } - } + href: "http://diff", + }, + }, }); expect(url).toBe("http://diff?format=GIT"); @@ -75,9 +75,9 @@ describe("createUrl tests", () => { const url = createUrl({ _links: { diffParsed: { - href: "http://diff-parsed" - } - } + href: "http://diff-parsed", + }, + }, }); expect(url).toBe("http://diff-parsed"); @@ -87,12 +87,12 @@ describe("createUrl tests", () => { const url = createUrl({ _links: { diff: { - href: "http://diff" + href: "http://diff", }, diffParsed: { - href: "http://diff-parsed" - } - } + href: "http://diff-parsed", + }, + }, }); expect(url).toBe("http://diff-parsed"); @@ -101,7 +101,7 @@ describe("createUrl tests", () => { it("should throw an error if no diff link is defined", () => { expect(() => createUrl({ - _links: {} + _links: {}, }) ).toThrow(); }); diff --git a/scm-ui/ui-components/src/repos/changesets/ChangesetId.tsx b/scm-ui/ui-components/src/repos/changesets/ChangesetId.tsx index 5b3d8774d6..bed339a80f 100644 --- a/scm-ui/ui-components/src/repos/changesets/ChangesetId.tsx +++ b/scm-ui/ui-components/src/repos/changesets/ChangesetId.tsx @@ -34,7 +34,7 @@ type Props = { export default class ChangesetId extends React.Component { static defaultProps = { - link: true + link: true, }; shortId = (changeset: Changeset) => { diff --git a/scm-ui/ui-components/src/repos/changesets/ChangesetList.tsx b/scm-ui/ui-components/src/repos/changesets/ChangesetList.tsx index ee24cd1d60..573d33f1ed 100644 --- a/scm-ui/ui-components/src/repos/changesets/ChangesetList.tsx +++ b/scm-ui/ui-components/src/repos/changesets/ChangesetList.tsx @@ -34,7 +34,7 @@ type Props = { class ChangesetList extends React.Component { render() { const { repository, changesets } = this.props; - const content = changesets.map(changeset => { + const content = changesets.map((changeset) => { return ; }); return <>{content}; diff --git a/scm-ui/ui-components/src/repos/changesets/ChangesetTagsCollapsed.tsx b/scm-ui/ui-components/src/repos/changesets/ChangesetTagsCollapsed.tsx index e2658618ac..516d9c38b3 100644 --- a/scm-ui/ui-components/src/repos/changesets/ChangesetTagsCollapsed.tsx +++ b/scm-ui/ui-components/src/repos/changesets/ChangesetTagsCollapsed.tsx @@ -34,7 +34,7 @@ type Props = WithTranslation & { class ChangesetTagsCollapsed extends React.Component { render() { const { tags, t } = this.props; - const message = tags.map(tag => tag.name).join(", "); + const message = tags.map((tag) => tag.name).join(", "); return ( diff --git a/scm-ui/ui-components/src/repos/changesets/Changesets.stories.tsx b/scm-ui/ui-components/src/repos/changesets/Changesets.stories.tsx index 3afa7948b6..4b6dbf8059 100644 --- a/scm-ui/ui-components/src/repos/changesets/Changesets.stories.tsx +++ b/scm-ui/ui-components/src/repos/changesets/Changesets.stories.tsx @@ -22,19 +22,19 @@ * SOFTWARE. */ -import {storiesOf} from "@storybook/react"; +import { storiesOf } from "@storybook/react"; import * as React from "react"; import styled from "styled-components"; -import {MemoryRouter} from "react-router-dom"; +import { MemoryRouter } from "react-router-dom"; import repository from "../../__resources__/repository"; import ChangesetRow from "./ChangesetRow"; -import {one, two, three, four, five} from "../../__resources__/changesets"; -import {Binder, BinderContext} from "@scm-manager/ui-extensions"; +import { one, two, three, four, five } from "../../__resources__/changesets"; +import { Binder, BinderContext } from "@scm-manager/ui-extensions"; // @ts-ignore import hitchhiker from "../../__resources__/hitchhiker.png"; -import {Person} from "../../avatar/Avatar"; -import {Changeset} from "@scm-manager/ui-types"; -import {Replacement} from "../../SplitAndReplace"; +import { Person } from "../../avatar/Avatar"; +import { Changeset } from "@scm-manager/ui-types"; +import { Replacement } from "../../SplitAndReplace"; const Wrapper = styled.div` margin: 25rem 4rem; @@ -49,7 +49,7 @@ const withAvatarFactory = (factory: (person: Person) => string, changeset: Chang binder.bind("avatar.factory", factory); return ( - + ); }; @@ -59,10 +59,10 @@ const withReplacements = ( changeset: Changeset ) => { const binder = new Binder("changeset stories"); - replacements.forEach(replacement => binder.bind("changeset.description.tokens", replacement)); + replacements.forEach((replacement) => binder.bind("changeset.description.tokens", replacement)); return ( - + ); }; @@ -72,12 +72,12 @@ function copy(input: T): T { } storiesOf("Repositories/Changesets", module) - .addDecorator(story => {story()}) - .addDecorator(storyFn => {storyFn()}) - .add("Default", () => ) - .add("With Committer", () => ) - .add("With Committer and Co-Author", () => ) - .add("With multiple Co-Authors", () => ) + .addDecorator((story) => {story()}) + .addDecorator((storyFn) => {storyFn()}) + .add("Default", () => ) + .add("With Committer", () => ) + .add("With Committer and Co-Author", () => ) + .add("With multiple Co-Authors", () => ) .add("With avatar", () => { return withAvatarFactory(() => hitchhiker, three); }) @@ -92,156 +92,199 @@ storiesOf("Repositories/Changesets", module) const mail = Arthur; return withReplacements( [ - () => [{textToReplace: "HOG-42", replacement: link}], - () => [{textToReplace: "arthur@guide.galaxy", replacement: mail}] + () => [{ textToReplace: "HOG-42", replacement: link }], + () => [{ textToReplace: "arthur@guide.galaxy", replacement: mail }], ], five ); }) .add("With unknown signature", () => { const changeset = copy(three); - changeset.signatures = [{ - keyId: "0x247E908C6FD35473", - type: "gpg", - status: "NOT_FOUND" - }]; - return ; + changeset.signatures = [ + { + keyId: "0x247E908C6FD35473", + type: "gpg", + status: "NOT_FOUND", + }, + ]; + return ; }) .add("With valid signature", () => { const changeset = copy(three); - changeset.signatures = [{ - keyId: "0x247E908C6FD35473", - type: "gpg", - status: "VERIFIED", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }]; - return ; + changeset.signatures = [ + { + keyId: "0x247E908C6FD35473", + type: "gpg", + status: "VERIFIED", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + ]; + return ; }) .add("With unowned signature", () => { const changeset = copy(three); - changeset.signatures = [{ - keyId: "0x247E908C6FD35473", - type: "gpg", - status: "VERIFIED", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }]; - return ; + changeset.signatures = [ + { + keyId: "0x247E908C6FD35473", + type: "gpg", + status: "VERIFIED", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + ]; + return ; }) .add("With contactless signature", () => { const changeset = copy(three); - changeset.signatures = [{ - keyId: "0x247E908C6FD35473", - type: "gpg", - status: "VERIFIED", - owner: "trillian" - }]; - return ; + changeset.signatures = [ + { + keyId: "0x247E908C6FD35473", + type: "gpg", + status: "VERIFIED", + owner: "trillian", + }, + ]; + return ; }) .add("With invalid signature", () => { const changeset = copy(three); - changeset.signatures = [{ - keyId: "0x247E908C6FD35473", - type: "gpg", - status: "INVALID", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }]; - return ; + changeset.signatures = [ + { + keyId: "0x247E908C6FD35473", + type: "gpg", + status: "INVALID", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + ]; + return ; }) .add("With multiple signatures and invalid status", () => { const changeset = copy(three); - changeset.signatures = [{ - keyId: "0x912389FJIQW8W223", - type: "gpg", - status: "INVALID", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }, { - keyId: "0x247E908C6FD35473", - type: "gpg", - status: "VERIFIED", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }, { - keyId: "0x9123891239VFIA33", - type: "gpg", - status: "NOT_FOUND", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }]; - return ; + changeset.signatures = [ + { + keyId: "0x912389FJIQW8W223", + type: "gpg", + status: "INVALID", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + { + keyId: "0x247E908C6FD35473", + type: "gpg", + status: "VERIFIED", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + { + keyId: "0x9123891239VFIA33", + type: "gpg", + status: "NOT_FOUND", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + ]; + return ; }) .add("With multiple signatures and valid status", () => { const changeset = copy(three); - changeset.signatures = [{ - keyId: "0x912389FJIQW8W223", - type: "gpg", - status: "NOT_FOUND", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }, { - keyId: "0x247E908C6FD35473", - type: "gpg", - status: "VERIFIED", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }, { - keyId: "0x9123891239VFIA33", - type: "gpg", - status: "NOT_FOUND", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }]; - return ; + changeset.signatures = [ + { + keyId: "0x912389FJIQW8W223", + type: "gpg", + status: "NOT_FOUND", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + { + keyId: "0x247E908C6FD35473", + type: "gpg", + status: "VERIFIED", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + { + keyId: "0x9123891239VFIA33", + type: "gpg", + status: "NOT_FOUND", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + ]; + return ; }) .add("With multiple signatures and not found status", () => { const changeset = copy(three); - changeset.signatures = [{ - keyId: "0x912389FJIQW8W223", - type: "gpg", - status: "NOT_FOUND", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }, { - keyId: "0x9123891239VFIA33", - type: "gpg", - status: "NOT_FOUND", - owner: "trillian", - contacts: [{ - name: "Tricia Marie McMilla", - mail: "trillian@hitchhiker.com" - }] - }]; - return ; + changeset.signatures = [ + { + keyId: "0x912389FJIQW8W223", + type: "gpg", + status: "NOT_FOUND", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + { + keyId: "0x9123891239VFIA33", + type: "gpg", + status: "NOT_FOUND", + owner: "trillian", + contacts: [ + { + name: "Tricia Marie McMilla", + mail: "trillian@hitchhiker.com", + }, + ], + }, + ]; + return ; }); diff --git a/scm-ui/ui-components/src/repos/changesets/SignatureIcon.tsx b/scm-ui/ui-components/src/repos/changesets/SignatureIcon.tsx index 8369c3bc42..8eb7b76b8c 100644 --- a/scm-ui/ui-components/src/repos/changesets/SignatureIcon.tsx +++ b/scm-ui/ui-components/src/repos/changesets/SignatureIcon.tsx @@ -58,11 +58,11 @@ const SignatureIcon: FC = ({ signatures, className }) => { } const getColor = (signaturesToVerify: Signature[]) => { - const invalid = signaturesToVerify.some(sig => sig.status === "INVALID"); + const invalid = signaturesToVerify.some((sig) => sig.status === "INVALID"); if (invalid) { return "danger"; } - const verified = signaturesToVerify.some(sig => sig.status === "VERIFIED"); + const verified = signaturesToVerify.some((sig) => sig.status === "VERIFIED"); if (verified) { return "success"; } @@ -109,7 +109,7 @@ const SignatureIcon: FC = ({ signatures, className }) => { <>
    {t("changeset.keyContacts")}:
    {signature.contacts && - signature.contacts.map(contact => ( + signature.contacts.map((contact) => (
    - {contact.name} {contact.mail && ` <${contact.mail}>`} @@ -121,7 +121,7 @@ const SignatureIcon: FC = ({ signatures, className }) => { ); }; - const signatureElements = signatures.map(signature => createSignatureBlock(signature)); + const signatureElements = signatures.map((signature) => createSignatureBlock(signature)); return ( <> diff --git a/scm-ui/ui-components/src/repos/changesets/changesets.ts b/scm-ui/ui-components/src/repos/changesets/changesets.ts index 7c74b4f3e1..23cfa74458 100644 --- a/scm-ui/ui-components/src/repos/changesets/changesets.ts +++ b/scm-ui/ui-components/src/repos/changesets/changesets.ts @@ -53,6 +53,6 @@ export function parseDescription(description?: string): Description { return { title, - message + message, }; } diff --git a/scm-ui/ui-components/src/repos/diffs.test.ts b/scm-ui/ui-components/src/repos/diffs.test.ts index 98f9b954cb..ad51e6b361 100644 --- a/scm-ui/ui-components/src/repos/diffs.test.ts +++ b/scm-ui/ui-components/src/repos/diffs.test.ts @@ -33,7 +33,7 @@ describe("tests for diff util functions", () => { oldPath, newPath, newEndingNewLine: true, - oldEndingNewLine: true + oldEndingNewLine: true, }; }; @@ -52,7 +52,7 @@ describe("tests for diff util functions", () => { const createHunk = (content: string): Hunk => { return { content, - changes: [] + changes: [], }; }; @@ -83,7 +83,7 @@ describe("tests for diff util functions", () => { it("should create identifier", () => { const identifier = createHunkIdentifierFromContext({ file: rm("/etc/passwd"), - hunk: createHunk("@@ -1,42 +1,39 @@") + hunk: createHunk("@@ -1,42 +1,39 @@"), }); expect(identifier).toBe("delete_/etc/passwd_@@ -1,42 +1,39 @@"); }); diff --git a/scm-ui/ui-components/src/repos/refractorAdapter.ts b/scm-ui/ui-components/src/repos/refractorAdapter.ts index 6c2f93f1ec..909572670a 100644 --- a/scm-ui/ui-components/src/repos/refractorAdapter.ts +++ b/scm-ui/ui-components/src/repos/refractorAdapter.ts @@ -46,7 +46,7 @@ const createAdapter = (theme: { [key: string]: string }): RefractorAdapter => { import( /* webpackChunkName: "tokenizer-refractor-[request]" */ `refractor/lang/${lang}` - ).then(loadedLanguage => { + ).then((loadedLanguage) => { refractor.register(loadedLanguage.default); callback(); }); @@ -58,7 +58,7 @@ const createAdapter = (theme: { [key: string]: string }): RefractorAdapter => { const runHook = (name: string, env: RunHookEnv) => { originalRunHook.apply(name, env); if (env.classes) { - env.classes = env.classes.map(className => theme[className] || className); + env.classes = env.classes.map((className) => theme[className] || className); } }; // @ts-ignore hooks are not in the type definition @@ -67,7 +67,7 @@ const createAdapter = (theme: { [key: string]: string }): RefractorAdapter => { return { isLanguageRegistered, loadLanguage, - ...refractor + ...refractor, }; }; diff --git a/scm-ui/ui-components/src/repositories.test.ts b/scm-ui/ui-components/src/repositories.test.ts index 759e848425..6a50eecf10 100644 --- a/scm-ui/ui-components/src/repositories.test.ts +++ b/scm-ui/ui-components/src/repositories.test.ts @@ -35,10 +35,10 @@ describe("getProtocolLinkByType tests", () => { protocol: [ { name: "http", - href: "http://scm.scm-manager.org/repo/scm/core" - } - ] - } + href: "http://scm.scm-manager.org/repo/scm/core", + }, + ], + }, }; const link = getProtocolLinkByType(repository, "http"); @@ -54,14 +54,14 @@ describe("getProtocolLinkByType tests", () => { protocol: [ { name: "http", - href: "http://scm.scm-manager.org/repo/scm/core" + href: "http://scm.scm-manager.org/repo/scm/core", }, { name: "ssh", - href: "git@scm.scm-manager.org:scm/core" - } - ] - } + href: "git@scm.scm-manager.org:scm/core", + }, + ], + }, }; const link = getProtocolLinkByType(repository, "http"); @@ -76,9 +76,9 @@ describe("getProtocolLinkByType tests", () => { _links: { protocol: { name: "http", - href: "http://scm.scm-manager.org/repo/scm/core" - } - } + href: "http://scm.scm-manager.org/repo/scm/core", + }, + }, }; const link = getProtocolLinkByType(repository, "http"); @@ -94,14 +94,14 @@ describe("getProtocolLinkByType tests", () => { protocol: [ { name: "http", - href: "http://scm.scm-manager.org/repo/scm/core" + href: "http://scm.scm-manager.org/repo/scm/core", }, { name: "ssh", - href: "git@scm.scm-manager.org:scm/core" - } - ] - } + href: "git@scm.scm-manager.org:scm/core", + }, + ], + }, }; const link = getProtocolLinkByType(repository, "awesome"); @@ -113,7 +113,7 @@ describe("getProtocolLinkByType tests", () => { namespace: "scm", name: "core", type: "git", - _links: {} + _links: {}, }; const link = getProtocolLinkByType(repository, "http"); diff --git a/scm-ui/ui-components/src/storyshots.test.ts b/scm-ui/ui-components/src/storyshots.test.ts index f4a160c3d9..9342395a68 100644 --- a/scm-ui/ui-components/src/storyshots.test.ts +++ b/scm-ui/ui-components/src/storyshots.test.ts @@ -30,7 +30,7 @@ const createNodeMock = (element: any) => { if (element.type === "tr") { return { // eslint-disable-next-line @typescript-eslint/no-empty-function - querySelector: (selector: string) => {} + querySelector: (selector: string) => {}, }; } }; @@ -41,6 +41,6 @@ initStoryshots({ // @see https://github.com/storybookjs/storybook/pull/1090 test: snapshotWithOptions({ // @ts-ignore types seems not to match - createNodeMock - }) + createNodeMock, + }), }); diff --git a/scm-ui/ui-components/src/table/Table.stories.tsx b/scm-ui/ui-components/src/table/Table.stories.tsx index be100c5a20..76f8986900 100644 --- a/scm-ui/ui-components/src/table/Table.stories.tsx +++ b/scm-ui/ui-components/src/table/Table.stories.tsx @@ -43,7 +43,7 @@ storiesOf("Table", module) {(row: any) =>

    {row.firstname}

    }
    @@ -63,7 +63,7 @@ storiesOf("Table", module) > {(row: any) => {row.lastname}} - {(row: any) => {row.email}} + {(row: any) => {row.email}}
    )) .add("TextColumn", () => ( @@ -71,7 +71,7 @@ storiesOf("Table", module) data={[ { id: "21", title: "Pommes", desc: "Fried potato sticks" }, { id: "42", title: "Quarter-Pounder", desc: "Big burger" }, - { id: "-84", title: "Icecream", desc: "Cold dessert" } + { id: "-84", title: "Icecream", desc: "Cold dessert" }, ]} > @@ -90,12 +90,12 @@ storiesOf("Table", module) data={[ { id: "42", - name: "herp_derp_schlerp_ferp_gerp_nerp_terp_ierp_perp_lerp_merp_oerp_zerp_serp_verp_herp" + name: "herp_derp_schlerp_ferp_gerp_nerp_terp_ierp_perp_lerp_merp_oerp_zerp_serp_verp_herp", }, { id: "17", - name: "herp_derp_schlerp_ferp_gerp_nerp_terp_ierp_perp_lerp_merp_oerp_zerp_serp_verp" - } + name: "herp_derp_schlerp_ferp_gerp_nerp_terp_ierp_perp_lerp_merp_oerp_zerp_serp_verp", + }, ]} emptyMessage="No data found." > diff --git a/scm-ui/ui-components/src/table/Table.tsx b/scm-ui/ui-components/src/table/Table.tsx index 600b771913..5281f5221e 100644 --- a/scm-ui/ui-components/src/table/Table.tsx +++ b/scm-ui/ui-components/src/table/Table.tsx @@ -127,7 +127,7 @@ const Table: FC = ({ data, sortable, children, emptyMessage, className }) }; Table.defaultProps = { - sortable: true + sortable: true, }; const renderSortIcon = (child: ReactElement, ascending: boolean, showIcon: boolean) => { diff --git a/scm-ui/ui-components/src/table/TextColumn.tsx b/scm-ui/ui-components/src/table/TextColumn.tsx index 97e78403a4..74dfe80316 100644 --- a/scm-ui/ui-components/src/table/TextColumn.tsx +++ b/scm-ui/ui-components/src/table/TextColumn.tsx @@ -38,7 +38,7 @@ TextColumn.defaultProps = { return comparators.byKey(props.dataKey); }, ascendingIcon: "sort-alpha-down-alt", - descendingIcon: "sort-alpha-down" + descendingIcon: "sort-alpha-down", }; export default TextColumn; diff --git a/scm-ui/ui-components/src/textSplitAndReplace.test.ts b/scm-ui/ui-components/src/textSplitAndReplace.test.ts index 778236ee6d..f3f9fb03dc 100644 --- a/scm-ui/ui-components/src/textSplitAndReplace.test.ts +++ b/scm-ui/ui-components/src/textSplitAndReplace.test.ts @@ -83,7 +83,7 @@ describe("text split and replace", () => { "'So this is it,' said Arthur, 'We are going to die.'", [ { textToReplace: "'", replacement: { text: "“" }, replaceAll: true }, - { textToReplace: "Arthur", replacement: { text: "Dent" }, replaceAll: true } + { textToReplace: "Arthur", replacement: { text: "Dent" }, replaceAll: true }, ], testWrapper ); @@ -106,7 +106,7 @@ describe("text split and replace", () => { { textToReplace: "said Arthur", replacement: { text: "to be replaced" } }, { textToReplace: " said", replacement: { text: "to be ignored 1" }, replaceAll: true }, { textToReplace: "d A", replacement: { text: "to be ignored 2" }, replaceAll: true }, - { textToReplace: "Arthur,", replacement: { text: "to be ignored 3" }, replaceAll: true } + { textToReplace: "Arthur,", replacement: { text: "to be ignored 3" }, replaceAll: true }, ], testWrapper ); @@ -122,7 +122,7 @@ describe("text split and replace", () => { [ { textToReplace: "'So this is it,'", replacement: { text: "one" } }, { textToReplace: " said Arthur, ", replacement: { text: "two" } }, - { textToReplace: "'We are going to die.'", replacement: { text: "three" } } + { textToReplace: "'We are going to die.'", replacement: { text: "three" } }, ], testWrapper ); diff --git a/scm-ui/ui-components/src/textSplitAndReplace.ts b/scm-ui/ui-components/src/textSplitAndReplace.ts index c94f85f34c..9f61196dfc 100644 --- a/scm-ui/ui-components/src/textSplitAndReplace.ts +++ b/scm-ui/ui-components/src/textSplitAndReplace.ts @@ -36,7 +36,7 @@ type PartToReplace = { function hasConflict(alreadyFoundReplacements: PartToReplace[], newReplacement: PartToReplace) { return !!alreadyFoundReplacements.find( - existing => + (existing) => (existing.start <= newReplacement.start && existing.start + existing.length > newReplacement.start) || (newReplacement.start <= existing.start && newReplacement.start + newReplacement.length > existing.start) ); @@ -49,7 +49,7 @@ export default function textSplitAndReplace( ): T[] { const partsToReplace: PartToReplace[] = []; - replacements.forEach(replacement => { + replacements.forEach((replacement) => { let lastIndex = -1; do { const start = text.indexOf(replacement.textToReplace, lastIndex); diff --git a/scm-ui/ui-components/src/toast/Toast.tsx b/scm-ui/ui-components/src/toast/Toast.tsx index 13c4efe518..a20be1d341 100644 --- a/scm-ui/ui-components/src/toast/Toast.tsx +++ b/scm-ui/ui-components/src/toast/Toast.tsx @@ -38,8 +38,8 @@ const Container = styled.div` padding: 1.5rem; right: 1.5rem; bottom: 1.5rem; - color: ${props => props.theme.primary}; - background-color: ${props => props.theme.secondary}; + color: ${(props) => props.theme.primary}; + background-color: ${(props) => props.theme.secondary}; max-width: 18rem; font-size: 0.75rem; border-radius: 5px; diff --git a/scm-ui/ui-components/src/toast/index.stories.tsx b/scm-ui/ui-components/src/toast/index.stories.tsx index 0c1df63c2b..f22a218951 100644 --- a/scm-ui/ui-components/src/toast/index.stories.tsx +++ b/scm-ui/ui-components/src/toast/index.stories.tsx @@ -77,7 +77,7 @@ const Closeable = () => { toastStories.add("Open/Close", () => ); toastStories.add("Click to close", () => ); -types.forEach(type => { +types.forEach((type) => { toastStories.add(type.charAt(0).toUpperCase() + type.slice(1), () => (

    The underlying Pull-Request has changed. Press reload to see the changes.

    @@ -92,7 +92,7 @@ types.forEach(type => { toastStories.add("Multiple", () => ( - {types.map(type => ( + {types.map((type) => (

    The notification received.

    diff --git a/scm-ui/ui-components/src/toast/themes.ts b/scm-ui/ui-components/src/toast/themes.ts index 830e86ac13..dc300c45e5 100644 --- a/scm-ui/ui-components/src/toast/themes.ts +++ b/scm-ui/ui-components/src/toast/themes.ts @@ -42,28 +42,28 @@ const themes: { [name in Type]: ToastTheme } = { info: { primary: "#363636", secondary: "#99d8f3", - tertiary: "white" + tertiary: "white", }, primary: { primary: "#363636", secondary: "#7fe8ef", - tertiary: "white" + tertiary: "white", }, success: { primary: "#363636", secondary: "#7fe3cd", - tertiary: "white" + tertiary: "white", }, warning: { primary: "#905515", secondary: "#ffeeab", - tertiary: "white" + tertiary: "white", }, danger: { primary: "#363636", secondary: "#ff9baf", - tertiary: "white" - } + tertiary: "white", + }, }; export const getTheme = (name: Type) => { diff --git a/scm-ui/ui-components/src/useDateFormatter.ts b/scm-ui/ui-components/src/useDateFormatter.ts index 798b2d5d39..b73e8d4774 100644 --- a/scm-ui/ui-components/src/useDateFormatter.ts +++ b/scm-ui/ui-components/src/useDateFormatter.ts @@ -34,7 +34,7 @@ export const supportedLocales: LocaleMap = { enUS, en: enUS, de, - es + es, }; type Options = { @@ -77,7 +77,7 @@ export type DateProps = { const createOptions = (locale: Locale, timeZone?: string) => { const options: Options = { addSuffix: true, - locale + locale, }; if (timeZone) { options.timeZone = timeZone; @@ -119,7 +119,7 @@ const useDateFormatter = ({ date, baseDate, timeZone }: DateProps) => { }, formatDistance() { return formatDistance(isoDate, base, options); - } + }, }; }; diff --git a/scm-ui/ui-components/src/validation.test.ts b/scm-ui/ui-components/src/validation.test.ts index a229319572..19fce08baa 100644 --- a/scm-ui/ui-components/src/validation.test.ts +++ b/scm-ui/ui-components/src/validation.test.ts @@ -40,7 +40,7 @@ describe("test name validation", () => { " invalid_name", "%", "test%name", - "test\\name" + "test\\name", ]; for (const name of invalidNames) { it(`should return false for '${name}'`, () => { @@ -75,7 +75,7 @@ describe("test name validation", () => { "법률", "المدن", "אחד", - "Hu-rëm" + "Hu-rëm", ]; for (const name of validNames) { it(`should return true for '${name}'`, () => { @@ -92,7 +92,7 @@ describe("test mail validation", () => { "s.sdorra@", "s.sdorra@ostfalia", "s.sdorra@ ostfalia.de", - "s.sdorra@[ostfalia.de" + "s.sdorra@[ostfalia.de", ]; for (const mail of invalid) { it(`should return false for '${mail}'`, () => { @@ -111,7 +111,7 @@ describe("test mail validation", () => { "s.sdorra@example.xn--p1ai", "s.sdorra@scm.solutions", "s'sdorra@scm.solutions", - '"S Sdorra"@scm.solutions' + '"S Sdorra"@scm.solutions', ]; for (const mail of valid) { it(`should return true for '${mail}'`, () => { @@ -172,7 +172,7 @@ describe("test url validation", () => { ":// should fail", "http://foo.bar/foo(bar)baz quux", "http://.www.foo.bar/", - "http://.www.foo.bar./" + "http://.www.foo.bar./", ]; for (const url of invalid) { it(`should return false for '${url}'`, () => { @@ -225,7 +225,7 @@ describe("test url validation", () => { "http://1337.net", "http://a.b-c.de", "http://223.255.255.254", - "http://0.0.0.0" + "http://0.0.0.0", ]; for (const url of valid) { it(`should return true for '${url}'`, () => { diff --git a/scm-ui/ui-components/src/validation.ts b/scm-ui/ui-components/src/validation.ts index ee364528a7..eb4e4b6d98 100644 --- a/scm-ui/ui-components/src/validation.ts +++ b/scm-ui/ui-components/src/validation.ts @@ -45,10 +45,7 @@ export const isNumberValid = (number: any) => { }; export const isPathValid = (path: string) => { - return path !== "." - && !path.includes("../") - && !path.includes("//") - && path !== ".."; + return path !== "." && !path.includes("../") && !path.includes("//") && path !== ".."; }; const urlRegex = /^[A-Za-z0-9]+:\/\/[^\s$.?#].[^\s]*$/; diff --git a/scm-ui/ui-webapp/src/LegacyReduxProvider.tsx b/scm-ui/ui-webapp/src/LegacyReduxProvider.tsx index 8c1ffe5ba4..229548485c 100644 --- a/scm-ui/ui-webapp/src/LegacyReduxProvider.tsx +++ b/scm-ui/ui-webapp/src/LegacyReduxProvider.tsx @@ -65,16 +65,16 @@ const reducer = (state: State = initialState, action: ActionTypes = { type: ACTI ...state, indexResources: { version: action.payload.version, - links: action.payload._links - } + links: action.payload._links, + }, }; } case "scm/me_success": { return { ...state, auth: { - me: action.payload - } + me: action.payload, + }, }; } default: { @@ -90,14 +90,14 @@ const store = createStore(reducer, initialState); export const fetchIndexResourcesSuccess = (index: IndexResources): ActionTypes => { return { type: ACTION_TYPE_INDEX, - payload: index + payload: index, }; }; export const fetchMeSuccess = (me: Me): ActionTypes => { return { type: ACTION_TYPE_ME, - payload: me + payload: me, }; }; diff --git a/scm-ui/ui-webapp/src/ReduxAwareApiProvider.tsx b/scm-ui/ui-webapp/src/ReduxAwareApiProvider.tsx index 85d9e5a301..671865fc2c 100644 --- a/scm-ui/ui-webapp/src/ReduxAwareApiProvider.tsx +++ b/scm-ui/ui-webapp/src/ReduxAwareApiProvider.tsx @@ -40,7 +40,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => { }, onMeFetched: (me: Me) => { dispatch(fetchMeSuccess(me)); - } + }, }; }; diff --git a/scm-ui/ui-webapp/src/admin/components/form/ConfigForm.tsx b/scm-ui/ui-webapp/src/admin/components/form/ConfigForm.tsx index db3df04dfa..3385e2903c 100644 --- a/scm-ui/ui-webapp/src/admin/components/form/ConfigForm.tsx +++ b/scm-ui/ui-webapp/src/admin/components/form/ConfigForm.tsx @@ -45,7 +45,7 @@ const ConfigForm: FC = ({ loading, configReadPermission, configUpdatePermission, - namespaceStrategies + namespaceStrategies, }) => { const [t] = useTranslation("config"); const [innerConfig, setInnerConfig] = useState({ @@ -74,7 +74,7 @@ const ConfigForm: FC = ({ mailDomainName: "", emergencyContacts: [], enabledApiKeys: true, - _links: {} + _links: {}, }); const [showNotification, setShowNotification] = useState(false); const [changed, setChanged] = useState(false); @@ -83,7 +83,7 @@ const ConfigForm: FC = ({ loginAttemptLimit: boolean; }>({ loginAttemptLimitTimeout: false, - loginAttemptLimit: false + loginAttemptLimit: false, }); useEffect(() => { diff --git a/scm-ui/ui-webapp/src/admin/components/form/GeneralSettings.tsx b/scm-ui/ui-webapp/src/admin/components/form/GeneralSettings.tsx index ccdad61c83..cf006b10bf 100644 --- a/scm-ui/ui-webapp/src/admin/components/form/GeneralSettings.tsx +++ b/scm-ui/ui-webapp/src/admin/components/form/GeneralSettings.tsx @@ -30,7 +30,7 @@ import { InputField, MemberNameTagGroup, AutocompleteAddEntryToTableField, - Select + Select, } from "@scm-manager/ui-components"; import NamespaceStrategySelect from "./NamespaceStrategySelect"; @@ -68,7 +68,7 @@ const GeneralSettings: FC = ({ namespaceStrategy, namespaceStrategies, onChange, - hasUpdatePermission + hasUpdatePermission, }) => { const { t } = useTranslation("config"); const userSuggestions = useUserSuggestions(); @@ -181,7 +181,7 @@ const GeneralSettings: FC = ({ options={[ { label: t("general-settings.anonymousMode.full"), value: "FULL" }, { label: t("general-settings.anonymousMode.protocolOnly"), value: "PROTOCOL_ONLY" }, - { label: t("general-settings.anonymousMode.off"), value: "OFF" } + { label: t("general-settings.anonymousMode.off"), value: "OFF" }, ]} helpText={t("help.allowAnonymousAccessHelpText")} testId={"anonymous-mode-select"} diff --git a/scm-ui/ui-webapp/src/admin/components/form/LoginAttempt.tsx b/scm-ui/ui-webapp/src/admin/components/form/LoginAttempt.tsx index b81a865b05..094e87f8bc 100644 --- a/scm-ui/ui-webapp/src/admin/components/form/LoginAttempt.tsx +++ b/scm-ui/ui-webapp/src/admin/components/form/LoginAttempt.tsx @@ -43,7 +43,7 @@ class LoginAttempt extends React.Component { this.state = { loginAttemptLimitError: false, - loginAttemptLimitTimeoutError: false + loginAttemptLimitTimeoutError: false, }; } render() { @@ -84,7 +84,7 @@ class LoginAttempt extends React.Component { handleLoginAttemptLimitChange = (value: string) => { this.setState({ ...this.state, - loginAttemptLimitError: !validator.isNumberValid(value) + loginAttemptLimitError: !validator.isNumberValid(value), }); this.props.onChange(validator.isNumberValid(value), value, "loginAttemptLimit"); }; @@ -92,7 +92,7 @@ class LoginAttempt extends React.Component { handleLoginAttemptLimitTimeoutChange = (value: string) => { this.setState({ ...this.state, - loginAttemptLimitTimeoutError: !validator.isNumberValid(value) + loginAttemptLimitTimeoutError: !validator.isNumberValid(value), }); this.props.onChange(validator.isNumberValid(value), value, "loginAttemptLimitTimeout"); }; diff --git a/scm-ui/ui-webapp/src/admin/components/form/NamespaceStrategySelect.tsx b/scm-ui/ui-webapp/src/admin/components/form/NamespaceStrategySelect.tsx index e5a17fa47a..0e20d32de9 100644 --- a/scm-ui/ui-webapp/src/admin/components/form/NamespaceStrategySelect.tsx +++ b/scm-ui/ui-webapp/src/admin/components/form/NamespaceStrategySelect.tsx @@ -43,7 +43,7 @@ class NamespaceStrategySelect extends React.Component { available = namespaceStrategies.available; } - return available.map(ns => { + return available.map((ns) => { const key = "namespaceStrategies." + ns; let label = t(key); if (label === key) { @@ -51,7 +51,7 @@ class NamespaceStrategySelect extends React.Component { } return { value: ns, - label: label + label: label, }; }); }; diff --git a/scm-ui/ui-webapp/src/admin/components/form/ProxySettings.tsx b/scm-ui/ui-webapp/src/admin/components/form/ProxySettings.tsx index 859c08d11c..d435bebb96 100644 --- a/scm-ui/ui-webapp/src/admin/components/form/ProxySettings.tsx +++ b/scm-ui/ui-webapp/src/admin/components/form/ProxySettings.tsx @@ -39,16 +39,8 @@ type Props = WithTranslation & { class ProxySettings extends React.Component { render() { - const { - t, - proxyPassword, - proxyPort, - proxyServer, - proxyUser, - enableProxy, - proxyExcludes, - hasUpdatePermission, - } = this.props; + const { t, proxyPassword, proxyPort, proxyServer, proxyUser, enableProxy, proxyExcludes, hasUpdatePermission } = + this.props; return (
    diff --git a/scm-ui/ui-webapp/src/admin/components/table/ArrayConfigTable.tsx b/scm-ui/ui-webapp/src/admin/components/table/ArrayConfigTable.tsx index 13200e8f46..50f4915e13 100644 --- a/scm-ui/ui-webapp/src/admin/components/table/ArrayConfigTable.tsx +++ b/scm-ui/ui-webapp/src/admin/components/table/ArrayConfigTable.tsx @@ -42,7 +42,7 @@ class ArrayConfigTable extends React.Component { - {items.map(item => { + {items.map((item) => { return ( @@ -66,7 +66,7 @@ class ArrayConfigTable extends React.Component { } removeEntry = (item: string) => { - const newItems = this.props.items.filter(name => name !== item); + const newItems = this.props.items.filter((name) => name !== item); this.props.onRemove(newItems, item); }; } diff --git a/scm-ui/ui-webapp/src/admin/containers/Admin.tsx b/scm-ui/ui-webapp/src/admin/containers/Admin.tsx index 155702bb0d..ff4b20bc50 100644 --- a/scm-ui/ui-webapp/src/admin/containers/Admin.tsx +++ b/scm-ui/ui-webapp/src/admin/containers/Admin.tsx @@ -34,7 +34,7 @@ import { SecondaryNavigationColumn, StateMenuContextProvider, SubNavigation, - urls + urls, } from "@scm-manager/ui-components"; import AdminDetails from "./AdminDetails"; import PluginsOverview from "../plugins/containers/PluginsOverview"; @@ -60,7 +60,7 @@ const Admin: FC = () => { const url = urls.matchedUrlFromMatch(match); const extensionProps = { links, - url + url, }; return ( diff --git a/scm-ui/ui-webapp/src/admin/containers/AdminDetails.tsx b/scm-ui/ui-webapp/src/admin/containers/AdminDetails.tsx index cdcb4c8991..f01cf49369 100644 --- a/scm-ui/ui-webapp/src/admin/containers/AdminDetails.tsx +++ b/scm-ui/ui-webapp/src/admin/containers/AdminDetails.tsx @@ -63,7 +63,7 @@ const AdminDetails: FC = () => { version: updateInfo?.latestVersion, })}

    - + {t("admin.info.newRelease.downloadButton")} @@ -89,7 +89,12 @@ const AdminDetails: FC = () => {

    {t("admin.info.communityTitle")}

    {t("admin.info.communityInfo")}

    - + {t("admin.info.communityButton")}
    @@ -113,6 +118,7 @@ const AdminDetails: FC = () => { className="button is-info is-pulled-right is-normal" target="_blank" href={t("admin.info.enterpriseLink")} + rel="noreferrer" > {t("admin.info.enterpriseButton")} diff --git a/scm-ui/ui-webapp/src/admin/containers/GlobalConfig.tsx b/scm-ui/ui-webapp/src/admin/containers/GlobalConfig.tsx index 35a05cc9a7..1457a085d3 100644 --- a/scm-ui/ui-webapp/src/admin/containers/GlobalConfig.tsx +++ b/scm-ui/ui-webapp/src/admin/containers/GlobalConfig.tsx @@ -34,7 +34,7 @@ const GlobalConfig: FC = () => { const { data: namespaceStrategies, error: namespaceStrategiesLoadingError, - isLoading: isLoadingNamespaceStrategies + isLoading: isLoadingNamespaceStrategies, } = useNamespaceStrategies(); const [t] = useTranslation("config"); const error = configLoadingError || namespaceStrategiesLoadingError || updateError || undefined; diff --git a/scm-ui/ui-webapp/src/admin/plugins/components/PendingPluginsQueue.tsx b/scm-ui/ui-webapp/src/admin/plugins/components/PendingPluginsQueue.tsx index f8fd298674..b52c232269 100644 --- a/scm-ui/ui-webapp/src/admin/plugins/components/PendingPluginsQueue.tsx +++ b/scm-ui/ui-webapp/src/admin/plugins/components/PendingPluginsQueue.tsx @@ -44,7 +44,7 @@ const Section: FC = ({ pendingPlugins, type, label }) => { <> {label}
      - {plugins.map(plugin => ( + {plugins.map((plugin) => (
    • {plugin.name}
    • ))}
    diff --git a/scm-ui/ui-webapp/src/admin/plugins/components/PluginActionModal.tsx b/scm-ui/ui-webapp/src/admin/plugins/components/PluginActionModal.tsx index df7a15c1d7..2f66273cf0 100644 --- a/scm-ui/ui-webapp/src/admin/plugins/components/PluginActionModal.tsx +++ b/scm-ui/ui-webapp/src/admin/plugins/components/PluginActionModal.tsx @@ -72,8 +72,8 @@ class PluginActionModal extends React.Component { {t("plugins.modal.updateQueue")}
      {installedPlugins._embedded.plugins - .filter(plugin => plugin._links && plugin._links.update) - .map(plugin => ( + .filter((plugin) => plugin._links && plugin._links.update) + .map((plugin) => (
    • {plugin.name}
    • ))}
    @@ -91,7 +91,7 @@ class PluginActionModal extends React.Component { <> {t("plugins.modal.installQueue")}
      - {pendingPlugins._embedded.new.map(plugin => ( + {pendingPlugins._embedded.new.map((plugin) => (
    • {plugin.name}
    • ))}
    @@ -109,7 +109,7 @@ class PluginActionModal extends React.Component { <> {t("plugins.modal.updateQueue")}
      - {pendingPlugins._embedded.update.map(plugin => ( + {pendingPlugins._embedded.update.map((plugin) => (
    • {plugin.name}
    • ))}
    @@ -127,7 +127,7 @@ class PluginActionModal extends React.Component { <> {t("plugins.modal.uninstallQueue")}
      - {pendingPlugins._embedded.uninstall.map(plugin => ( + {pendingPlugins._embedded.uninstall.map((plugin) => (
    • {plugin.name}
    • ))}
    diff --git a/scm-ui/ui-webapp/src/admin/plugins/components/PluginModal.tsx b/scm-ui/ui-webapp/src/admin/plugins/components/PluginModal.tsx index c94579f222..259dfb1bd5 100644 --- a/scm-ui/ui-webapp/src/admin/plugins/components/PluginModal.tsx +++ b/scm-ui/ui-webapp/src/admin/plugins/components/PluginModal.tsx @@ -65,7 +65,7 @@ const PluginModal: FC = ({ onClose, pluginAction, plugin }) => { if (isDone && !shouldRestart) { onClose(); } - }, [isDone]); + }, [isDone, onClose, shouldRestart]); const handlePluginAction = (e: React.MouseEvent) => { e.preventDefault(); diff --git a/scm-ui/ui-webapp/src/admin/plugins/components/SuccessNotification.tsx b/scm-ui/ui-webapp/src/admin/plugins/components/SuccessNotification.tsx index 59a60155c9..cc64569f1e 100644 --- a/scm-ui/ui-webapp/src/admin/plugins/components/SuccessNotification.tsx +++ b/scm-ui/ui-webapp/src/admin/plugins/components/SuccessNotification.tsx @@ -23,7 +23,7 @@ */ import React from "react"; import { WithTranslation, withTranslation } from "react-i18next"; -import { Notification } from "@scm-manager/ui-components"; +import { NoStyleButton, Notification } from "@scm-manager/ui-components"; import { PluginAction } from "../containers/PluginsOverview"; type Props = WithTranslation & { @@ -48,7 +48,9 @@ class InstallSuccessNotification extends React.Component { return ( {this.createMessageForPluginAction()}{" "} - window.location.reload(true)}>{t("plugins.modal.reload")} + window.location.reload(true)} className="has-text-info"> + {t("plugins.modal.reload")} + ); } diff --git a/scm-ui/ui-webapp/src/admin/plugins/components/groupByCategory.ts b/scm-ui/ui-webapp/src/admin/plugins/components/groupByCategory.ts index c92a7faed2..16871ca62f 100644 --- a/scm-ui/ui-webapp/src/admin/plugins/components/groupByCategory.ts +++ b/scm-ui/ui-webapp/src/admin/plugins/components/groupByCategory.ts @@ -33,7 +33,7 @@ export default function groupByCategory(plugins: Plugin[]): PluginGroup[] { if (!group) { group = { name: groupName, - plugins: [] + plugins: [], }; groups[groupName] = group; } diff --git a/scm-ui/ui-webapp/src/admin/roles/components/PermissionRoleDetails.tsx b/scm-ui/ui-webapp/src/admin/roles/components/PermissionRoleDetails.tsx index a00e5a8e86..86c926fa50 100644 --- a/scm-ui/ui-webapp/src/admin/roles/components/PermissionRoleDetails.tsx +++ b/scm-ui/ui-webapp/src/admin/roles/components/PermissionRoleDetails.tsx @@ -58,7 +58,7 @@ class PermissionRoleDetails extends React.Component { name="repositoryRole.role-details.information" renderAll={true} props={{ - role + role, }} /> diff --git a/scm-ui/ui-webapp/src/admin/roles/containers/DeleteRepositoryRole.tsx b/scm-ui/ui-webapp/src/admin/roles/containers/DeleteRepositoryRole.tsx index 9c7db53587..f675a1abfb 100644 --- a/scm-ui/ui-webapp/src/admin/roles/containers/DeleteRepositoryRole.tsx +++ b/scm-ui/ui-webapp/src/admin/roles/containers/DeleteRepositoryRole.tsx @@ -67,12 +67,12 @@ const DeleteRepositoryRole: FC = ({ confirmDialog = true, role }: Props) { className: "is-outlined", label: t("repositoryRole.delete.confirmAlert.submit"), - onClick: deleteRoleCallback + onClick: deleteRoleCallback, }, { label: t("repositoryRole.delete.confirmAlert.cancel"), - onClick: () => null - } + onClick: () => null, + }, ]} close={() => setShowConfirmAlert(false)} /> diff --git a/scm-ui/ui-webapp/src/admin/roles/containers/RepositoryRoleForm.tsx b/scm-ui/ui-webapp/src/admin/roles/containers/RepositoryRoleForm.tsx index a524f0b52b..10f28f0b10 100644 --- a/scm-ui/ui-webapp/src/admin/roles/containers/RepositoryRoleForm.tsx +++ b/scm-ui/ui-webapp/src/admin/roles/containers/RepositoryRoleForm.tsx @@ -42,8 +42,8 @@ const RepositoryRoleForm: FC = ({ role: initialRole, submitForm }) => { name: "", verbs: [], _links: { - create: { href: createLink } - } + create: { href: createLink }, + }, } ); const availableVerbs = data?.verbs; @@ -58,7 +58,7 @@ const RepositoryRoleForm: FC = ({ role: initialRole, submitForm }) => { const handleVerbChange = (value: boolean, name: string) => setRole({ ...role, - verbs: value ? [...role.verbs, name] : role.verbs.filter(v => v !== name) + verbs: value ? [...role.verbs, name] : role.verbs.filter((v) => v !== name), }); const submit = (event: FormEvent) => { diff --git a/scm-ui/ui-webapp/src/admin/roles/containers/RepositoryRoles.tsx b/scm-ui/ui-webapp/src/admin/roles/containers/RepositoryRoles.tsx index f3c64062c1..62b69754ef 100644 --- a/scm-ui/ui-webapp/src/admin/roles/containers/RepositoryRoles.tsx +++ b/scm-ui/ui-webapp/src/admin/roles/containers/RepositoryRoles.tsx @@ -32,7 +32,7 @@ import { Notification, Subtitle, Title, - urls + urls, } from "@scm-manager/ui-components"; import PermissionRoleTable from "../components/PermissionRoleTable"; import { useRepositoryRoles } from "@scm-manager/ui-api"; diff --git a/scm-ui/ui-webapp/src/admin/roles/containers/SingleRepositoryRole.tsx b/scm-ui/ui-webapp/src/admin/roles/containers/SingleRepositoryRole.tsx index c13eeb64a4..295764a949 100644 --- a/scm-ui/ui-webapp/src/admin/roles/containers/SingleRepositoryRole.tsx +++ b/scm-ui/ui-webapp/src/admin/roles/containers/SingleRepositoryRole.tsx @@ -50,7 +50,7 @@ const SingleRepositoryRole: FC = () => { const extensionProps = { role, - url + url, }; return ( diff --git a/scm-ui/ui-webapp/src/components/HeaderButton.tsx b/scm-ui/ui-webapp/src/components/HeaderButton.tsx index ee4e0bcd5b..af92faef76 100644 --- a/scm-ui/ui-webapp/src/components/HeaderButton.tsx +++ b/scm-ui/ui-webapp/src/components/HeaderButton.tsx @@ -22,7 +22,6 @@ * SOFTWARE. */ -import React from "react"; import styled from "styled-components"; import { devices } from "@scm-manager/ui-components"; diff --git a/scm-ui/ui-webapp/src/containers/Logout.tsx b/scm-ui/ui-webapp/src/containers/Logout.tsx index f5a040a17b..ef45a9f217 100644 --- a/scm-ui/ui-webapp/src/containers/Logout.tsx +++ b/scm-ui/ui-webapp/src/containers/Logout.tsx @@ -28,14 +28,14 @@ import { ErrorPage, Loading } from "@scm-manager/ui-components"; import { Redirect } from "react-router-dom"; import { useLogout } from "@scm-manager/ui-api"; -const Logout: FC = ({}) => { +const Logout: FC = () => { const { error, logout } = useLogout(); const [t] = useTranslation("commons"); useEffect(() => { if (logout) { logout(); } - }, []); + }, [logout]); if (!logout) { return ; diff --git a/scm-ui/ui-webapp/src/containers/NavigationBar.tsx b/scm-ui/ui-webapp/src/containers/NavigationBar.tsx index 11c2a96f28..52b0e58933 100644 --- a/scm-ui/ui-webapp/src/containers/NavigationBar.tsx +++ b/scm-ui/ui-webapp/src/containers/NavigationBar.tsx @@ -133,7 +133,6 @@ const NavigationBar: FC = ({ links }) => {
    - + ); }; diff --git a/scm-ui/ui-webapp/src/repos/branches/components/BranchTable.tsx b/scm-ui/ui-webapp/src/repos/branches/components/BranchTable.tsx index 300ebc9b3c..697978f702 100644 --- a/scm-ui/ui-webapp/src/repos/branches/components/BranchTable.tsx +++ b/scm-ui/ui-webapp/src/repos/branches/components/BranchTable.tsx @@ -77,12 +77,12 @@ const BranchTable: FC = ({ repository, baseUrl, branches, type }) => { className: "is-outlined", label: t("branch.delete.confirmAlert.submit"), isLoading, - onClick: () => deleteBranch() + onClick: () => deleteBranch(), }, { label: t("branch.delete.confirmAlert.cancel"), - onClick: () => abortDelete() - } + onClick: () => abortDelete(), + }, ]} close={() => abortDelete()} /> @@ -95,7 +95,7 @@ const BranchTable: FC = ({ repository, baseUrl, branches, type }) => { - {(branches || []).map(branch => ( + {(branches || []).map((branch) => ( ))} diff --git a/scm-ui/ui-webapp/src/repos/branches/components/BranchView.tsx b/scm-ui/ui-webapp/src/repos/branches/components/BranchView.tsx index d7d13e43e3..7c89fa2599 100644 --- a/scm-ui/ui-webapp/src/repos/branches/components/BranchView.tsx +++ b/scm-ui/ui-webapp/src/repos/branches/components/BranchView.tsx @@ -45,7 +45,7 @@ class BranchView extends React.Component { renderAll={true} props={{ repository, - branch + branch, }} /> diff --git a/scm-ui/ui-webapp/src/repos/branches/containers/BranchesOverview.tsx b/scm-ui/ui-webapp/src/repos/branches/containers/BranchesOverview.tsx index c69f6ba1e0..9bdde064ae 100644 --- a/scm-ui/ui-webapp/src/repos/branches/containers/BranchesOverview.tsx +++ b/scm-ui/ui-webapp/src/repos/branches/containers/BranchesOverview.tsx @@ -53,8 +53,8 @@ const BranchesOverview: FC = ({ repository, baseUrl }) => { } orderBranches(branches); - const staleBranches = branches.filter(b => b.stale); - const activeBranches = branches.filter(b => !b.stale); + const staleBranches = branches.filter((b) => b.stale); + const activeBranches = branches.filter((b) => !b.stale); const showCreateButton = !!data._links.create; diff --git a/scm-ui/ui-webapp/src/repos/branches/util/orderBranches.test.ts b/scm-ui/ui-webapp/src/repos/branches/util/orderBranches.test.ts index 13024ace8a..2f956efe96 100644 --- a/scm-ui/ui-webapp/src/repos/branches/util/orderBranches.test.ts +++ b/scm-ui/ui-webapp/src/repos/branches/util/orderBranches.test.ts @@ -26,36 +26,36 @@ import { orderBranches } from "./orderBranches"; const branch1 = { name: "branch1", - revision: "revision1" + revision: "revision1", }; const branch2 = { name: "branch2", - revision: "revision2" + revision: "revision2", }; const branch3 = { name: "branch3", revision: "revision3", - defaultBranch: true + defaultBranch: true, }; const defaultBranch = { name: "default", revision: "revision4", - defaultBranch: false + defaultBranch: false, }; const developBranch = { name: "develop", revision: "revision5", - defaultBranch: false + defaultBranch: false, }; const mainBranch = { name: "main", revision: "revision6", - defaultBranch: false + defaultBranch: false, }; const masterBranch = { name: "master", revision: "revision7", - defaultBranch: false + defaultBranch: false, }; describe("order branches", () => { diff --git a/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx b/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx index ceafe446b6..41251211a8 100644 --- a/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx +++ b/scm-ui/ui-webapp/src/repos/codeSection/components/CodeViewSwitcher.tsx @@ -38,7 +38,7 @@ const ButtonAddonsMarginRight = styled(ButtonAddons)` type Type = "sources" | "changesets"; -export type SwitchViewLink = string | ((type: Type) => string) +export type SwitchViewLink = string | ((type: Type) => string); type Props = { currentUrl: string; diff --git a/scm-ui/ui-webapp/src/repos/codeSection/utils/filepathSearch.test.ts b/scm-ui/ui-webapp/src/repos/codeSection/utils/filepathSearch.test.ts index 44ff43fc25..1c38b681be 100644 --- a/scm-ui/ui-webapp/src/repos/codeSection/utils/filepathSearch.test.ts +++ b/scm-ui/ui-webapp/src/repos/codeSection/utils/filepathSearch.test.ts @@ -48,7 +48,7 @@ describe("filepathSearch tests", () => { "SomeResolver", "SomeTokenResolver", "accesstokenresolver", - "ActorExpression" + "ActorExpression", ]; const matches = filepathSearch(paths, "AcToRe"); diff --git a/scm-ui/ui-webapp/src/repos/codeSection/utils/filepathSearch.ts b/scm-ui/ui-webapp/src/repos/codeSection/utils/filepathSearch.ts index 22894d3c15..ed9bbff11d 100644 --- a/scm-ui/ui-webapp/src/repos/codeSection/utils/filepathSearch.ts +++ b/scm-ui/ui-webapp/src/repos/codeSection/utils/filepathSearch.ts @@ -33,10 +33,10 @@ declare global { export const filepathSearch = (paths: string[], query: string): string[] => { return paths .map(createMatcher(query)) - .filter(m => m.matches) + .filter((m) => m.matches) .sort((a, b) => b.score - a.score) .slice(0, 50) - .map(m => m.path); + .map((m) => m.path); }; const includes = (value: string, query: string) => { @@ -58,7 +58,7 @@ export const createMatcher = (query: string) => { return { matches: score > 0, score, - path + path, }; }; }; diff --git a/scm-ui/ui-webapp/src/repos/components/EditRepoNavLink.test.tsx b/scm-ui/ui-webapp/src/repos/components/EditRepoNavLink.test.tsx index 2e4bfabadb..4822cb58ad 100644 --- a/scm-ui/ui-webapp/src/repos/components/EditRepoNavLink.test.tsx +++ b/scm-ui/ui-webapp/src/repos/components/EditRepoNavLink.test.tsx @@ -31,7 +31,7 @@ import EditRepoNavLink from "./EditRepoNavLink"; describe("GeneralNavLink", () => { it("should render nothing, if the modify link is missing", () => { const repository = { - _links: {} + _links: {}, }; const navLink = shallow(); @@ -42,9 +42,9 @@ describe("GeneralNavLink", () => { const repository = { _links: { update: { - href: "/repositories" - } - } + href: "/repositories", + }, + }, }; const navLink = mount(); diff --git a/scm-ui/ui-webapp/src/repos/components/ImportFullRepository.tsx b/scm-ui/ui-webapp/src/repos/components/ImportFullRepository.tsx index ab8cd57036..5ff33c19ac 100644 --- a/scm-ui/ui-webapp/src/repos/components/ImportFullRepository.tsx +++ b/scm-ui/ui-webapp/src/repos/components/ImportFullRepository.tsx @@ -58,7 +58,7 @@ const ImportFullRepository: FC = ({ const [t] = useTranslation("repos"); const { importFullRepository, importedRepository, isLoading, error } = useImportFullRepository(repositoryType); - useEffect(() => setRepo({...repo, type: repositoryType.name}), [repositoryType]); + useEffect(() => setRepo({ ...repo, type: repositoryType.name }), [repositoryType]); useEffect(() => setImportPending(isLoading), [isLoading]); useEffect(() => { if (importedRepository) { diff --git a/scm-ui/ui-webapp/src/repos/components/ImportRepositoryFromBundle.tsx b/scm-ui/ui-webapp/src/repos/components/ImportRepositoryFromBundle.tsx index e420d68353..c8ecef2ec3 100644 --- a/scm-ui/ui-webapp/src/repos/components/ImportRepositoryFromBundle.tsx +++ b/scm-ui/ui-webapp/src/repos/components/ImportRepositoryFromBundle.tsx @@ -60,7 +60,7 @@ const ImportRepositoryFromBundle: FC = ({ const { importRepositoryFromBundle, importedRepository, error, isLoading } = useImportRepositoryFromBundle(repositoryType); - useEffect(() => setRepo({...repo, type: repositoryType.name}), [repositoryType]); + useEffect(() => setRepo({ ...repo, type: repositoryType.name }), [repositoryType]); useEffect(() => setImportPending(isLoading), [isLoading]); useEffect(() => { if (importedRepository) { diff --git a/scm-ui/ui-webapp/src/repos/components/ImportRepositoryFromUrl.tsx b/scm-ui/ui-webapp/src/repos/components/ImportRepositoryFromUrl.tsx index 8220c66a7c..fd215d7f17 100644 --- a/scm-ui/ui-webapp/src/repos/components/ImportRepositoryFromUrl.tsx +++ b/scm-ui/ui-webapp/src/repos/components/ImportRepositoryFromUrl.tsx @@ -60,7 +60,7 @@ const ImportRepositoryFromUrl: FC = ({ const [t] = useTranslation("repos"); const { importRepositoryFromUrl, importedRepository, error, isLoading } = useImportRepositoryFromUrl(repositoryType); - useEffect(() => setRepo({...repo, type: repositoryType.name}), [repositoryType]); + useEffect(() => setRepo({ ...repo, type: repositoryType.name }), [repositoryType]); useEffect(() => setImportPending(isLoading), [isLoading]); useEffect(() => { if (importedRepository) { diff --git a/scm-ui/ui-webapp/src/repos/components/ImportRepositoryTypeSelect.tsx b/scm-ui/ui-webapp/src/repos/components/ImportRepositoryTypeSelect.tsx index 22cdd3f1b3..c6b2918a4d 100644 --- a/scm-ui/ui-webapp/src/repos/components/ImportRepositoryTypeSelect.tsx +++ b/scm-ui/ui-webapp/src/repos/components/ImportRepositoryTypeSelect.tsx @@ -38,11 +38,11 @@ const ImportRepositoryTypeSelect: FC = ({ repositoryTypes, repositoryType const createSelectOptions = () => { const options = repositoryTypes - .filter(repoType => !!repoType._links.import) - .map(repositoryType => { + .filter((repoType) => !!repoType._links.import) + .map((repositoryType) => { return { label: repositoryType.displayName, - value: repositoryType.name + value: repositoryType.name, }; }); options.unshift({ label: "", value: "" }); @@ -50,7 +50,7 @@ const ImportRepositoryTypeSelect: FC = ({ repositoryTypes, repositoryType }; const onChangeType = (type: string) => { - const repositoryType = repositoryTypes.filter(t => t.name === type)[0]; + const repositoryType = repositoryTypes.filter((t) => t.name === type)[0]; setRepositoryType(repositoryType); }; diff --git a/scm-ui/ui-webapp/src/repos/components/NamespaceAndNameFields.tsx b/scm-ui/ui-webapp/src/repos/components/NamespaceAndNameFields.tsx index 51ec213280..e4f28722f9 100644 --- a/scm-ui/ui-webapp/src/repos/components/NamespaceAndNameFields.tsx +++ b/scm-ui/ui-webapp/src/repos/components/NamespaceAndNameFields.tsx @@ -96,7 +96,7 @@ const NamespaceAndNameFields: FC = ({ repository, onChange, setValid, dis errorMessage: t("validation.namespace-invalid"), validationError: namespaceValidationError, disabled: disabled, - informationMessage + informationMessage, }; if (namespaceStrategy === CUSTOM_NAMESPACE_STRATEGY) { diff --git a/scm-ui/ui-webapp/src/repos/components/PermissionsNavLink.test.tsx b/scm-ui/ui-webapp/src/repos/components/PermissionsNavLink.test.tsx index ead4059e61..8a62865433 100644 --- a/scm-ui/ui-webapp/src/repos/components/PermissionsNavLink.test.tsx +++ b/scm-ui/ui-webapp/src/repos/components/PermissionsNavLink.test.tsx @@ -30,7 +30,7 @@ import PermissionsNavLink from "./PermissionsNavLink"; describe("PermissionsNavLink", () => { it("should render nothing, if the modify link is missing", () => { const repository = { - _links: {} + _links: {}, }; const navLink = shallow(); @@ -41,9 +41,9 @@ describe("PermissionsNavLink", () => { const repository = { _links: { permissions: { - href: "/permissions" - } - } + href: "/permissions", + }, + }, }; const navLink = mount(); diff --git a/scm-ui/ui-webapp/src/repos/components/RepositoryDetails.tsx b/scm-ui/ui-webapp/src/repos/components/RepositoryDetails.tsx index 9aa1fa2ba1..5b07b2d04c 100644 --- a/scm-ui/ui-webapp/src/repos/components/RepositoryDetails.tsx +++ b/scm-ui/ui-webapp/src/repos/components/RepositoryDetails.tsx @@ -42,7 +42,7 @@ class RepositoryDetails extends React.Component { name="repos.repository-details.information" renderAll={true} props={{ - repository + repository, }} /> diff --git a/scm-ui/ui-webapp/src/repos/components/RepositoryNavLink.test.tsx b/scm-ui/ui-webapp/src/repos/components/RepositoryNavLink.test.tsx index 408dcaf022..3589775462 100644 --- a/scm-ui/ui-webapp/src/repos/components/RepositoryNavLink.test.tsx +++ b/scm-ui/ui-webapp/src/repos/components/RepositoryNavLink.test.tsx @@ -32,7 +32,7 @@ describe("RepositoryNavLink", () => { namespace: "Namespace", name: "Repo", type: "GIT", - _links: {} + _links: {}, }; const navLink = shallow( @@ -54,9 +54,9 @@ describe("RepositoryNavLink", () => { type: "GIT", _links: { sources: { - href: "/sources" - } - } + href: "/sources", + }, + }, }; const navLink = mount( diff --git a/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetShortLink.tsx b/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetShortLink.tsx index 6177dee5a9..68ab08f111 100644 --- a/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetShortLink.tsx +++ b/scm-ui/ui-webapp/src/repos/components/changesets/ChangesetShortLink.tsx @@ -28,7 +28,7 @@ import { Changeset } from "@scm-manager/ui-types"; import { Replacement, changesetShortLinkRegex } from "@scm-manager/ui-components"; const ChangesetShortLink: (changeset: Changeset, value: string) => Replacement[] = (changeset, value) => { - const regex = new RegExp(changesetShortLinkRegex, "g") + const regex = new RegExp(changesetShortLinkRegex, "g"); const replacements: Replacement[] = []; @@ -40,7 +40,7 @@ const ChangesetShortLink: (changeset: Changeset, value: string) => Replacement[] const link = `/repo/${namespace}/${name}/code/changeset/${revision}`; replacements.push({ textToReplace: m[0], - replacement: {m[0]} + replacement: {m[0]}, }); m = regex.exec(value); } diff --git a/scm-ui/ui-webapp/src/repos/components/changesets/ContributorTable.tsx b/scm-ui/ui-webapp/src/repos/components/changesets/ContributorTable.tsx index c39e7ce76c..5cdb0faa18 100644 --- a/scm-ui/ui-webapp/src/repos/components/changesets/ContributorTable.tsx +++ b/scm-ui/ui-webapp/src/repos/components/changesets/ContributorTable.tsx @@ -69,11 +69,11 @@ const ContributorTable: FC = ({ changeset }) => { if (!changeset.contributors) { return []; } - return new Set(changeset.contributors.map(contributor => contributor.type)); + return new Set(changeset.contributors.map((contributor) => contributor.type)); }; const getPersonsByContributorType = (type: string) => { - return changeset.contributors?.filter(contributor => contributor.type === type).map(t => t.person); + return changeset.contributors?.filter((contributor) => contributor.type === type).map((t) => t.person); }; const getContributorsByType = () => { @@ -94,12 +94,12 @@ const ContributorTable: FC = ({ changeset }) => { - {getContributorsByType().map(contributor => ( + {getContributorsByType().map((contributor) => ( {t("changeset.contributor.type." + contributor.type)}: - {permissionCollection?._embedded.permissions.map(permission => { + {permissionCollection?._embedded.permissions.map((permission) => { return ( { - return roles.map(role => { + return roles.map((role) => { return { label: role, - value: role + value: role, }; }); }; diff --git a/scm-ui/ui-webapp/src/repos/permissions/containers/AdvancedPermissionsDialog.tsx b/scm-ui/ui-webapp/src/repos/permissions/containers/AdvancedPermissionsDialog.tsx index 6e79bf5a79..34ac6c709d 100644 --- a/scm-ui/ui-webapp/src/repos/permissions/containers/AdvancedPermissionsDialog.tsx +++ b/scm-ui/ui-webapp/src/repos/permissions/containers/AdvancedPermissionsDialog.tsx @@ -38,7 +38,7 @@ type Props = { const createPreSelection = (availableVerbs: string[], selectedVerbs?: string[]): SelectedVerbs => { const verbs: SelectedVerbs = {}; - availableVerbs.forEach(verb => (verbs[verb] = selectedVerbs ? selectedVerbs.includes(verb) : false)); + availableVerbs.forEach((verb) => (verbs[verb] = selectedVerbs ? selectedVerbs.includes(verb) : false)); return verbs; }; @@ -53,7 +53,7 @@ const AdvancedPermissionsDialog: FC = ({ availableVerbs, selectedVerbs, r if (name) { setVerbs({ ...verbs, - [name]: value + [name]: value, }); } }; diff --git a/scm-ui/ui-webapp/src/repos/permissions/containers/CreatePermissionForm.tsx b/scm-ui/ui-webapp/src/repos/permissions/containers/CreatePermissionForm.tsx index 95d32d8b87..e955eb4d38 100644 --- a/scm-ui/ui-webapp/src/repos/permissions/containers/CreatePermissionForm.tsx +++ b/scm-ui/ui-webapp/src/repos/permissions/containers/CreatePermissionForm.tsx @@ -30,7 +30,7 @@ import { PermissionCreateEntry, Repository, RepositoryRole, - SelectValue + SelectValue, } from "@scm-manager/ui-types"; import { Button, @@ -41,7 +41,7 @@ import { Radio, SubmitButton, Subtitle, - UserAutocomplete + UserAutocomplete, } from "@scm-manager/ui-components"; import * as validator from "../utils/permissionValidation"; import RoleSelector from "../components/RoleSelector"; @@ -64,8 +64,8 @@ type PermissionState = PermissionCreateEntry & { const useAutoCompleteLinks = () => { const links = useIndexLinks()?.autocomplete as Link[]; return { - groups: links?.find(l => l.name === "groups"), - users: links?.find(l => l.name === "users") + groups: links?.find((l) => l.name === "groups"), + users: links?.find((l) => l.name === "users"), }; }; @@ -73,14 +73,14 @@ const CreatePermissionForm: FC = ({ availableRoles, availableVerbs, currentPermissions, - namespaceOrRepository + namespaceOrRepository, }) => { const initialPermissionState = { name: "", role: availableRoles[0].name, verbs: [], groupPermission: false, - valid: false + valid: false, }; const links = useAutoCompleteLinks(); const { isLoading, error, create, permission: createdPermission } = useCreatePermission(namespaceOrRepository); @@ -101,7 +101,7 @@ const CreatePermissionForm: FC = ({ value.value.id, permission.groupPermission, currentPermissions._embedded.permissions - ) + ), }); }; @@ -120,7 +120,7 @@ const CreatePermissionForm: FC = ({ const permissionScopeChanged = (groupPermission: boolean) => { setPermission({ ...permission, - groupPermission + groupPermission, }); }; @@ -132,7 +132,7 @@ const CreatePermissionForm: FC = ({ setPermission({ ...permission, verbs: [], - role + role, }); }; @@ -140,7 +140,7 @@ const CreatePermissionForm: FC = ({ setPermission({ ...permission, role: undefined, - verbs + verbs, }); setShowAdvancedDialog(false); }; @@ -151,7 +151,7 @@ const CreatePermissionForm: FC = ({ }; const findAvailableRole = (roleName: string) => { - return availableRoles.find(role => role.name === roleName); + return availableRoles.find((role) => role.name === roleName); }; return ( @@ -208,7 +208,7 @@ const CreatePermissionForm: FC = ({
    r.name)} + availableRoles={availableRoles.map((r) => r.name)} label={t("permission.role")} helpText={t("permission.help.roleHelpText")} handleRoleChange={handleRoleChange} diff --git a/scm-ui/ui-webapp/src/repos/permissions/containers/Permissions.tsx b/scm-ui/ui-webapp/src/repos/permissions/containers/Permissions.tsx index 3c8dc9c889..0dc27cf441 100644 --- a/scm-ui/ui-webapp/src/repos/permissions/containers/Permissions.tsx +++ b/scm-ui/ui-webapp/src/repos/permissions/containers/Permissions.tsx @@ -40,7 +40,7 @@ const usePermissionData = (namespaceOrRepository: Namespace | Repository) => { isLoading: permissions.isLoading || availablePermissions.isLoading, error: permissions.error || availablePermissions.error, permissions: permissions.data, - availablePermissions: availablePermissions.data + availablePermissions: availablePermissions.data, }; }; diff --git a/scm-ui/ui-webapp/src/repos/permissions/containers/SinglePermission.tsx b/scm-ui/ui-webapp/src/repos/permissions/containers/SinglePermission.tsx index a99a4b305e..7410506ad2 100644 --- a/scm-ui/ui-webapp/src/repos/permissions/containers/SinglePermission.tsx +++ b/scm-ui/ui-webapp/src/repos/permissions/containers/SinglePermission.tsx @@ -61,7 +61,7 @@ const SinglePermission: FC = ({ namespaceOrRepository, availableRoles, availableVerbs, - permission: defaultPermission + permission: defaultPermission, }) => { const [permission, setPermission] = useState(defaultPermission); const [showAdvancedDialog, setShowAdvancedDialog] = useState(false); @@ -71,7 +71,7 @@ const SinglePermission: FC = ({ setPermission(defaultPermission); }, [defaultPermission]); - const availableRoleNames = !!availableRoles && availableRoles.map(r => r.name); + const availableRoleNames = !!availableRoles && availableRoles.map((r) => r.name); const readOnly = !permission._links.update; const selectedVerbs = permission.role ? findVerbsForRole(availableRoles, permission.role) : permission.verbs; @@ -79,7 +79,7 @@ const SinglePermission: FC = ({ const newPermission = { ...permission, verbs: [], - role + role, }; setPermission(newPermission); update(newPermission); @@ -89,7 +89,7 @@ const SinglePermission: FC = ({ const newPermission = { ...permission, role: undefined, - verbs + verbs, }; setPermission(newPermission); update(newPermission); @@ -118,7 +118,7 @@ const SinglePermission: FC = ({
    + ); }; diff --git a/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx b/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx index 6c94fb72e7..6cf3909014 100644 --- a/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx +++ b/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx @@ -44,7 +44,7 @@ const TagView: FC = ({ repository, tag }) => { renderAll={true} props={{ repository, - tag + tag, }} /> diff --git a/scm-ui/ui-webapp/src/repos/tags/container/DeleteTag.tsx b/scm-ui/ui-webapp/src/repos/tags/container/DeleteTag.tsx index fb36b53f04..6e0e2a4b50 100644 --- a/scm-ui/ui-webapp/src/repos/tags/container/DeleteTag.tsx +++ b/scm-ui/ui-webapp/src/repos/tags/container/DeleteTag.tsx @@ -55,12 +55,12 @@ const DeleteTag: FC = ({ tag, repository }) => { className: "is-outlined", label: t("tag.delete.confirmAlert.submit"), isLoading, - onClick: () => remove(tag) + onClick: () => remove(tag), }, { label: t("tag.delete.confirmAlert.cancel"), - onClick: () => null - } + onClick: () => null, + }, ]} close={() => setShowConfirmAlert(false)} /> diff --git a/scm-ui/ui-webapp/src/repos/tags/orderTags.test.ts b/scm-ui/ui-webapp/src/repos/tags/orderTags.test.ts index 3b8667e21f..877f52c407 100644 --- a/scm-ui/ui-webapp/src/repos/tags/orderTags.test.ts +++ b/scm-ui/ui-webapp/src/repos/tags/orderTags.test.ts @@ -28,19 +28,19 @@ const tag1 = { name: "tag1", revision: "revision1", date: new Date(2020, 1, 1), - _links: {} + _links: {}, }; const tag2 = { name: "tag2", revision: "revision2", date: new Date(2020, 1, 3), - _links: {} + _links: {}, }; const tag3 = { name: "tag3", revision: "revision3", date: new Date(2020, 1, 2), - _links: {} + _links: {}, }; describe("order tags", () => { diff --git a/scm-ui/ui-webapp/src/tokenExpired.ts b/scm-ui/ui-webapp/src/tokenExpired.ts index 338cfb2e1a..a906073d40 100644 --- a/scm-ui/ui-webapp/src/tokenExpired.ts +++ b/scm-ui/ui-webapp/src/tokenExpired.ts @@ -29,7 +29,7 @@ let tokenExpired = false; // This error should be displayed with the state (e.g. navigation) of the previous logged in user. // But if the user navigates away, we want to reset the state to an anonymous one. -apiClient.onError(error => { +apiClient.onError((error) => { if (error instanceof TokenExpiredError) { tokenExpired = true; } diff --git a/scm-ui/ui-webapp/src/users/components/UserForm.tsx b/scm-ui/ui-webapp/src/users/components/UserForm.tsx index fcc91c188f..a0d2bd3997 100644 --- a/scm-ui/ui-webapp/src/users/components/UserForm.tsx +++ b/scm-ui/ui-webapp/src/users/components/UserForm.tsx @@ -23,7 +23,7 @@ */ import React from "react"; import { WithTranslation, withTranslation } from "react-i18next"; -import { Link, User } from "@scm-manager/ui-types"; +import { User } from "@scm-manager/ui-types"; import { Checkbox, ErrorNotification, @@ -32,7 +32,7 @@ import { PasswordConfirmation, SubmitButton, Subtitle, - validation as validator + validation as validator, } from "@scm-manager/ui-components"; import * as userValidator from "./userValidation"; @@ -63,12 +63,12 @@ class UserForm extends React.Component { password: "", active: true, external: false, - _links: {} + _links: {}, }, mailValidationError: false, displayNameValidationError: false, nameValidationError: false, - passwordValid: false + passwordValid: false, }; } @@ -77,8 +77,8 @@ class UserForm extends React.Component { if (user) { this.setState({ user: { - ...user - } + ...user, + }, }); } } @@ -209,7 +209,9 @@ class UserForm extends React.Component { )} {error && } - } /> + } + /> ); @@ -220,8 +222,8 @@ class UserForm extends React.Component { nameValidationError: !validator.isNameValid(name), user: { ...this.state.user, - name - } + name, + }, }); }; @@ -230,8 +232,8 @@ class UserForm extends React.Component { displayNameValidationError: !userValidator.isDisplayNameValid(displayName), user: { ...this.state.user, - displayName - } + displayName, + }, }); }; @@ -240,8 +242,8 @@ class UserForm extends React.Component { mailValidationError: !!mail && !validator.isMailValid(mail), user: { ...this.state.user, - mail - } + mail, + }, }); }; @@ -249,9 +251,9 @@ class UserForm extends React.Component { this.setState({ user: { ...this.state.user, - password + password, }, - passwordValid: !!password && passwordValid + passwordValid: !!password && passwordValid, }); }; @@ -259,8 +261,8 @@ class UserForm extends React.Component { this.setState({ user: { ...this.state.user, - active - } + active, + }, }); }; @@ -268,8 +270,8 @@ class UserForm extends React.Component { this.setState({ user: { ...this.state.user, - external - } + external, + }, }); }; } diff --git a/scm-ui/ui-webapp/src/users/components/apiKeys/ApiKeyEntry.tsx b/scm-ui/ui-webapp/src/users/components/apiKeys/ApiKeyEntry.tsx index 82d12e2109..c13bd53d73 100644 --- a/scm-ui/ui-webapp/src/users/components/apiKeys/ApiKeyEntry.tsx +++ b/scm-ui/ui-webapp/src/users/components/apiKeys/ApiKeyEntry.tsx @@ -37,13 +37,7 @@ export const ApiKeyEntry: FC = ({ apiKey, onDelete }) => { const [t] = useTranslation("users"); let deleteButton; if (apiKey?._links?.delete) { - deleteButton = ( - onDelete(apiKey)}> - - - - - ); + deleteButton = onDelete(apiKey)} />; } return ( @@ -54,7 +48,7 @@ export const ApiKeyEntry: FC = ({ apiKey, onDelete }) => { - + ); diff --git a/scm-ui/ui-webapp/src/users/components/navLinks/EditUserNavLink.test.tsx b/scm-ui/ui-webapp/src/users/components/navLinks/EditUserNavLink.test.tsx index b256bd3eb9..6206eca8fc 100644 --- a/scm-ui/ui-webapp/src/users/components/navLinks/EditUserNavLink.test.tsx +++ b/scm-ui/ui-webapp/src/users/components/navLinks/EditUserNavLink.test.tsx @@ -29,7 +29,7 @@ import EditUserNavLink from "./EditUserNavLink"; it("should render nothing, if the edit link is missing", () => { const user = { - _links: {} + _links: {}, }; const navLink = shallow(); @@ -40,9 +40,9 @@ it("should render the navLink", () => { const user = { _links: { update: { - href: "/users" - } - } + href: "/users", + }, + }, }; const navLink = shallow(); diff --git a/scm-ui/ui-webapp/src/users/components/navLinks/SetPasswordNavLink.test.tsx b/scm-ui/ui-webapp/src/users/components/navLinks/SetPasswordNavLink.test.tsx index 4ad3bb113d..2a17334064 100644 --- a/scm-ui/ui-webapp/src/users/components/navLinks/SetPasswordNavLink.test.tsx +++ b/scm-ui/ui-webapp/src/users/components/navLinks/SetPasswordNavLink.test.tsx @@ -29,7 +29,7 @@ import ChangePasswordNavLink from "./SetPasswordNavLink"; it("should render nothing, if the password link is missing", () => { const user = { - _links: {} + _links: {}, }; const navLink = shallow(); @@ -40,9 +40,9 @@ it("should render the navLink", () => { const user = { _links: { password: { - href: "/password" - } - } + href: "/password", + }, + }, }; const navLink = shallow(); diff --git a/scm-ui/ui-webapp/src/users/components/navLinks/SetPasswordNavLink.tsx b/scm-ui/ui-webapp/src/users/components/navLinks/SetPasswordNavLink.tsx index 194bf71c18..d1970d8c1e 100644 --- a/scm-ui/ui-webapp/src/users/components/navLinks/SetPasswordNavLink.tsx +++ b/scm-ui/ui-webapp/src/users/components/navLinks/SetPasswordNavLink.tsx @@ -38,7 +38,7 @@ class ChangePasswordNavLink extends React.Component { if (!this.hasPermissionToSetPassword()) { return null; } - return ; + return ; } hasPermissionToSetPassword = () => { diff --git a/scm-ui/ui-webapp/src/users/components/navLinks/SetPermissionsNavLink.test.tsx b/scm-ui/ui-webapp/src/users/components/navLinks/SetPermissionsNavLink.test.tsx index 9b57032226..f682b80397 100644 --- a/scm-ui/ui-webapp/src/users/components/navLinks/SetPermissionsNavLink.test.tsx +++ b/scm-ui/ui-webapp/src/users/components/navLinks/SetPermissionsNavLink.test.tsx @@ -29,7 +29,7 @@ import { shallow } from "enzyme"; it("should render nothing, if the permissions link is missing", () => { const user = { - _links: {} + _links: {}, }; const navLink = shallow(); @@ -40,9 +40,9 @@ it("should render the navLink", () => { const user = { _links: { permissions: { - href: "/permissions" - } - } + href: "/permissions", + }, + }, }; const navLink = shallow(); diff --git a/scm-ui/ui-webapp/src/users/components/navLinks/SetPermissionsNavLink.tsx b/scm-ui/ui-webapp/src/users/components/navLinks/SetPermissionsNavLink.tsx index d0e82f78dc..8bc0ffd0a4 100644 --- a/scm-ui/ui-webapp/src/users/components/navLinks/SetPermissionsNavLink.tsx +++ b/scm-ui/ui-webapp/src/users/components/navLinks/SetPermissionsNavLink.tsx @@ -38,7 +38,9 @@ class ChangePermissionNavLink extends React.Component { if (!this.hasPermissionToSetPermission()) { return null; } - return ; + return ( + + ); } hasPermissionToSetPermission = () => { diff --git a/scm-ui/ui-webapp/src/users/components/publicKeys/PublicKeyEntry.tsx b/scm-ui/ui-webapp/src/users/components/publicKeys/PublicKeyEntry.tsx index 0840ad75b1..da8aea5ea2 100644 --- a/scm-ui/ui-webapp/src/users/components/publicKeys/PublicKeyEntry.tsx +++ b/scm-ui/ui-webapp/src/users/components/publicKeys/PublicKeyEntry.tsx @@ -39,11 +39,7 @@ export const PublicKeyEntry: FC = ({ publicKey, onDelete }) => { let deleteButton; if (publicKey?._links?.delete) { deleteButton = ( - onDelete(publicKey)}> - - - - + onDelete(publicKey)} /> ); } @@ -63,7 +59,7 @@ export const PublicKeyEntry: FC = ({ publicKey, onDelete }) => { publicKey.id )} - + ); diff --git a/scm-ui/ui-webapp/src/users/components/table/Details.tsx b/scm-ui/ui-webapp/src/users/components/table/Details.tsx index 8b94e36ff2..81091f07ff 100644 --- a/scm-ui/ui-webapp/src/users/components/table/Details.tsx +++ b/scm-ui/ui-webapp/src/users/components/table/Details.tsx @@ -24,12 +24,7 @@ import React from "react"; import { WithTranslation, withTranslation } from "react-i18next"; import { User } from "@scm-manager/ui-types"; -import { - Checkbox, - DateFromNow, - MailLink, - createAttributesForTesting -} from "@scm-manager/ui-components"; +import { Checkbox, DateFromNow, MailLink, createAttributesForTesting } from "@scm-manager/ui-components"; type Props = WithTranslation & { user: User; diff --git a/scm-ui/ui-webapp/src/users/components/userValidation.test.ts b/scm-ui/ui-webapp/src/users/components/userValidation.test.ts index a0ba6dacc3..c4b3cfd505 100644 --- a/scm-ui/ui-webapp/src/users/components/userValidation.test.ts +++ b/scm-ui/ui-webapp/src/users/components/userValidation.test.ts @@ -36,7 +36,7 @@ describe("test displayName validation", () => { "Tricia.McMillan@hitchhiker.com", "Ford Prefect (ford.prefect@hitchhiker.com)", "Zaphod Beeblebrox ", - "Marvin, der depressive Roboter" + "Marvin, der depressive Roboter", ]; for (const name of validNames) { expect(validator.isDisplayNameValid(name)).toBe(true); diff --git a/scm-ui/ui-webapp/src/users/containers/DeleteUser.tsx b/scm-ui/ui-webapp/src/users/containers/DeleteUser.tsx index 20c22b82c0..ca6b6171c4 100644 --- a/scm-ui/ui-webapp/src/users/containers/DeleteUser.tsx +++ b/scm-ui/ui-webapp/src/users/containers/DeleteUser.tsx @@ -62,12 +62,12 @@ const DeleteUser: FC = ({ confirmDialog = true, user }) => { { className: "is-outlined", label: t("deleteUser.confirmAlert.submit"), - onClick: deleteUserCallback + onClick: deleteUserCallback, }, { label: t("deleteUser.confirmAlert.cancel"), - onClick: () => null - } + onClick: () => null, + }, ]} close={() => setShowConfirmAlert(false)} /> diff --git a/scm-ui/ui-webapp/src/users/containers/Users.tsx b/scm-ui/ui-webapp/src/users/containers/Users.tsx index b15a174945..03785f5c7e 100644 --- a/scm-ui/ui-webapp/src/users/containers/Users.tsx +++ b/scm-ui/ui-webapp/src/users/containers/Users.tsx @@ -31,7 +31,7 @@ import { OverviewPageActions, Page, PageActions, - urls + urls, } from "@scm-manager/ui-components"; import { UserTable } from "./../components/table"; import { useUsers } from "@scm-manager/ui-api"; @@ -60,7 +60,7 @@ const Users: FC = () => { const renderCreateButton = () => { if (canAddUsers) { - return ; + return ; } return null; };
    {item}{t("profile.groups")}
      - {me.groups.map(group => { + {me.groups.map((group) => { return
    • {group}
    • ; })}
    diff --git a/scm-ui/ui-webapp/src/groups/components/GroupForm.tsx b/scm-ui/ui-webapp/src/groups/components/GroupForm.tsx index c259d01a6e..ce9afbcd42 100644 --- a/scm-ui/ui-webapp/src/groups/components/GroupForm.tsx +++ b/scm-ui/ui-webapp/src/groups/components/GroupForm.tsx @@ -32,7 +32,7 @@ import { MemberNameTagGroup, SubmitButton, Subtitle, - Textarea + Textarea, } from "@scm-manager/ui-components"; import * as validator from "./groupValidation"; @@ -56,14 +56,14 @@ class GroupForm extends React.Component { name: "", description: "", _embedded: { - members: [] + members: [], }, _links: {}, members: [], type: "", - external: false + external: false, }, - nameValidationError: false + nameValidationError: false, }; } @@ -73,8 +73,8 @@ class GroupForm extends React.Component { this.setState({ ...this.state, group: { - ...group - } + ...group, + }, }); } } @@ -183,13 +183,13 @@ class GroupForm extends React.Component { ); } - memberListChanged = membernames => { + memberListChanged = (membernames) => { this.setState({ ...this.state, group: { ...this.state.group, - members: membernames - } + members: membernames, + }, }); }; @@ -202,8 +202,8 @@ class GroupForm extends React.Component { ...this.state, group: { ...this.state.group, - members: [...this.state.group.members, value.value.id] - } + members: [...this.state.group.members, value.value.id], + }, }); }; @@ -216,8 +216,8 @@ class GroupForm extends React.Component { nameValidationError: !validator.isNameValid(name), group: { ...this.state.group, - name - } + name, + }, }); }; @@ -225,8 +225,8 @@ class GroupForm extends React.Component { this.setState({ group: { ...this.state.group, - description - } + description, + }, }); }; @@ -234,8 +234,8 @@ class GroupForm extends React.Component { this.setState({ group: { ...this.state.group, - external - } + external, + }, }); }; } diff --git a/scm-ui/ui-webapp/src/groups/components/navLinks/EditGroupNavLink.test.tsx b/scm-ui/ui-webapp/src/groups/components/navLinks/EditGroupNavLink.test.tsx index f980b96286..1d770dc6d0 100644 --- a/scm-ui/ui-webapp/src/groups/components/navLinks/EditGroupNavLink.test.tsx +++ b/scm-ui/ui-webapp/src/groups/components/navLinks/EditGroupNavLink.test.tsx @@ -29,7 +29,7 @@ import EditGroupNavLink from "./EditGroupNavLink"; it("should render nothing, if the edit link is missing", () => { const group = { - _links: {} + _links: {}, }; const navLink = shallow(); @@ -40,9 +40,9 @@ it("should render the navLink", () => { const group = { _links: { update: { - href: "/groups" - } - } + href: "/groups", + }, + }, }; const navLink = shallow(); diff --git a/scm-ui/ui-webapp/src/groups/containers/DeleteGroup.tsx b/scm-ui/ui-webapp/src/groups/containers/DeleteGroup.tsx index 8c55be6710..bc9dbd0e85 100644 --- a/scm-ui/ui-webapp/src/groups/containers/DeleteGroup.tsx +++ b/scm-ui/ui-webapp/src/groups/containers/DeleteGroup.tsx @@ -62,12 +62,12 @@ export const DeleteGroup: FC = ({ confirmDialog = true, group }) => { { className: "is-outlined", label: t("deleteGroup.confirmAlert.submit"), - onClick: deleteGroupCallback + onClick: deleteGroupCallback, }, { label: t("deleteGroup.confirmAlert.cancel"), - onClick: () => null - } + onClick: () => null, + }, ]} close={() => setShowConfirmAlert(false)} /> diff --git a/scm-ui/ui-webapp/src/groups/containers/Groups.tsx b/scm-ui/ui-webapp/src/groups/containers/Groups.tsx index e42f0e028d..8d88c95812 100644 --- a/scm-ui/ui-webapp/src/groups/containers/Groups.tsx +++ b/scm-ui/ui-webapp/src/groups/containers/Groups.tsx @@ -31,7 +31,7 @@ import { OverviewPageActions, Page, PageActions, - urls + urls, } from "@scm-manager/ui-components"; import { GroupTable } from "./../components/table"; import { useGroups } from "@scm-manager/ui-api"; diff --git a/scm-ui/ui-webapp/src/i18n.ts b/scm-ui/ui-webapp/src/i18n.ts index a3b6c2eba6..1153e0f35b 100644 --- a/scm-ui/ui-webapp/src/i18n.ts +++ b/scm-ui/ui-webapp/src/i18n.ts @@ -48,19 +48,19 @@ i18n debug: false, interpolation: { - escapeValue: false // not needed for react!! + escapeValue: false, // not needed for react!! }, react: { wait: true, - useSuspense: false + useSuspense: false, }, backend: { loadPath: loadPath, init: { - credentials: "same-origin" - } + credentials: "same-origin", + }, }, // configure LanguageDetector @@ -69,8 +69,8 @@ i18n // we only use browser configuration order: ["navigator"], // we do not cache the detected language - caches: [] - } + caches: [], + }, }); export default i18n; diff --git a/scm-ui/ui-webapp/src/permissions/components/PermissionsWrapper.tsx b/scm-ui/ui-webapp/src/permissions/components/PermissionsWrapper.tsx index 100535beb0..9a21bf9126 100644 --- a/scm-ui/ui-webapp/src/permissions/components/PermissionsWrapper.tsx +++ b/scm-ui/ui-webapp/src/permissions/components/PermissionsWrapper.tsx @@ -55,7 +55,7 @@ export default class PermissionsWrapper extends React.Component { return (
    - {permissionArray.slice(0, permissionArray.length / 2 + 1).map(p => ( + {permissionArray.slice(0, permissionArray.length / 2 + 1).map((p) => ( { ))} - {permissionArray.slice(permissionArray.length / 2 + 1, permissionArray.length).map(p => ( + {permissionArray.slice(permissionArray.length / 2 + 1, permissionArray.length).map((p) => ( { this.state = { nameValidationError: false, - name: props.transmittedName + name: props.transmittedName, }; } @@ -66,7 +66,7 @@ class BranchForm extends React.Component { if (this.isValid()) { this.props.submitForm({ name: this.state.name!, - parent: this.state.source! + parent: this.state.source!, }); } }; @@ -75,9 +75,9 @@ class BranchForm extends React.Component { const { t, branches, loading, transmittedName, disabled } = this.props; const { name } = this.state; orderBranches(branches); - const options = branches.map(branch => ({ + const options = branches.map((branch) => ({ label: branch.name, - value: branch.name + value: branch.name, })); return ( @@ -124,14 +124,14 @@ class BranchForm extends React.Component { handleSourceChange = (source: string) => { this.setState({ - source + source, }); }; handleNameChange = (name: string) => { this.setState({ nameValidationError: !validator.isBranchValid(name), - name + name, }); }; } diff --git a/scm-ui/ui-webapp/src/repos/branches/components/BranchRow.tsx b/scm-ui/ui-webapp/src/repos/branches/components/BranchRow.tsx index ccba85a405..31d5547b6c 100644 --- a/scm-ui/ui-webapp/src/repos/branches/components/BranchRow.tsx +++ b/scm-ui/ui-webapp/src/repos/branches/components/BranchRow.tsx @@ -42,11 +42,9 @@ const BranchRow: FC = ({ baseUrl, branch, onDelete }) => { let deleteButton; if ((branch?._links?.delete as Link)?.href) { deleteButton = ( - onDelete(branch)}> - - - - + onDelete(branch)}> + + ); } @@ -63,7 +61,7 @@ const BranchRow: FC = ({ baseUrl, branch, onDelete }) => { )}
    {deleteButton}{deleteButton}
    - {contributor.persons!.map(person => ( + {contributor.persons!.map((person) => ( ))} diff --git a/scm-ui/ui-webapp/src/repos/components/changesets/CreateTagModal.tsx b/scm-ui/ui-webapp/src/repos/components/changesets/CreateTagModal.tsx index 66fdfdf8a3..c377979da0 100644 --- a/scm-ui/ui-webapp/src/repos/components/changesets/CreateTagModal.tsx +++ b/scm-ui/ui-webapp/src/repos/components/changesets/CreateTagModal.tsx @@ -37,10 +37,12 @@ type Props = { const CreateTagModal: FC = ({ repository, changeset, onClose }) => { const { isLoading, error, data: tags } = useTags(repository); - const { isLoading: isLoadingCreate, error: errorCreate, create, tag: createdTag } = useCreateTag( - repository, - changeset - ); + const { + isLoading: isLoadingCreate, + error: errorCreate, + create, + tag: createdTag, + } = useCreateTag(repository, changeset); const [t] = useTranslation("repos"); const [newTagName, setNewTagName] = useState(""); useEffect(() => { @@ -49,7 +51,7 @@ const CreateTagModal: FC = ({ repository, changeset, onClose }) => { } }, [createdTag, onClose]); - const tagNames = tags?._embedded.tags.map(tag => tag.name); + const tagNames = tags?._embedded.tags.map((tag) => tag.name); let validationError = ""; @@ -74,7 +76,7 @@ const CreateTagModal: FC = ({ repository, changeset, onClose }) => { setNewTagName(val)} + onChange={(val) => setNewTagName(val)} value={newTagName} validationError={!!validationError} errorMessage={t(validationError)} diff --git a/scm-ui/ui-webapp/src/repos/components/form/repositoryValidation.test.ts b/scm-ui/ui-webapp/src/repos/components/form/repositoryValidation.test.ts index b8e91c4c17..cd1653e9c5 100644 --- a/scm-ui/ui-webapp/src/repos/components/form/repositoryValidation.test.ts +++ b/scm-ui/ui-webapp/src/repos/components/form/repositoryValidation.test.ts @@ -39,7 +39,7 @@ describe("repository name validation", () => { it("should allow same names as the backend", () => { const validPaths = ["scm", "scm.gitz", "s", "sc", ".hiddenrepo", "b.", "...", "..c", "d..", "a..c"]; - validPaths.forEach(path => expect(validator.isNameValid(path)).toBe(true)); + validPaths.forEach((path) => expect(validator.isNameValid(path)).toBe(true)); }); it("should deny same names as the backend", () => { @@ -92,10 +92,10 @@ describe("repository name validation", () => { "scm/main", "scm/plugins/git-plugin", "scm/plugins/git-plugin", - "scm.git" + "scm.git", ]; - invalidPaths.forEach(path => expect(validator.isNameValid(path)).toBe(false)); + invalidPaths.forEach((path) => expect(validator.isNameValid(path)).toBe(false)); }); }); diff --git a/scm-ui/ui-webapp/src/repos/components/list/groupByNamespace.test.ts b/scm-ui/ui-webapp/src/repos/components/list/groupByNamespace.test.ts index 4a917d15e4..d9cd992bab 100644 --- a/scm-ui/ui-webapp/src/repos/components/list/groupByNamespace.test.ts +++ b/scm-ui/ui-webapp/src/repos/components/list/groupByNamespace.test.ts @@ -26,42 +26,42 @@ import groupByNamespace from "./groupByNamespace"; const base = { type: "git", - _links: {} + _links: {}, }; const slartiBlueprintsFjords = { ...base, namespace: "slarti", - name: "fjords-blueprints" + name: "fjords-blueprints", }; const slartiFjords = { ...base, namespace: "slarti", - name: "fjords" + name: "fjords", }; const hitchhikerRestand = { ...base, namespace: "hitchhiker", - name: "restand" + name: "restand", }; const hitchhikerPuzzle42 = { ...base, namespace: "hitchhiker", - name: "puzzle42" + name: "puzzle42", }; const hitchhikerHeartOfGold = { ...base, namespace: "hitchhiker", - name: "heartOfGold" + name: "heartOfGold", }; const zaphodMarvinFirmware = { ...base, namespace: "zaphod", - name: "marvin-firmware" + name: "marvin-firmware", }; it("should group the repositories by their namespace", () => { @@ -71,30 +71,30 @@ it("should group the repositories by their namespace", () => { hitchhikerRestand, slartiFjords, hitchhikerHeartOfGold, - hitchhikerPuzzle42 + hitchhikerPuzzle42, ]; const namespaces = { _embedded: { - namespaces: [{ namespace: "hitchhiker" }, { namespace: "slarti" }, { namespace: "zaphod" }] - } + namespaces: [{ namespace: "hitchhiker" }, { namespace: "slarti" }, { namespace: "zaphod" }], + }, }; const expected = [ { name: "hitchhiker", namespace: { namespace: "hitchhiker" }, - repositories: [hitchhikerHeartOfGold, hitchhikerPuzzle42, hitchhikerRestand] + repositories: [hitchhikerHeartOfGold, hitchhikerPuzzle42, hitchhikerRestand], }, { name: "slarti", namespace: { namespace: "slarti" }, - repositories: [slartiFjords, slartiBlueprintsFjords] + repositories: [slartiFjords, slartiBlueprintsFjords], }, { name: "zaphod", namespace: { namespace: "zaphod" }, - repositories: [zaphodMarvinFirmware] - } + repositories: [zaphodMarvinFirmware], + }, ]; expect(groupByNamespace(repositories, namespaces)).toEqual(expected); diff --git a/scm-ui/ui-webapp/src/repos/components/list/groupByNamespace.ts b/scm-ui/ui-webapp/src/repos/components/list/groupByNamespace.ts index f8b04a51c2..2a767e77c4 100644 --- a/scm-ui/ui-webapp/src/repos/components/list/groupByNamespace.ts +++ b/scm-ui/ui-webapp/src/repos/components/list/groupByNamespace.ts @@ -38,7 +38,7 @@ export default function groupByNamespace( group = { name: groupName, namespace: namespace, - repositories: [] + repositories: [], }; groups[groupName] = group; } @@ -65,5 +65,5 @@ function sortByName(a, b) { } function findNamespace(namespaces: NamespaceCollection, namespaceToFind: string) { - return namespaces._embedded.namespaces.find(namespace => namespace.namespace === namespaceToFind); + return namespaces._embedded.namespaces.find((namespace) => namespace.namespace === namespaceToFind); } diff --git a/scm-ui/ui-webapp/src/repos/containers/ArchiveRepo.tsx b/scm-ui/ui-webapp/src/repos/containers/ArchiveRepo.tsx index 5c1ea5c5b9..f9809cb349 100644 --- a/scm-ui/ui-webapp/src/repos/containers/ArchiveRepo.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/ArchiveRepo.tsx @@ -55,12 +55,12 @@ const ArchiveRepo: FC = ({ repository, confirmDialog = true }) => { { className: "is-outlined", label: t("archiveRepo.confirmAlert.submit"), - onClick: () => archiveRepoCallback() + onClick: () => archiveRepoCallback(), }, { label: t("archiveRepo.confirmAlert.cancel"), - onClick: () => null - } + onClick: () => null, + }, ]} close={() => setShowConfirmAlert(false)} /> diff --git a/scm-ui/ui-webapp/src/repos/containers/Changesets.tsx b/scm-ui/ui-webapp/src/repos/containers/Changesets.tsx index 8121489afa..135ca73fb0 100644 --- a/scm-ui/ui-webapp/src/repos/containers/Changesets.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/Changesets.tsx @@ -31,7 +31,7 @@ import { urls, LinkPaginator, Loading, - Notification + Notification, } from "@scm-manager/ui-components"; import { useChangesets } from "@scm-manager/ui-api"; diff --git a/scm-ui/ui-webapp/src/repos/containers/ChangesetsRoot.tsx b/scm-ui/ui-webapp/src/repos/containers/ChangesetsRoot.tsx index 8ebb000b43..a77d66eea4 100644 --- a/scm-ui/ui-webapp/src/repos/containers/ChangesetsRoot.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/ChangesetsRoot.tsx @@ -44,10 +44,10 @@ const ChangesetRoot: FC = ({ repository, baseUrl, branches, selectedBranc } const url = urls.stripEndingSlash(match.url); - const defaultBranch = branches?.find(b => b.defaultBranch === true); + const defaultBranch = branches?.find((b) => b.defaultBranch === true); const isBranchAvailable = () => { - return branches?.filter(b => b.name === selectedBranch).length === 0; + return branches?.filter((b) => b.name === selectedBranch).length === 0; }; const evaluateSwitchViewLink = () => { @@ -76,7 +76,7 @@ const ChangesetRoot: FC = ({ repository, baseUrl, branches, selectedBranc />
    - b.name === selectedBranch)[0]} /> + b.name === selectedBranch)[0]} />
    diff --git a/scm-ui/ui-webapp/src/repos/containers/CreateRepositoryRoot.tsx b/scm-ui/ui-webapp/src/repos/containers/CreateRepositoryRoot.tsx index 641409bd96..7be6cbb135 100644 --- a/scm-ui/ui-webapp/src/repos/containers/CreateRepositoryRoot.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/CreateRepositoryRoot.tsx @@ -49,7 +49,7 @@ const useCreateRepositoryData = () => { pageLoadingError: errorNS || errorRT || errorIdx || undefined, namespaceStrategies, repositoryTypes, - index + index, }; }; @@ -90,15 +90,15 @@ const CreateRepositoryRoot: FC = () => { path: "", icon: "plus", label: t("repositoryForm.createButton"), - component: CreateRepository + component: CreateRepository, }, { subtitle: t("import.subtitle"), path: "import", icon: "file-upload", label: t("repositoryForm.importButton"), - component: ImportRepository - } + component: ImportRepository, + }, ]; const extCreators = binder.getExtensions("repos.creator"); @@ -108,7 +108,7 @@ const CreateRepositoryRoot: FC = () => { return ( - {creators.map(creator => ( + {creators.map((creator) => ( diff --git a/scm-ui/ui-webapp/src/repos/containers/DeleteRepo.tsx b/scm-ui/ui-webapp/src/repos/containers/DeleteRepo.tsx index 1b4243e3e1..b392949aab 100644 --- a/scm-ui/ui-webapp/src/repos/containers/DeleteRepo.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/DeleteRepo.tsx @@ -38,7 +38,7 @@ const DeleteRepo: FC = ({ repository, confirmDialog = true }) => { const { isLoading, error, remove, isDeleted } = useDeleteRepository({ onSuccess: () => { history.push("/repos/"); - } + }, }); const [showConfirmAlert, setShowConfirmAlert] = useState(false); const [t] = useTranslation("repos"); @@ -67,12 +67,12 @@ const DeleteRepo: FC = ({ repository, confirmDialog = true }) => { { className: "is-outlined", label: t("deleteRepo.confirmAlert.submit"), - onClick: () => deleteRepoCallback() + onClick: () => deleteRepoCallback(), }, { label: t("deleteRepo.confirmAlert.cancel"), - onClick: () => null - } + onClick: () => null, + }, ]} close={() => setShowConfirmAlert(false)} /> diff --git a/scm-ui/ui-webapp/src/repos/containers/UnarchiveRepo.tsx b/scm-ui/ui-webapp/src/repos/containers/UnarchiveRepo.tsx index 1f1dffa8e3..bd693891f6 100644 --- a/scm-ui/ui-webapp/src/repos/containers/UnarchiveRepo.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/UnarchiveRepo.tsx @@ -56,12 +56,12 @@ const UnarchiveRepo: FC = ({ repository, confirmDialog = true }) => { className: "is-outlined", label: t("unarchiveRepo.confirmAlert.submit"), isLoading, - onClick: () => unarchiveRepoCallback() + onClick: () => unarchiveRepoCallback(), }, { label: t("unarchiveRepo.confirmAlert.cancel"), - onClick: () => null - } + onClick: () => null, + }, ]} close={() => setShowConfirmAlert(false)} /> diff --git a/scm-ui/ui-webapp/src/repos/importlog/ImportLog.tsx b/scm-ui/ui-webapp/src/repos/importlog/ImportLog.tsx index 083e430c8e..cc67da59ed 100644 --- a/scm-ui/ui-webapp/src/repos/importlog/ImportLog.tsx +++ b/scm-ui/ui-webapp/src/repos/importlog/ImportLog.tsx @@ -30,16 +30,18 @@ import { useTranslation } from "react-i18next"; type Params = { logId: string; -} +}; const ImportLog: FC = () => { - const {logId} = useParams(); - const {isLoading, data, error} = useImportLog(logId); + const { logId } = useParams(); + const { isLoading, data, error } = useImportLog(logId); const [t] = useTranslation("commons"); - return -
    {data ? data : null}
    -
    ; -} + return ( + +
    {data ? data : null}
    +
    + ); +}; export default ImportLog; diff --git a/scm-ui/ui-webapp/src/repos/namespaces/containers/NamespaceRoot.tsx b/scm-ui/ui-webapp/src/repos/namespaces/containers/NamespaceRoot.tsx index 9d70f961de..362ed1ca7c 100644 --- a/scm-ui/ui-webapp/src/repos/namespaces/containers/NamespaceRoot.tsx +++ b/scm-ui/ui-webapp/src/repos/namespaces/containers/NamespaceRoot.tsx @@ -34,7 +34,7 @@ import { SecondaryNavigation, SecondaryNavigationColumn, StateMenuContextProvider, - SubNavigation + SubNavigation, } from "@scm-manager/ui-components"; import Permissions from "../../permissions/containers/Permissions"; import { ExtensionPoint } from "@scm-manager/ui-extensions"; @@ -64,7 +64,7 @@ const NamespaceRoot: FC = () => { const extensionProps = { namespace, - url + url, }; return ( diff --git a/scm-ui/ui-webapp/src/repos/permissions/components/DeletePermissionButton.tsx b/scm-ui/ui-webapp/src/repos/permissions/components/DeletePermissionButton.tsx index 610e8121ce..2667f9b317 100644 --- a/scm-ui/ui-webapp/src/repos/permissions/components/DeletePermissionButton.tsx +++ b/scm-ui/ui-webapp/src/repos/permissions/components/DeletePermissionButton.tsx @@ -78,11 +78,7 @@ const DeletePermissionButton: FC = ({ namespaceOrRepository, permission, return ( <> - - - - - + ); }; diff --git a/scm-ui/ui-webapp/src/repos/permissions/components/PermissionsTable.tsx b/scm-ui/ui-webapp/src/repos/permissions/components/PermissionsTable.tsx index e0c4828dff..73e9fe963e 100644 --- a/scm-ui/ui-webapp/src/repos/permissions/components/PermissionsTable.tsx +++ b/scm-ui/ui-webapp/src/repos/permissions/components/PermissionsTable.tsx @@ -39,7 +39,7 @@ const PermissionsTable: FC = ({ availableRoles, availableVerbs, namespaceOrRepository, - permissions: permissionCollection + permissions: permissionCollection, }) => { const [t] = useTranslation("repos"); @@ -77,7 +77,7 @@ const PermissionsTable: FC = ({
    {deleteButton}{deleteButton}
    {deleteButton}{deleteButton}
    {deleteButton}{deleteButton}