diff --git a/.changeset/shaggy-birds-happen.md b/.changeset/shaggy-birds-happen.md new file mode 100644 index 0000000000..049a3cb3aa --- /dev/null +++ b/.changeset/shaggy-birds-happen.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-github-issues': minor +--- + +BREAKING: Changed the casing of all exported types to have a lowercase "h" in "github". E.g. "GitHubIssuesPage" was renamed to "GithubIssuesPage". Please rename your imports where necessary. diff --git a/plugins/github-issues/api-report.md b/plugins/github-issues/api-report.md index 41b4f87064..4e57eeda46 100644 --- a/plugins/github-issues/api-report.md +++ b/plugins/github-issues/api-report.md @@ -9,7 +9,15 @@ import { BackstagePlugin } from '@backstage/core-plugin-api'; import { RouteRef } from '@backstage/core-plugin-api'; // @public (undocumented) -export const GitHubIssuesCard: (props: GitHubIssuesProps) => JSX.Element; +export interface GithubIssuesByRepoOptions { + // (undocumented) + filterBy?: GithubIssuesFilters; + // (undocumented) + orderBy?: GithubIssuesOrdering; +} + +// @public (undocumented) +export const GithubIssuesCard: (props: GithubIssuesProps) => JSX.Element; // @public (undocumented) export interface GithubIssuesFilters { @@ -36,10 +44,10 @@ export interface GithubIssuesOrdering { } // @public (undocumented) -export const GitHubIssuesPage: (props: GitHubIssuesProps) => JSX.Element; +export const GithubIssuesPage: (props: GithubIssuesProps) => JSX.Element; // @public (undocumented) -export const gitHubIssuesPlugin: BackstagePlugin< +export const githubIssuesPlugin: BackstagePlugin< { root: RouteRef; }, @@ -48,20 +56,12 @@ export const gitHubIssuesPlugin: BackstagePlugin< >; // @public (undocumented) -export type GitHubIssuesProps = { +export type GithubIssuesProps = { itemsPerPage?: number; itemsPerRepo?: number; filterBy?: GithubIssuesFilters; orderBy?: GithubIssuesOrdering; }; -// @public (undocumented) -export interface GitubIssuesByRepoOptions { - // (undocumented) - filterBy?: GithubIssuesFilters; - // (undocumented) - orderBy?: GithubIssuesOrdering; -} - // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/github-issues/dev/index.tsx b/plugins/github-issues/dev/index.tsx index a5f20ab9b9..05592cfa63 100644 --- a/plugins/github-issues/dev/index.tsx +++ b/plugins/github-issues/dev/index.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { createDevApp } from '@backstage/dev-utils'; import { @@ -20,21 +21,20 @@ import { catalogApiRef, EntityProvider, } from '@backstage/plugin-catalog-react'; - -import { gitHubIssuesPlugin, GitHubIssuesPage } from '../src'; -import { GitHubIssuesApi, gitHubIssuesApiRef } from '../src/api'; +import { githubIssuesPlugin, GithubIssuesPage } from '../src'; +import { GithubIssuesApi, githubIssuesApiRef } from '../src/api'; import testData from './__fixtures__/component-issues-data.json'; createDevApp() - .registerPlugin(gitHubIssuesPlugin) + .registerPlugin(githubIssuesPlugin) .registerApi({ - api: gitHubIssuesApiRef, + api: githubIssuesApiRef, deps: {}, factory: () => ({ - fetchIssuesByRepoFromGitHub: async () => testData, - } as GitHubIssuesApi), + fetchIssuesByRepoFromGithub: async () => testData, + } as GithubIssuesApi), }) .registerApi({ api: catalogApiRef, @@ -59,7 +59,7 @@ createDevApp() kind: 'Component', }} > - + ), }) diff --git a/plugins/github-issues/src/api/gitHubIssuesApi.test.ts b/plugins/github-issues/src/api/githubIssuesApi.test.ts similarity index 93% rename from plugins/github-issues/src/api/gitHubIssuesApi.test.ts rename to plugins/github-issues/src/api/githubIssuesApi.test.ts index b2be54a2d1..e960d3123b 100644 --- a/plugins/github-issues/src/api/gitHubIssuesApi.test.ts +++ b/plugins/github-issues/src/api/githubIssuesApi.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + const mockGraphQLQuery = jest.fn(() => ({})); jest.mock('octokit', () => ({ Octokit: jest.fn(() => ({ graphql: mockGraphQLQuery })), @@ -20,8 +21,8 @@ jest.mock('octokit', () => ({ import { ConfigApi, ErrorApi } from '@backstage/core-plugin-api'; import { ForwardedError } from '@backstage/errors'; -import { createFilterByClause, gitHubIssuesApi } from './gitHubIssuesApi'; -import type { GithubIssuesFilters } from './gitHubIssuesApi'; +import { createFilterByClause, githubIssuesApi } from './githubIssuesApi'; +import type { GithubIssuesFilters } from './githubIssuesApi'; function getFragment( filterBy = '', @@ -84,21 +85,21 @@ function getFragment( ' ...issues\n' + ' }\n' + ' \n' + - ' } \n' + + ' }\n' + ' ' ); } -describe('gitHubIssuesApi', () => { - describe('fetchIssuesByRepoFromGitHub', () => { - let api: ReturnType; +describe('githubIssuesApi', () => { + describe('fetchIssuesByRepoFromGithub', () => { + let api: ReturnType; afterEach(() => { jest.clearAllMocks(); }); beforeEach(() => { - api = gitHubIssuesApi( + api = githubIssuesApi( { getAccessToken: jest.fn() }, { getOptionalConfigArray: jest.fn(), @@ -108,7 +109,7 @@ describe('gitHubIssuesApi', () => { }); it('should call GitHub API with correct query with fragment for each repo', async () => { - await api.fetchIssuesByRepoFromGitHub( + await api.fetchIssuesByRepoFromGithub( ['mrwolny/yo-yo', 'mrwolny/yoyo', 'mrwolny/yo.yo'], 10, ); @@ -118,7 +119,7 @@ describe('gitHubIssuesApi', () => { }); it('should call Github API with the correct filterBy and orderBy clauses', async () => { - await api.fetchIssuesByRepoFromGitHub( + await api.fetchIssuesByRepoFromGithub( ['mrwolny/yo-yo', 'mrwolny/yoyo', 'mrwolny/yo.yo'], 10, { @@ -221,7 +222,7 @@ describe('gitHubIssuesApi', () => { }), ); - const api = gitHubIssuesApi( + const api = githubIssuesApi( { getAccessToken: jest.fn() }, { getOptionalConfigArray: jest.fn(), @@ -229,7 +230,7 @@ describe('gitHubIssuesApi', () => { { post: jest.fn() } as unknown as ErrorApi, ); - const data = await api.fetchIssuesByRepoFromGitHub( + const data = await api.fetchIssuesByRepoFromGithub( ['mrwolny/yo-yo', 'mrwolny/notfound'], 10, ); @@ -291,7 +292,7 @@ describe('gitHubIssuesApi', () => { }), ); - const api = gitHubIssuesApi( + const api = githubIssuesApi( { getAccessToken: jest.fn() }, { getOptionalConfigArray: jest.fn(), @@ -299,7 +300,7 @@ describe('gitHubIssuesApi', () => { { post: jest.fn() } as unknown as ErrorApi, ); - const data = await api.fetchIssuesByRepoFromGitHub( + const data = await api.fetchIssuesByRepoFromGithub( ['mrwolny/notfound'], 10, ); @@ -332,7 +333,7 @@ describe('gitHubIssuesApi', () => { const mockErrorApi = { post: jest.fn() }; - const api = gitHubIssuesApi( + const api = githubIssuesApi( { getAccessToken: jest.fn() }, { getOptionalConfigArray: jest.fn(), @@ -340,7 +341,7 @@ describe('gitHubIssuesApi', () => { mockErrorApi as unknown as ErrorApi, ); - await api.fetchIssuesByRepoFromGitHub(['mrwolny/notfound'], 10); + await api.fetchIssuesByRepoFromGithub(['mrwolny/notfound'], 10); expect(mockErrorApi.post).toHaveBeenCalledTimes(1); expect(mockErrorApi.post).toHaveBeenCalledWith( diff --git a/plugins/github-issues/src/api/gitHubIssuesApi.ts b/plugins/github-issues/src/api/githubIssuesApi.ts similarity index 93% rename from plugins/github-issues/src/api/gitHubIssuesApi.ts rename to plugins/github-issues/src/api/githubIssuesApi.ts index bef1b20441..32331ef6b1 100644 --- a/plugins/github-issues/src/api/gitHubIssuesApi.ts +++ b/plugins/github-issues/src/api/githubIssuesApi.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { Octokit } from 'octokit'; import { createApiRef, @@ -71,7 +72,7 @@ export type RepoIssues = { export type IssuesByRepo = Record; /** @internal */ -export type GitHubIssuesApi = ReturnType; +export type GithubIssuesApi = ReturnType; /** * @public @@ -96,18 +97,18 @@ export interface GithubIssuesOrdering { /** * @public */ -export interface GitubIssuesByRepoOptions { +export interface GithubIssuesByRepoOptions { filterBy?: GithubIssuesFilters; orderBy?: GithubIssuesOrdering; } /** @internal */ -export const gitHubIssuesApiRef = createApiRef({ +export const githubIssuesApiRef = createApiRef({ id: 'plugin.githubissues.service', }); /** @internal */ -export const gitHubIssuesApi = ( +export const githubIssuesApi = ( githubAuthApi: OAuthApi, configApi: ConfigApi, errorApi: ErrorApi, @@ -128,7 +129,7 @@ export const gitHubIssuesApi = ( return octokit.graphql; }; - const fetchIssuesByRepoFromGitHub = async ( + const fetchIssuesByRepoFromGithub = async ( repos: Array, itemsPerRepo: number, { @@ -137,7 +138,7 @@ export const gitHubIssuesApi = ( field: 'UPDATED_AT', direction: 'DESC', }, - }: GitubIssuesByRepoOptions = {}, + }: GithubIssuesByRepoOptions = {}, ): Promise => { const graphql = await getOctokit(); const safeNames: Array = []; @@ -186,7 +187,7 @@ export const gitHubIssuesApi = ( }, {} as IssuesByRepo); }; - return { fetchIssuesByRepoFromGitHub }; + return { fetchIssuesByRepoFromGithub }; }; function formatFilterValue( @@ -224,7 +225,7 @@ function createIssueByRepoQuery( owner: string; }>, itemsPerRepo: number, - { filterBy, orderBy }: GitubIssuesByRepoOptions, + { filterBy, orderBy }: GithubIssuesByRepoOptions, ): string { const fragment = ` fragment issues on Repository { @@ -278,7 +279,7 @@ function createIssueByRepoQuery( } `, )} - } + } `; return query; diff --git a/plugins/github-issues/src/api/index.ts b/plugins/github-issues/src/api/index.ts index 4cc3372c45..91f058f399 100644 --- a/plugins/github-issues/src/api/index.ts +++ b/plugins/github-issues/src/api/index.ts @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export * from './gitHubIssuesApi'; + +export * from './githubIssuesApi'; diff --git a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.test.tsx b/plugins/github-issues/src/components/GithubIssues/GithubIssues.test.tsx similarity index 90% rename from plugins/github-issues/src/components/GitHubIssues/GitHubIssues.test.tsx rename to plugins/github-issues/src/components/GithubIssues/GithubIssues.test.tsx index 33eec79359..3f9e829de9 100644 --- a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.test.tsx +++ b/plugins/github-issues/src/components/GithubIssues/GithubIssues.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { renderInTestApp, TestApiProvider } from '@backstage/test-utils'; import { @@ -21,10 +22,8 @@ import { CatalogApi, } from '@backstage/plugin-catalog-react'; import { Entity } from '@backstage/catalog-model'; - -import { GitHubIssuesApi, gitHubIssuesApiRef, Issue } from '../../api'; - -import { GitHubIssues } from './GitHubIssues'; +import { GithubIssuesApi, githubIssuesApiRef, Issue } from '../../api'; +import { GithubIssues } from './GithubIssues'; const getTestIssue = (overwrites: Partial = {}): { node: Issue } => ({ node: { @@ -80,10 +79,10 @@ const mockCatalogApi = { getEntities: () => ({}), } as CatalogApi; -describe('GitHubIssues', () => { +describe('GithubIssues', () => { it('should render correctly when there are no issues in GitHub', async () => { const mockApi = { - fetchIssuesByRepoFromGitHub: async () => ({ + fetchIssuesByRepoFromGithub: async () => ({ backstage: { issues: { totalCount: 0, @@ -91,17 +90,17 @@ describe('GitHubIssues', () => { }, }, }), - } as GitHubIssuesApi; + } as GithubIssuesApi; const apis = [ - [gitHubIssuesApiRef, mockApi], + [githubIssuesApiRef, mockApi], [catalogApiRef, mockCatalogApi], ] as const; const { getByTestId } = await renderInTestApp( - + , ); @@ -118,7 +117,7 @@ describe('GitHubIssues', () => { }); const mockApi = { - fetchIssuesByRepoFromGitHub: async () => ({ + fetchIssuesByRepoFromGithub: async () => ({ backstage: { issues: { totalCount: 1, @@ -126,16 +125,16 @@ describe('GitHubIssues', () => { }, }, }), - } as GitHubIssuesApi; + } as GithubIssuesApi; const apis = [ - [gitHubIssuesApiRef, mockApi], + [githubIssuesApiRef, mockApi], [catalogApiRef, mockCatalogApi], ] as const; const { getByText, getByTestId } = await renderInTestApp( - + , ); diff --git a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx b/plugins/github-issues/src/components/GithubIssues/GithubIssues.tsx similarity index 79% rename from plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx rename to plugins/github-issues/src/components/GithubIssues/GithubIssues.tsx index cb6639c83c..faae7fd3a5 100644 --- a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx +++ b/plugins/github-issues/src/components/GithubIssues/GithubIssues.tsx @@ -13,41 +13,39 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React from 'react'; +import React from 'react'; import { Box, IconButton, Typography } from '@material-ui/core'; import { InfoCard, Progress } from '@backstage/core-components'; import RefreshIcon from '@material-ui/icons/Refresh'; - -import { useEntityGitHubRepositories } from '../../hooks/useEntityGitHubRepositories'; -import { useGetIssuesByRepoFromGitHub } from '../../hooks/useGetIssuesByRepoFromGitHub'; - +import { useEntityGithubRepositories } from '../../hooks/useEntityGithubRepositories'; +import { useGetIssuesByRepoFromGithub } from '../../hooks/useGetIssuesByRepoFromGithub'; import { IssuesList } from './IssuesList'; import { NoRepositoriesInfo } from './NoRepositoriesInfo'; import type { GithubIssuesFilters, GithubIssuesOrdering, -} from '../../api/gitHubIssuesApi'; +} from '../../api/githubIssuesApi'; /** * @public */ -export type GitHubIssuesProps = { +export type GithubIssuesProps = { itemsPerPage?: number; itemsPerRepo?: number; filterBy?: GithubIssuesFilters; orderBy?: GithubIssuesOrdering; }; -export const GitHubIssues = (props: GitHubIssuesProps) => { +export const GithubIssues = (props: GithubIssuesProps) => { const { itemsPerPage = 10, itemsPerRepo = 40, filterBy, orderBy } = props; - const { repositories } = useEntityGitHubRepositories(); + const { repositories } = useEntityGithubRepositories(); const { isLoading, - gitHubIssuesByRepo: issuesByRepository, + githubIssuesByRepo: issuesByRepository, retry, - } = useGetIssuesByRepoFromGitHub(repositories, itemsPerRepo, { + } = useGetIssuesByRepoFromGithub(repositories, itemsPerRepo, { filterBy, orderBy, }); diff --git a/plugins/github-issues/src/components/GitHubIssues/IssueCard/Assignees.tsx b/plugins/github-issues/src/components/GithubIssues/IssueCard/Assignees.tsx similarity index 99% rename from plugins/github-issues/src/components/GitHubIssues/IssueCard/Assignees.tsx rename to plugins/github-issues/src/components/GithubIssues/IssueCard/Assignees.tsx index 173c8d9439..4b66048039 100644 --- a/plugins/github-issues/src/components/GitHubIssues/IssueCard/Assignees.tsx +++ b/plugins/github-issues/src/components/GithubIssues/IssueCard/Assignees.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { Typography, Box, Avatar, makeStyles } from '@material-ui/core'; diff --git a/plugins/github-issues/src/components/GitHubIssues/IssueCard/CommentsCount.tsx b/plugins/github-issues/src/components/GithubIssues/IssueCard/CommentsCount.tsx similarity index 99% rename from plugins/github-issues/src/components/GitHubIssues/IssueCard/CommentsCount.tsx rename to plugins/github-issues/src/components/GithubIssues/IssueCard/CommentsCount.tsx index 80a365cbbb..35352d10d2 100644 --- a/plugins/github-issues/src/components/GitHubIssues/IssueCard/CommentsCount.tsx +++ b/plugins/github-issues/src/components/GithubIssues/IssueCard/CommentsCount.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { ChatIcon } from '@backstage/core-components'; import { Box, Badge } from '@material-ui/core'; diff --git a/plugins/github-issues/src/components/GitHubIssues/IssueCard/IssueCard.tsx b/plugins/github-issues/src/components/GithubIssues/IssueCard/IssueCard.tsx similarity index 99% rename from plugins/github-issues/src/components/GitHubIssues/IssueCard/IssueCard.tsx rename to plugins/github-issues/src/components/GithubIssues/IssueCard/IssueCard.tsx index ccf30a9a84..1094bc561f 100644 --- a/plugins/github-issues/src/components/GitHubIssues/IssueCard/IssueCard.tsx +++ b/plugins/github-issues/src/components/GithubIssues/IssueCard/IssueCard.tsx @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { DateTime } from 'luxon'; - import { Box, Paper, @@ -25,7 +25,6 @@ import { } from '@material-ui/core'; import { Assignees } from './Assignees'; import { CommentsCount } from './CommentsCount'; - import Divider from '@material-ui/core/Divider'; type IssueCardProps = { diff --git a/plugins/github-issues/src/components/GitHubIssues/IssueCard/index.ts b/plugins/github-issues/src/components/GithubIssues/IssueCard/index.ts similarity index 99% rename from plugins/github-issues/src/components/GitHubIssues/IssueCard/index.ts rename to plugins/github-issues/src/components/GithubIssues/IssueCard/index.ts index 5c60abf6ab..635bcd89f4 100644 --- a/plugins/github-issues/src/components/GitHubIssues/IssueCard/index.ts +++ b/plugins/github-issues/src/components/GithubIssues/IssueCard/index.ts @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export { IssueCard } from './IssueCard'; diff --git a/plugins/github-issues/src/components/GitHubIssues/IssuesList/Filters/Filters.tsx b/plugins/github-issues/src/components/GithubIssues/IssuesList/Filters/Filters.tsx similarity index 98% rename from plugins/github-issues/src/components/GitHubIssues/IssuesList/Filters/Filters.tsx rename to plugins/github-issues/src/components/GithubIssues/IssuesList/Filters/Filters.tsx index de071ab5bb..f9e22980db 100644 --- a/plugins/github-issues/src/components/GitHubIssues/IssuesList/Filters/Filters.tsx +++ b/plugins/github-issues/src/components/GithubIssues/IssuesList/Filters/Filters.tsx @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { Select, SelectedItems, SelectItem } from '@backstage/core-components'; import { makeStyles, Box, Typography } from '@material-ui/core'; type RepositoryFiltersProps = { items: Array; - totalIssuesInGitHub: number; + totalIssuesInGithub: number; placeholder: string; onChange: (active: Array) => void; }; diff --git a/plugins/github-issues/src/components/GitHubIssues/IssuesList/Filters/index.ts b/plugins/github-issues/src/components/GithubIssues/IssuesList/Filters/index.ts similarity index 99% rename from plugins/github-issues/src/components/GitHubIssues/IssuesList/Filters/index.ts rename to plugins/github-issues/src/components/GithubIssues/IssuesList/Filters/index.ts index 331d017455..a9e4f87642 100644 --- a/plugins/github-issues/src/components/GitHubIssues/IssuesList/Filters/index.ts +++ b/plugins/github-issues/src/components/GithubIssues/IssuesList/Filters/index.ts @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export * from './Filters'; diff --git a/plugins/github-issues/src/components/GitHubIssues/IssuesList/IssuesList.tsx b/plugins/github-issues/src/components/GithubIssues/IssuesList/IssuesList.tsx similarity index 97% rename from plugins/github-issues/src/components/GitHubIssues/IssuesList/IssuesList.tsx rename to plugins/github-issues/src/components/GithubIssues/IssuesList/IssuesList.tsx index b46eab22b6..27f6375308 100644 --- a/plugins/github-issues/src/components/GitHubIssues/IssuesList/IssuesList.tsx +++ b/plugins/github-issues/src/components/GithubIssues/IssuesList/IssuesList.tsx @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React from 'react'; +import React from 'react'; import { Box } from '@material-ui/core'; import { Pagination } from '@material-ui/lab'; - import { IssueCard } from '../IssueCard'; import { IssuesByRepo } from '../../../api'; import { RepositoryFilters } from './Filters'; @@ -60,7 +59,7 @@ export const IssuesList = ({ [issuesByRepository], ); - const totalIssuesInGitHub = React.useMemo( + const totalIssuesInGithub = React.useMemo( () => issuesByRepository ? Object.values(issuesByRepository).reduce( @@ -113,12 +112,12 @@ export const IssuesList = ({ {issues.length > 0 && ( )} diff --git a/plugins/github-issues/src/components/GitHubIssues/IssuesList/index.tsx b/plugins/github-issues/src/components/GithubIssues/IssuesList/index.tsx similarity index 99% rename from plugins/github-issues/src/components/GitHubIssues/IssuesList/index.tsx rename to plugins/github-issues/src/components/GithubIssues/IssuesList/index.tsx index 0b7514c720..ca6da2e0bd 100644 --- a/plugins/github-issues/src/components/GitHubIssues/IssuesList/index.tsx +++ b/plugins/github-issues/src/components/GithubIssues/IssuesList/index.tsx @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export * from './IssuesList'; diff --git a/plugins/github-issues/src/components/GitHubIssues/NoRepositoriesInfo/NoRepositoriesInfo.tsx b/plugins/github-issues/src/components/GithubIssues/NoRepositoriesInfo/NoRepositoriesInfo.tsx similarity index 100% rename from plugins/github-issues/src/components/GitHubIssues/NoRepositoriesInfo/NoRepositoriesInfo.tsx rename to plugins/github-issues/src/components/GithubIssues/NoRepositoriesInfo/NoRepositoriesInfo.tsx index dca4b872ae..07fb4019dc 100644 --- a/plugins/github-issues/src/components/GitHubIssues/NoRepositoriesInfo/NoRepositoriesInfo.tsx +++ b/plugins/github-issues/src/components/GithubIssues/NoRepositoriesInfo/NoRepositoriesInfo.tsx @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React from 'react'; +import React from 'react'; import { EmptyState } from '@backstage/core-components'; export const NoRepositoriesInfo = () => { diff --git a/plugins/github-issues/src/components/GitHubIssues/NoRepositoriesInfo/index.tsx b/plugins/github-issues/src/components/GithubIssues/NoRepositoriesInfo/index.tsx similarity index 99% rename from plugins/github-issues/src/components/GitHubIssues/NoRepositoriesInfo/index.tsx rename to plugins/github-issues/src/components/GithubIssues/NoRepositoriesInfo/index.tsx index 577bb475e3..ea4cef40a6 100644 --- a/plugins/github-issues/src/components/GitHubIssues/NoRepositoriesInfo/index.tsx +++ b/plugins/github-issues/src/components/GithubIssues/NoRepositoriesInfo/index.tsx @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export * from './NoRepositoriesInfo'; diff --git a/plugins/github-issues/src/components/GitHubIssues/index.ts b/plugins/github-issues/src/components/GithubIssues/index.ts similarity index 94% rename from plugins/github-issues/src/components/GitHubIssues/index.ts rename to plugins/github-issues/src/components/GithubIssues/index.ts index 6fa55e3358..865168b3e2 100644 --- a/plugins/github-issues/src/components/GitHubIssues/index.ts +++ b/plugins/github-issues/src/components/GithubIssues/index.ts @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export * from './GitHubIssues'; + +export * from './GithubIssues'; diff --git a/plugins/github-issues/src/hooks/useEntityGitHubRepositories.ts b/plugins/github-issues/src/hooks/useEntityGithubRepositories.ts similarity index 97% rename from plugins/github-issues/src/hooks/useEntityGitHubRepositories.ts rename to plugins/github-issues/src/hooks/useEntityGithubRepositories.ts index d7b60575ad..f3fab72090 100644 --- a/plugins/github-issues/src/hooks/useEntityGitHubRepositories.ts +++ b/plugins/github-issues/src/hooks/useEntityGithubRepositories.ts @@ -25,7 +25,7 @@ export const getProjectNameFromEntity = (entity: Entity): string => { return entity?.metadata.annotations?.[GITHUB_PROJECT_SLUG_ANNOTATION] ?? ''; }; -export function useEntityGitHubRepositories() { +export function useEntityGithubRepositories() { const { entity } = useEntity(); const catalogApi = useApi(catalogApiRef); diff --git a/plugins/github-issues/src/hooks/useGetIssuesByRepoFromGitHub.ts b/plugins/github-issues/src/hooks/useGetIssuesByRepoFromGithub.ts similarity index 75% rename from plugins/github-issues/src/hooks/useGetIssuesByRepoFromGitHub.ts rename to plugins/github-issues/src/hooks/useGetIssuesByRepoFromGithub.ts index 693be9e4d9..8ec5f3ec65 100644 --- a/plugins/github-issues/src/hooks/useGetIssuesByRepoFromGitHub.ts +++ b/plugins/github-issues/src/hooks/useGetIssuesByRepoFromGithub.ts @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { useApi } from '@backstage/core-plugin-api'; - import useAsyncRetry from 'react-use/lib/useAsyncRetry'; -import { gitHubIssuesApiRef, GitubIssuesByRepoOptions } from '../api'; +import { githubIssuesApiRef, GithubIssuesByRepoOptions } from '../api'; -export const useGetIssuesByRepoFromGitHub = ( +export const useGetIssuesByRepoFromGithub = ( repos: Array, itemsPerRepo: number, - options?: GitubIssuesByRepoOptions, + options?: GithubIssuesByRepoOptions, ) => { - const gitHubIssuesApi = useApi(gitHubIssuesApiRef); + const githubIssuesApi = useApi(githubIssuesApiRef); const { value: issues, @@ -31,7 +31,7 @@ export const useGetIssuesByRepoFromGitHub = ( retry, } = useAsyncRetry(async () => { if (repos.length > 0) { - return await gitHubIssuesApi.fetchIssuesByRepoFromGitHub( + return await githubIssuesApi.fetchIssuesByRepoFromGithub( repos, itemsPerRepo, options, @@ -41,5 +41,5 @@ export const useGetIssuesByRepoFromGitHub = ( return {}; }, [repos]); - return { isLoading, gitHubIssuesByRepo: issues, retry }; + return { isLoading, githubIssuesByRepo: issues, retry }; }; diff --git a/plugins/github-issues/src/index.ts b/plugins/github-issues/src/index.ts index 7717ba5f33..b44c1e8773 100644 --- a/plugins/github-issues/src/index.ts +++ b/plugins/github-issues/src/index.ts @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { - gitHubIssuesPlugin, - GitHubIssuesPage, - GitHubIssuesCard, -} from './plugin'; -export type { GitHubIssuesProps } from './components/GitHubIssues'; +export { + githubIssuesPlugin, + GithubIssuesPage, + GithubIssuesCard, +} from './plugin'; +export type { GithubIssuesProps } from './components/GithubIssues'; export type { GithubIssuesFilters, GithubIssuesOrdering, - GitubIssuesByRepoOptions, -} from './api/gitHubIssuesApi'; + GithubIssuesByRepoOptions, +} from './api/githubIssuesApi'; diff --git a/plugins/github-issues/src/plugin.test.ts b/plugins/github-issues/src/plugin.test.ts index e6749dd970..f611e1b1e2 100644 --- a/plugins/github-issues/src/plugin.test.ts +++ b/plugins/github-issues/src/plugin.test.ts @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { gitHubIssuesPlugin } from './plugin'; + +import { githubIssuesPlugin } from './plugin'; describe('github-issues', () => { it('should export plugin', () => { - expect(gitHubIssuesPlugin).toBeDefined(); + expect(githubIssuesPlugin).toBeDefined(); }); }); diff --git a/plugins/github-issues/src/plugin.ts b/plugins/github-issues/src/plugin.ts index 3d845f4adf..52446efe87 100644 --- a/plugins/github-issues/src/plugin.ts +++ b/plugins/github-issues/src/plugin.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { createPlugin, createApiFactory, @@ -22,23 +23,22 @@ import { errorApiRef, githubAuthApiRef, } from '@backstage/core-plugin-api'; -import { gitHubIssuesApi, gitHubIssuesApiRef } from './api'; - +import { githubIssuesApi, githubIssuesApiRef } from './api'; import { rootRouteRef } from './routes'; /** @public */ -export const gitHubIssuesPlugin = createPlugin({ +export const githubIssuesPlugin = createPlugin({ id: 'github-issues', apis: [ createApiFactory({ - api: gitHubIssuesApiRef, + api: githubIssuesApiRef, deps: { configApi: configApiRef, githubAuthApi: githubAuthApiRef, errorApi: errorApiRef, }, factory: ({ configApi, githubAuthApi, errorApi }) => - gitHubIssuesApi(githubAuthApi, configApi, errorApi), + githubIssuesApi(githubAuthApi, configApi, errorApi), }), ], routes: { @@ -47,21 +47,21 @@ export const gitHubIssuesPlugin = createPlugin({ }); /** @public */ -export const GitHubIssuesCard = gitHubIssuesPlugin.provide( +export const GithubIssuesCard = githubIssuesPlugin.provide( createComponentExtension({ - name: 'GitHubIssuesCard', + name: 'GithubIssuesCard', component: { - lazy: () => import('./components/GitHubIssues').then(m => m.GitHubIssues), + lazy: () => import('./components/GithubIssues').then(m => m.GithubIssues), }, }), ); /** @public */ -export const GitHubIssuesPage = gitHubIssuesPlugin.provide( +export const GithubIssuesPage = githubIssuesPlugin.provide( createRoutableExtension({ - name: 'GitHubIssuesPage', + name: 'GithubIssuesPage', component: () => - import('./components/GitHubIssues').then(m => m.GitHubIssues), + import('./components/GithubIssues').then(m => m.GithubIssues), mountPoint: rootRouteRef, }), );