Improve a11y (#1841)

Improve accessibility by removing unnecessary tags without hrefs. Also remove many eslint errors and warnings.
This commit is contained in:
Eduard Heimbuch
2021-11-04 09:16:08 +01:00
committed by GitHub
parent 0efdd2a483
commit 6f61fefec5
213 changed files with 1924 additions and 2068 deletions

View File

@@ -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<File, Error, File>(
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,
},
};
};