From 530b43c3caaafbd9401771d69bd18fff0f586bdb Mon Sep 17 00:00:00 2001 From: Zach Hammer Date: Tue, 12 Dec 2023 16:43:32 -0500 Subject: [PATCH] run yarn prettier --- .github/workflows/build.yml | 20 +++++++++---------- CODE_OF_CONDUCT.md | 20 +++++++++---------- CONTRIBUTING.md | 2 +- README.md | 2 +- app-config.yaml | 2 +- mock-catalog/entities.yaml | 2 +- mock-catalog/organization.yaml | 2 +- packages/app/src/App.tsx | 4 +--- .../app/src/components/catalog/EntityPage.tsx | 8 ++------ .../src/database/awards.test.ts | 6 ++++-- plugins/awards-backend/src/database/awards.ts | 2 +- plugins/awards-backend/src/service/router.ts | 8 +++++++- plugins/awards/src/api/AwardsBackendClient.ts | 4 ++-- .../AwardEditComponent/AwardEditComponent.tsx | 9 +++++---- .../AwardViewComponent/AwardViewComponent.tsx | 2 -- plugins/awards/src/index.ts | 5 +---- plugins/awards/src/plugin.ts | 2 +- plugins/awards/src/routes.ts | 2 +- 18 files changed, 50 insertions(+), 52 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51aaef1..a4e054a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,13 +7,13 @@ jobs: matrix: node-version: [18.x, 20.x] steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'yarn' - - run: yarn tsc - - run: yarn lint - - run: yarn prettier:check - - run: yarn test + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + - run: yarn tsc + - run: yarn lint + - run: yarn prettier:check + - run: yarn test diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index fc64ac3..d328c4f 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall +- Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or advances of +- The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b6868cd..b44fb28 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,5 +10,5 @@ This project follow's SeatGeek's [Open Source Community Guidelines](CODE_OF_COND ## Contribution process -All submissions, including submissions by project members, require review. We use [GitHub pull +All submissions, including submissions by project members, require review. We use [GitHub pull requests](https://docs.github.com/articles/about-pull-requests) for this purpose. diff --git a/README.md b/README.md index bf61cc1..5ae0efa 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,4 @@ their respective locations. ## Preview the collection -We have created a demo Backstage application to preview the SeatGeek Backstage Plugins Collection. To view it, clone this repository and run `yarn install && yarn dev`. \ No newline at end of file +We have created a demo Backstage application to preview the SeatGeek Backstage Plugins Collection. To view it, clone this repository and run `yarn install && yarn dev`. diff --git a/app-config.yaml b/app-config.yaml index 4a9e31f..b3a5d62 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -42,4 +42,4 @@ catalog: - type: file target: ../../mock-catalog/templates/create-postgres-database.yaml - type: file - target: ../../mock-catalog/templates/create-python-module.yaml \ No newline at end of file + target: ../../mock-catalog/templates/create-python-module.yaml diff --git a/mock-catalog/entities.yaml b/mock-catalog/entities.yaml index d121fd0..748c0b4 100644 --- a/mock-catalog/entities.yaml +++ b/mock-catalog/entities.yaml @@ -18,4 +18,4 @@ metadata: spec: type: service owner: product - lifecycle: production \ No newline at end of file + lifecycle: production diff --git a/mock-catalog/organization.yaml b/mock-catalog/organization.yaml index a14bacc..1d47701 100644 --- a/mock-catalog/organization.yaml +++ b/mock-catalog/organization.yaml @@ -42,4 +42,4 @@ metadata: name: guests spec: type: team - children: [] \ No newline at end of file + children: [] diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index 02a1b54..b2e52ea 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -36,9 +36,7 @@ import { AppRouter, FlatRoutes } from '@backstage/core-app-api'; import { CatalogGraphPage } from '@backstage/plugin-catalog-graph'; import { RequirePermission } from '@backstage/plugin-permission-react'; import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha'; -import { - AwardsPage -} from '@internal/plugin-awards'; +import { AwardsPage } from '@internal/plugin-awards'; const app = createApp({ apis, diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx index d04f8a9..38c7032 100644 --- a/packages/app/src/components/catalog/EntityPage.tsx +++ b/packages/app/src/components/catalog/EntityPage.tsx @@ -40,12 +40,8 @@ import { } from '@backstage/plugin-org'; import { EntityTechdocsContent } from '@backstage/plugin-techdocs'; import { EmptyState } from '@backstage/core-components'; -import { - EntityCatalogGraphCard, -} from '@backstage/plugin-catalog-graph'; -import { - stringifyEntityRef, -} from '@backstage/catalog-model'; +import { EntityCatalogGraphCard } from '@backstage/plugin-catalog-graph'; +import { stringifyEntityRef } from '@backstage/catalog-model'; import { UserAwardsCard } from '@internal/plugin-awards'; import { EntityScaffolderContent } from '@internal/plugin-entity-scaffolder-content'; diff --git a/plugins/awards-backend/src/database/awards.test.ts b/plugins/awards-backend/src/database/awards.test.ts index a9d38b1..6e3a494 100644 --- a/plugins/awards-backend/src/database/awards.test.ts +++ b/plugins/awards-backend/src/database/awards.test.ts @@ -181,8 +181,10 @@ describe('awards database CRUD', () => { [], award.recipients, ); - } - await expect(createWithNoOwner).rejects.toThrow('New award must have at least one owner') + }; + await expect(createWithNoOwner).rejects.toThrow( + 'New award must have at least one owner', + ); }); it('should create an award with no recipients', async () => { diff --git a/plugins/awards-backend/src/database/awards.ts b/plugins/awards-backend/src/database/awards.ts index a3f8120..3fe0b0c 100644 --- a/plugins/awards-backend/src/database/awards.ts +++ b/plugins/awards-backend/src/database/awards.ts @@ -47,7 +47,7 @@ type DatabaseAwardsStoreOptions = { }; export class DatabaseAwardsStore implements AwardsStore { - private constructor(private readonly db: Knex) { } + private constructor(private readonly db: Knex) {} static async create({ database, diff --git a/plugins/awards-backend/src/service/router.ts b/plugins/awards-backend/src/service/router.ts index a0eeb13..76c1190 100644 --- a/plugins/awards-backend/src/service/router.ts +++ b/plugins/awards-backend/src/service/router.ts @@ -141,7 +141,13 @@ export async function createRouter( const { name, description, image, owners, recipients } = request.body; - const resp = await dbStore.add(name, description, image, owners, recipients); + const resp = await dbStore.add( + name, + description, + image, + owners, + recipients, + ); response.json(resp); }); diff --git a/plugins/awards/src/api/AwardsBackendClient.ts b/plugins/awards/src/api/AwardsBackendClient.ts index 07b0e8d..aecb238 100644 --- a/plugins/awards/src/api/AwardsBackendClient.ts +++ b/plugins/awards/src/api/AwardsBackendClient.ts @@ -24,10 +24,10 @@ export class AwardsBackendApi implements AwardsApi { query.append('name', name); owners.forEach(owner => { query.append('owners', owner); - }) + }); recipients.forEach(recipient => { query.append('recipients', recipient); - }) + }); return await this.fetchApi .fetch(`${url}?${query}`, { method: 'GET', diff --git a/plugins/awards/src/components/AwardEditComponent/AwardEditComponent.tsx b/plugins/awards/src/components/AwardEditComponent/AwardEditComponent.tsx index 2ffcb57..408ae50 100644 --- a/plugins/awards/src/components/AwardEditComponent/AwardEditComponent.tsx +++ b/plugins/awards/src/components/AwardEditComponent/AwardEditComponent.tsx @@ -94,8 +94,9 @@ export const AwardEditCard = ({ award = emptyAward }: AwardEditCardProps) => { const users: User[] = entities.items.map(entity => { return { name: entity.metadata.name, - ref: `${entity.kind.toLowerCase()}:${entity.metadata.namespace}/${entity.metadata.name - }`, + ref: `${entity.kind.toLowerCase()}:${entity.metadata.namespace}/${ + entity.metadata.name + }`, }; }); setAllUsers(users); @@ -138,7 +139,7 @@ export const AwardEditCard = ({ award = emptyAward }: AwardEditCardProps) => { severity: 'success', display: 'transient', }); - navigate(`/awards/view/${res.uid}`,) + navigate(`/awards/view/${res.uid}`); } else { throw new Error('Error saving award'); } @@ -162,7 +163,7 @@ export const AwardEditCard = ({ award = emptyAward }: AwardEditCardProps) => { display: 'transient', }); - navigate('/awards') + navigate('/awards'); } else { throw new Error('Error removing award'); } diff --git a/plugins/awards/src/components/AwardViewComponent/AwardViewComponent.tsx b/plugins/awards/src/components/AwardViewComponent/AwardViewComponent.tsx index 725c56f..0629702 100644 --- a/plugins/awards/src/components/AwardViewComponent/AwardViewComponent.tsx +++ b/plugins/awards/src/components/AwardViewComponent/AwardViewComponent.tsx @@ -44,7 +44,6 @@ export const AwardViewComponent = ({ uid }: AwardViewComponentProps) => { return res[0]; } throw new Error(`Award with uid ${uid} does not exist`); - }, [awardsApi]); if (loading) { @@ -55,5 +54,4 @@ export const AwardViewComponent = ({ uid }: AwardViewComponentProps) => { return ; } return ; - }; diff --git a/plugins/awards/src/index.ts b/plugins/awards/src/index.ts index 1d6e5be..3a88b44 100644 --- a/plugins/awards/src/index.ts +++ b/plugins/awards/src/index.ts @@ -1,6 +1,3 @@ -export { - awardsPlugin, - AwardsPage -} from './plugin'; +export { awardsPlugin, AwardsPage } from './plugin'; export { UserAwardsCard } from './components'; export * from './api'; diff --git a/plugins/awards/src/plugin.ts b/plugins/awards/src/plugin.ts index 41ba1b9..bef7e2c 100644 --- a/plugins/awards/src/plugin.ts +++ b/plugins/awards/src/plugin.ts @@ -32,4 +32,4 @@ export const AwardsPage = awardsPlugin.provide( component: () => import('./router').then(m => m.AwardsRouter), mountPoint: rootRouteRef, }), -); \ No newline at end of file +); diff --git a/plugins/awards/src/routes.ts b/plugins/awards/src/routes.ts index 898dd52..8efe32d 100644 --- a/plugins/awards/src/routes.ts +++ b/plugins/awards/src/routes.ts @@ -8,7 +8,7 @@ export const editRouteRef = createSubRouteRef({ id: 'awards-edit', parent: rootRouteRef, path: '/edit/:uid', -}) +}); export const newRouteRef = createSubRouteRef({ id: 'awards-new',