From 54371a17bc953e1032138f9a51d0b492c0d3946b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Tue, 18 Jun 2024 15:49:22 +0200 Subject: [PATCH 1/2] Removed explicit Prettier config from frontend --- packages/frontend/.prettierrc | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 packages/frontend/.prettierrc diff --git a/packages/frontend/.prettierrc b/packages/frontend/.prettierrc deleted file mode 100644 index 555da68bc..000000000 --- a/packages/frontend/.prettierrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "arrowParens": "always", - "bracketSpacing": true, - "embeddedLanguageFormatting": "auto", - "htmlWhitespaceSensitivity": "css", - "insertPragma": false, - "jsxBracketSameLine": false, - "jsxSingleQuote": false, - "printWidth": 80, - "proseWrap": "preserve", - "quoteProps": "as-needed", - "requirePragma": false, - "semi": false, - "singleQuote": false, - "tabWidth": 2, - "trailingComma": "es5", - "useTabs": false, - "vueIndentScriptAndStyle": false -} From fae3611399387dcd886fc89688d9614d097f6170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Tue, 18 Jun 2024 15:50:07 +0200 Subject: [PATCH 2/2] Applied new prettier config --- packages/frontend/__mocks__/fileMock.ts | 4 +- packages/frontend/__tests__/App.test.tsx | 70 +++++++++---------- .../__tests__/components/Button.test.tsx | 36 +++++----- .../__tests__/components/ColoredTag.test.tsx | 12 ++-- .../__tests__/components/ExtLink.test.tsx | 36 +++++----- .../__tests__/components/Issue.test.tsx | 38 +++++----- .../__tests__/components/IssuesList.test.tsx | 28 ++++---- .../__tests__/components/Navigation.test.tsx | 24 +++---- .../__tests__/components/Project.test.tsx | 20 +++--- .../components/ProjectLinks.test.tsx | 20 +++--- .../__tests__/components/ScrollToTop.test.tsx | 30 ++++---- .../__tests__/pages/IssueDetail.test.tsx | 30 ++++---- .../__tests__/pages/IssuesList.test.tsx | 18 ++--- .../__tests__/pages/ProjectDetail.test.tsx | 28 ++++---- .../__tests__/pages/ProjectsList.test.tsx | 18 ++--- packages/frontend/__tests__/setupTests.ts | 6 +- packages/frontend/__tests__/testData.ts | 4 +- .../__tests__/utils/getAllIssues.test.ts | 16 ++--- .../__tests__/utils/getIssueLink.test.ts | 12 ++-- .../utils/getIssueWithProject.test.ts | 36 +++++----- .../__tests__/utils/getProject.test.ts | 24 +++---- .../__tests__/utils/getProjectLink.test.ts | 12 ++-- packages/frontend/src/App.tsx | 40 +++++------ .../frontend/src/components/ArticleBox.tsx | 36 +++++----- packages/frontend/src/components/Button.tsx | 14 ++-- .../frontend/src/components/ColoredTag.tsx | 10 +-- .../frontend/src/components/Container.tsx | 26 +++---- packages/frontend/src/components/ExtLink.tsx | 18 ++--- packages/frontend/src/components/Issue.tsx | 18 ++--- .../frontend/src/components/IssuesList.tsx | 30 ++++---- packages/frontend/src/components/Layout.tsx | 4 +- .../frontend/src/components/Navigation.tsx | 22 +++--- packages/frontend/src/components/Project.tsx | 12 ++-- .../frontend/src/components/ProjectBox.tsx | 6 +- .../frontend/src/components/ProjectLinks.tsx | 52 +++++++------- .../frontend/src/components/ScrollToTop.tsx | 14 ++-- .../frontend/src/components/Typography.tsx | 20 +++--- packages/frontend/src/config.ts | 2 +- packages/frontend/src/globalStyles.ts | 6 +- packages/frontend/src/index.tsx | 16 ++--- .../frontend/src/interfaces/GlobalConfig.ts | 4 +- packages/frontend/src/interfaces/Project.ts | 4 +- .../frontend/src/interfaces/ProjectInfo.ts | 38 +++++----- .../frontend/src/interfaces/ProjectIssue.ts | 8 +-- .../frontend/src/interfaces/ProjectListing.ts | 12 ++-- .../src/interfaces/ProjectListings.ts | 6 +- packages/frontend/src/pages/IssueDetail.tsx | 56 +++++++-------- packages/frontend/src/pages/IssuesList.tsx | 16 ++--- packages/frontend/src/pages/ProjectDetail.tsx | 44 ++++++------ packages/frontend/src/pages/ProjectsList.tsx | 10 +-- packages/frontend/src/react-app-env.d.ts | 4 +- packages/frontend/src/theme.ts | 2 +- packages/frontend/src/utils/getAllIssues.ts | 20 +++--- packages/frontend/src/utils/getIssueLink.ts | 4 +- .../frontend/src/utils/getIssueWithProject.ts | 20 +++--- packages/frontend/src/utils/getProject.ts | 10 +-- packages/frontend/src/utils/getProjectLink.ts | 4 +- packages/frontend/webpack.config.js | 16 ++--- 58 files changed, 573 insertions(+), 573 deletions(-) diff --git a/packages/frontend/__mocks__/fileMock.ts b/packages/frontend/__mocks__/fileMock.ts index 4ba7bbd78..d0f84cf9a 100644 --- a/packages/frontend/__mocks__/fileMock.ts +++ b/packages/frontend/__mocks__/fileMock.ts @@ -1,2 +1,2 @@ -const filename = "test-file-stub" -export default filename +const filename = "test-file-stub"; +export default filename; diff --git a/packages/frontend/__tests__/App.test.tsx b/packages/frontend/__tests__/App.test.tsx index 1640a4c78..6dc546c36 100644 --- a/packages/frontend/__tests__/App.test.tsx +++ b/packages/frontend/__tests__/App.test.tsx @@ -1,17 +1,17 @@ -import { mocked } from "jest-mock" -import { MemoryRouter } from "react-router-dom" -import renderer from "react-test-renderer" -import * as swr from "swr" +import { mocked } from "jest-mock"; +import { MemoryRouter } from "react-router-dom"; +import renderer from "react-test-renderer"; +import * as swr from "swr"; -import { App } from "../src/App" -import { testData } from "./testData" +import { App } from "../src/App"; +import { testData } from "./testData"; -jest.mock("swr") +jest.mock("swr"); describe("App", () => { beforeAll(() => { - window.scrollTo = jest.fn() - }) + window.scrollTo = jest.fn(); + }); test("should render correctly", () => { mocked(swr).default.mockReturnValue({ @@ -20,16 +20,16 @@ describe("App", () => { mutate: jest.fn(), isValidating: false, isLoading: false, - }) + }); const tree = renderer .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render projects correctly", () => { mocked(swr).default.mockReturnValue({ @@ -38,16 +38,16 @@ describe("App", () => { mutate: jest.fn(), isValidating: false, isLoading: false, - }) + }); const tree = renderer .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render project listing correctly", () => { mocked(swr).default.mockReturnValue({ @@ -56,16 +56,16 @@ describe("App", () => { mutate: jest.fn(), isValidating: false, isLoading: false, - }) + }); const tree = renderer .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render issue listing correctly", () => { mocked(swr).default.mockReturnValue({ @@ -74,16 +74,16 @@ describe("App", () => { mutate: jest.fn(), isValidating: false, isLoading: false, - }) + }); const tree = renderer .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should handle error gracefully", () => { mocked(swr).default.mockReturnValue({ @@ -92,14 +92,14 @@ describe("App", () => { mutate: jest.fn(), isValidating: false, isLoading: false, - }) + }); const tree = renderer .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) -}) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/components/Button.test.tsx b/packages/frontend/__tests__/components/Button.test.tsx index fa299232e..97b8575a2 100644 --- a/packages/frontend/__tests__/components/Button.test.tsx +++ b/packages/frontend/__tests__/components/Button.test.tsx @@ -1,45 +1,45 @@ -import renderer from "react-test-renderer" +import renderer from "react-test-renderer"; -import { Button } from "../../src/components/Button" +import { Button } from "../../src/components/Button"; describe("Button component", () => { test("should render correctly", () => { const tree = renderer .create() - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render correctly with title", () => { const tree = renderer .create( + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render correctly with custom class", () => { const tree = renderer .create( + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render correctly with target self", () => { const tree = renderer .create( + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) -}) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/components/ColoredTag.test.tsx b/packages/frontend/__tests__/components/ColoredTag.test.tsx index d630d19ef..9b4cc0856 100644 --- a/packages/frontend/__tests__/components/ColoredTag.test.tsx +++ b/packages/frontend/__tests__/components/ColoredTag.test.tsx @@ -1,10 +1,10 @@ -import renderer from "react-test-renderer" +import renderer from "react-test-renderer"; -import { ColoredTag } from "../../src/components/ColoredTag" +import { ColoredTag } from "../../src/components/ColoredTag"; describe("ColoredTag component", () => { test("should render correctly", () => { - const tree = renderer.create(Tag).toJSON() - expect(tree).toMatchSnapshot() - }) -}) + const tree = renderer.create(Tag).toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/components/ExtLink.test.tsx b/packages/frontend/__tests__/components/ExtLink.test.tsx index 9ec39e020..687b9423e 100644 --- a/packages/frontend/__tests__/components/ExtLink.test.tsx +++ b/packages/frontend/__tests__/components/ExtLink.test.tsx @@ -1,45 +1,45 @@ -import renderer from "react-test-renderer" +import renderer from "react-test-renderer"; -import { ExtLink } from "../../src/components/ExtLink" +import { ExtLink } from "../../src/components/ExtLink"; describe("ExtLink component", () => { test("should render correctly", () => { const tree = renderer .create(Link somewhere) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render correctly with title", () => { const tree = renderer .create( Link somewhere - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render correctly with custom class", () => { const tree = renderer .create( Link somewhere - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render correctly with target self", () => { const tree = renderer .create( Link somewhere - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) -}) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/components/Issue.test.tsx b/packages/frontend/__tests__/components/Issue.test.tsx index cb5901350..fe1b6828c 100644 --- a/packages/frontend/__tests__/components/Issue.test.tsx +++ b/packages/frontend/__tests__/components/Issue.test.tsx @@ -1,41 +1,41 @@ -import { MemoryRouter } from "react-router-dom" -import renderer from "react-test-renderer" +import { MemoryRouter } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { Issue } from "../../src/components/Issue" -import { getIssueWithProject } from "../../src/utils/getIssueWithProject" -import { testData } from "../testData" +import { Issue } from "../../src/components/Issue"; +import { getIssueWithProject } from "../../src/utils/getIssueWithProject"; +import { testData } from "../testData"; -const project = testData.projects[0] -const issue = project.issues[0] +const project = testData.projects[0]; +const issue = project.issues[0]; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Checked in the test const issueWithProject = getIssueWithProject( testData, project.owner, project.repo, - issue.number -)! + issue.number, +)!; describe("Issue component", () => { test("should render correctly", () => { - expect(issue).not.toBeNull() + expect(issue).not.toBeNull(); const tree = renderer .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render correctly without tags", () => { const tree = renderer .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) -}) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/components/IssuesList.test.tsx b/packages/frontend/__tests__/components/IssuesList.test.tsx index 120ffd0d5..0cd41605d 100644 --- a/packages/frontend/__tests__/components/IssuesList.test.tsx +++ b/packages/frontend/__tests__/components/IssuesList.test.tsx @@ -1,10 +1,10 @@ -import { MemoryRouter } from "react-router-dom" -import renderer from "react-test-renderer" +import { MemoryRouter } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { IssuesList } from "../../src/components/IssuesList" -import { testData } from "../testData" +import { IssuesList } from "../../src/components/IssuesList"; +import { testData } from "../testData"; -const project = testData.projects[0] +const project = testData.projects[0]; describe("IssuesList component", () => { test("should render correctly", () => { @@ -12,11 +12,11 @@ describe("IssuesList component", () => { .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render correctly without link", () => { const tree = renderer .create( @@ -28,9 +28,9 @@ describe("IssuesList component", () => { }))} project={project} /> - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) -}) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/components/Navigation.test.tsx b/packages/frontend/__tests__/components/Navigation.test.tsx index fe9d15e64..f2e8f242e 100644 --- a/packages/frontend/__tests__/components/Navigation.test.tsx +++ b/packages/frontend/__tests__/components/Navigation.test.tsx @@ -1,7 +1,7 @@ -import { MemoryRouter } from "react-router-dom" -import renderer from "react-test-renderer" +import { MemoryRouter } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { Navigation } from "../../src/components/Navigation" +import { Navigation } from "../../src/components/Navigation"; describe("Navigation component", () => { test("should render correctly", () => { @@ -20,11 +20,11 @@ describe("Navigation component", () => { }, ]} /> - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); test("should render correctly wyth active item", () => { const tree = renderer .create( @@ -42,9 +42,9 @@ describe("Navigation component", () => { }, ]} /> - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) -}) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/components/Project.test.tsx b/packages/frontend/__tests__/components/Project.test.tsx index 4f4bddd4e..1d1208f69 100644 --- a/packages/frontend/__tests__/components/Project.test.tsx +++ b/packages/frontend/__tests__/components/Project.test.tsx @@ -1,10 +1,10 @@ -import { MemoryRouter } from "react-router-dom" -import renderer from "react-test-renderer" +import { MemoryRouter } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { Project } from "../../src/components/Project" -import { testData } from "../testData" +import { Project } from "../../src/components/Project"; +import { testData } from "../testData"; -const project = testData.projects[0] +const project = testData.projects[0]; describe("Project component", () => { test("should render correctly", () => { @@ -12,9 +12,9 @@ describe("Project component", () => { .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) -}) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/components/ProjectLinks.test.tsx b/packages/frontend/__tests__/components/ProjectLinks.test.tsx index 4099a3d9b..1501602c1 100644 --- a/packages/frontend/__tests__/components/ProjectLinks.test.tsx +++ b/packages/frontend/__tests__/components/ProjectLinks.test.tsx @@ -1,10 +1,10 @@ -import { MemoryRouter } from "react-router-dom" -import renderer from "react-test-renderer" +import { MemoryRouter } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { ProjectLinks } from "../../src/components/ProjectLinks" -import { testData } from "../testData" +import { ProjectLinks } from "../../src/components/ProjectLinks"; +import { testData } from "../testData"; -const project = testData.projects[0] +const project = testData.projects[0]; describe("ProjectLinks component", () => { test("should render correctly", () => { @@ -12,9 +12,9 @@ describe("ProjectLinks component", () => { .create( - + , ) - .toJSON() - expect(tree).toMatchSnapshot() - }) -}) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/components/ScrollToTop.test.tsx b/packages/frontend/__tests__/components/ScrollToTop.test.tsx index a83e747d4..5c50203a4 100644 --- a/packages/frontend/__tests__/components/ScrollToTop.test.tsx +++ b/packages/frontend/__tests__/components/ScrollToTop.test.tsx @@ -1,15 +1,15 @@ -import userEvent from "@testing-library/user-event" -import { Link, MemoryRouter, Route, Routes } from "react-router-dom" -import renderer from "react-test-renderer" +import userEvent from "@testing-library/user-event"; +import { Link, MemoryRouter, Route, Routes } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { ScrollToTop } from "../../src/components/ScrollToTop" +import { ScrollToTop } from "../../src/components/ScrollToTop"; -global.scrollTo = jest.fn() +global.scrollTo = jest.fn(); describe("ScrollToTop", () => { test("calls window.scrollTo when route changes", async () => { - expect.assertions(2) - const user = userEvent.setup() + expect.assertions(2); + const user = userEvent.setup(); const root = renderer.create( @@ -24,11 +24,11 @@ describe("ScrollToTop", () => { /> About} path="about" /> - - ) - expect(global.scrollTo).not.toHaveBeenCalled() - const link = root.root.findByProps({ className: "the-link" }) - await user.click(link.instance as Element) - expect(global.scrollTo).toHaveBeenCalledWith(0, 0) - }) -}) + , + ); + expect(global.scrollTo).not.toHaveBeenCalled(); + const link = root.root.findByProps({ className: "the-link" }); + await user.click(link.instance as Element); + expect(global.scrollTo).toHaveBeenCalledWith(0, 0); + }); +}); diff --git a/packages/frontend/__tests__/pages/IssueDetail.test.tsx b/packages/frontend/__tests__/pages/IssueDetail.test.tsx index ddde79baf..fd18ca6e8 100644 --- a/packages/frontend/__tests__/pages/IssueDetail.test.tsx +++ b/packages/frontend/__tests__/pages/IssueDetail.test.tsx @@ -1,11 +1,11 @@ -import { MemoryRouter, Route, Routes } from "react-router-dom" -import renderer from "react-test-renderer" +import { MemoryRouter, Route, Routes } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { IssueDetail } from "../../src/pages/IssueDetail" -import { testData } from "../testData" +import { IssueDetail } from "../../src/pages/IssueDetail"; +import { testData } from "../testData"; -const project = testData.projects[0] -const issue = project.issues[0] +const project = testData.projects[0]; +const issue = project.issues[0]; describe("IssueDetail page", () => { test("should render correctly", () => { @@ -19,10 +19,10 @@ describe("IssueDetail page", () => { path="/:owner/:project/:issue" /> - - ) - expect(tree).toMatchSnapshot() - }) + , + ); + expect(tree).toMatchSnapshot(); + }); test("should render correctly if there is no related issue", () => { const tree = renderer.create( @@ -33,8 +33,8 @@ describe("IssueDetail page", () => { path="/:owner/:project/:issue" /> - - ) - expect(tree).toMatchSnapshot() - }) -}) + , + ); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/pages/IssuesList.test.tsx b/packages/frontend/__tests__/pages/IssuesList.test.tsx index 07319e737..4c1ecab71 100644 --- a/packages/frontend/__tests__/pages/IssuesList.test.tsx +++ b/packages/frontend/__tests__/pages/IssuesList.test.tsx @@ -1,16 +1,16 @@ -import { MemoryRouter } from "react-router-dom" -import renderer from "react-test-renderer" +import { MemoryRouter } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { IssuesList } from "../../src/pages/IssuesList" -import { testData } from "../testData" +import { IssuesList } from "../../src/pages/IssuesList"; +import { testData } from "../testData"; describe("IssuesList page", () => { test("should render correctly", () => { const tree = renderer.create( - - ) - expect(tree).toMatchSnapshot() - }) -}) + , + ); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/pages/ProjectDetail.test.tsx b/packages/frontend/__tests__/pages/ProjectDetail.test.tsx index 48d60d8ac..33877ae7f 100644 --- a/packages/frontend/__tests__/pages/ProjectDetail.test.tsx +++ b/packages/frontend/__tests__/pages/ProjectDetail.test.tsx @@ -1,10 +1,10 @@ -import { MemoryRouter, Route, Routes } from "react-router-dom" -import renderer from "react-test-renderer" +import { MemoryRouter, Route, Routes } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { ProjectDetail } from "../../src/pages/ProjectDetail" -import { testData } from "../testData" +import { ProjectDetail } from "../../src/pages/ProjectDetail"; +import { testData } from "../testData"; -const project = testData.projects[0] +const project = testData.projects[0]; describe("ProjectDetail page", () => { test("should render correctly", () => { @@ -16,10 +16,10 @@ describe("ProjectDetail page", () => { path="/:owner/:project" /> - - ) - expect(tree).toMatchSnapshot() - }) + , + ); + expect(tree).toMatchSnapshot(); + }); test("should render correctly if there is no related issue", () => { const tree = renderer.create( @@ -30,8 +30,8 @@ describe("ProjectDetail page", () => { path="/:owner/:project" /> - - ) - expect(tree).toMatchSnapshot() - }) -}) + , + ); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/pages/ProjectsList.test.tsx b/packages/frontend/__tests__/pages/ProjectsList.test.tsx index 3d1cd9420..3eb45fd6a 100644 --- a/packages/frontend/__tests__/pages/ProjectsList.test.tsx +++ b/packages/frontend/__tests__/pages/ProjectsList.test.tsx @@ -1,16 +1,16 @@ -import { MemoryRouter } from "react-router-dom" -import renderer from "react-test-renderer" +import { MemoryRouter } from "react-router-dom"; +import renderer from "react-test-renderer"; -import { ProjectsList } from "../../src/pages/ProjectsList" -import { testData } from "../testData" +import { ProjectsList } from "../../src/pages/ProjectsList"; +import { testData } from "../testData"; describe("ProjectsList page", () => { test("should render correctly", () => { const tree = renderer.create( - - ) - expect(tree).toMatchSnapshot() - }) -}) + , + ); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/packages/frontend/__tests__/setupTests.ts b/packages/frontend/__tests__/setupTests.ts index ce787756f..cff60e02b 100644 --- a/packages/frontend/__tests__/setupTests.ts +++ b/packages/frontend/__tests__/setupTests.ts @@ -2,8 +2,8 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import "@testing-library/jest-dom" +import "@testing-library/jest-dom"; -import { createSerializer } from "@emotion/jest" +import { createSerializer } from "@emotion/jest"; -expect.addSnapshotSerializer(createSerializer()) +expect.addSnapshotSerializer(createSerializer()); diff --git a/packages/frontend/__tests__/testData.ts b/packages/frontend/__tests__/testData.ts index 97f178ec1..03de3b708 100644 --- a/packages/frontend/__tests__/testData.ts +++ b/packages/frontend/__tests__/testData.ts @@ -1,4 +1,4 @@ -import type { ProjectListings } from "../src/interfaces/ProjectListings" +import type { ProjectListings } from "../src/interfaces/ProjectListings"; export const testData: ProjectListings = { projects: [ @@ -223,4 +223,4 @@ export const testData: ProjectListings = { ], }, ], -} +}; diff --git a/packages/frontend/__tests__/utils/getAllIssues.test.ts b/packages/frontend/__tests__/utils/getAllIssues.test.ts index cca734da6..165a36589 100644 --- a/packages/frontend/__tests__/utils/getAllIssues.test.ts +++ b/packages/frontend/__tests__/utils/getAllIssues.test.ts @@ -1,12 +1,12 @@ -import { getIssuesWithProjectInfo } from "../../src/utils/getAllIssues" -import { testData } from "../testData" +import { getIssuesWithProjectInfo } from "../../src/utils/getAllIssues"; +import { testData } from "../testData"; test("should get all issues", () => { - const result = getIssuesWithProjectInfo(testData) - expect(result).toMatchSnapshot() -}) + const result = getIssuesWithProjectInfo(testData); + expect(result).toMatchSnapshot(); +}); test("should all issues except one", () => { - const result = getIssuesWithProjectInfo(testData, { omitIssueNumber: 5 }) - expect(result).toMatchSnapshot() -}) + const result = getIssuesWithProjectInfo(testData, { omitIssueNumber: 5 }); + expect(result).toMatchSnapshot(); +}); diff --git a/packages/frontend/__tests__/utils/getIssueLink.test.ts b/packages/frontend/__tests__/utils/getIssueLink.test.ts index ae4313a0b..7cb19f10d 100644 --- a/packages/frontend/__tests__/utils/getIssueLink.test.ts +++ b/packages/frontend/__tests__/utils/getIssueLink.test.ts @@ -1,11 +1,11 @@ -import { getIssueLink } from "../../src/utils/getIssueLink" -import { testData } from "../testData" +import { getIssueLink } from "../../src/utils/getIssueLink"; +import { testData } from "../testData"; test("should get issue link", () => { - const project = testData.projects[0] + const project = testData.projects[0]; const result = getIssueLink({ project: { ...project, ...project.info }, ...project.issues[1], - }) - expect(result).toBe("/skaut/skaut-google-drive-gallery/2") -}) + }); + expect(result).toBe("/skaut/skaut-google-drive-gallery/2"); +}); diff --git a/packages/frontend/__tests__/utils/getIssueWithProject.test.ts b/packages/frontend/__tests__/utils/getIssueWithProject.test.ts index d197ad477..e54d76c73 100644 --- a/packages/frontend/__tests__/utils/getIssueWithProject.test.ts +++ b/packages/frontend/__tests__/utils/getIssueWithProject.test.ts @@ -1,39 +1,39 @@ -import { getIssueWithProject } from "../../src/utils/getIssueWithProject" -import { testData } from "../testData" +import { getIssueWithProject } from "../../src/utils/getIssueWithProject"; +import { testData } from "../testData"; -const project = testData.projects[0] +const project = testData.projects[0]; test("should get issue with project", () => { const result = getIssueWithProject( testData, project.owner, project.repo, - project.issues[0].number - ) - expect(result).toMatchSnapshot() -}) + project.issues[0].number, + ); + expect(result).toMatchSnapshot(); +}); test("should not get issue with project if there is no existing owner", () => { const result = getIssueWithProject( testData, "", project.repo, - project.issues[0].number - ) - expect(result).toBeUndefined() -}) + project.issues[0].number, + ); + expect(result).toBeUndefined(); +}); test("should not get issue with project if there is no existing repo", () => { const result = getIssueWithProject( testData, project.owner, "", - project.issues[0].number - ) - expect(result).toBeUndefined() -}) + project.issues[0].number, + ); + expect(result).toBeUndefined(); +}); test("should not get issue with project if there is no existing issue number", () => { - const result = getIssueWithProject(testData, project.owner, project.repo, 99) - expect(result).toBeUndefined() -}) + const result = getIssueWithProject(testData, project.owner, project.repo, 99); + expect(result).toBeUndefined(); +}); diff --git a/packages/frontend/__tests__/utils/getProject.test.ts b/packages/frontend/__tests__/utils/getProject.test.ts index 3d5306864..15a5096ef 100644 --- a/packages/frontend/__tests__/utils/getProject.test.ts +++ b/packages/frontend/__tests__/utils/getProject.test.ts @@ -1,19 +1,19 @@ -import { getProject } from "../../src/utils/getProject" -import { testData } from "../testData" +import { getProject } from "../../src/utils/getProject"; +import { testData } from "../testData"; -const project = testData.projects[0] +const project = testData.projects[0]; test("should get project", () => { - const result = getProject(testData, project.owner, project.repo) - expect(result).toMatchSnapshot() -}) + const result = getProject(testData, project.owner, project.repo); + expect(result).toMatchSnapshot(); +}); test("should not get project if there is no existing owner", () => { - const result = getProject(testData, "", project.repo) - expect(result).toBeUndefined() -}) + const result = getProject(testData, "", project.repo); + expect(result).toBeUndefined(); +}); test("should not get project if there is no existing repo", () => { - const result = getProject(testData, project.owner, "") - expect(result).toBeUndefined() -}) + const result = getProject(testData, project.owner, ""); + expect(result).toBeUndefined(); +}); diff --git a/packages/frontend/__tests__/utils/getProjectLink.test.ts b/packages/frontend/__tests__/utils/getProjectLink.test.ts index acbce7f57..75a5523b4 100644 --- a/packages/frontend/__tests__/utils/getProjectLink.test.ts +++ b/packages/frontend/__tests__/utils/getProjectLink.test.ts @@ -1,8 +1,8 @@ -import { getProjectLink } from "../../src/utils/getProjectLink" -import { testData } from "../testData" +import { getProjectLink } from "../../src/utils/getProjectLink"; +import { testData } from "../testData"; -const project = testData.projects[0] +const project = testData.projects[0]; test("should get project link", () => { - const result = getProjectLink(project) - expect(result).toBe("/skaut/skaut-google-drive-gallery") -}) + const result = getProjectLink(project); + expect(result).toBe("/skaut/skaut-google-drive-gallery"); +}); diff --git a/packages/frontend/src/App.tsx b/packages/frontend/src/App.tsx index 9c3cb5402..68cda5ead 100644 --- a/packages/frontend/src/App.tsx +++ b/packages/frontend/src/App.tsx @@ -1,16 +1,16 @@ /** @jsxImportSource @emotion/react */ -import type React from "react" -import { Route, Routes } from "react-router-dom" -import useSWR from "swr" +import type React from "react"; +import { Route, Routes } from "react-router-dom"; +import useSWR from "swr"; -import { Container } from "./components/Container" -import { Navigation } from "./components/Navigation" -import { config } from "./config" -import type { ProjectListings } from "./interfaces/ProjectListings" -import { IssueDetail } from "./pages/IssueDetail" -import { IssuesList } from "./pages/IssuesList" -import { ProjectDetail } from "./pages/ProjectDetail" -import { ProjectsList } from "./pages/ProjectsList" +import { Container } from "./components/Container"; +import { Navigation } from "./components/Navigation"; +import { config } from "./config"; +import type { ProjectListings } from "./interfaces/ProjectListings"; +import { IssueDetail } from "./pages/IssueDetail"; +import { IssuesList } from "./pages/IssuesList"; +import { ProjectDetail } from "./pages/ProjectDetail"; +import { ProjectsList } from "./pages/ProjectsList"; const AppNavigation = (): React.JSX.Element => ( ( }, ]} /> -) +); export const App = (): React.JSX.Element => { const { data, error } = useSWR( config.dataApiUrl, async (url: string) => { - const res = await fetch(url) - return res.json() - } - ) + const res = await fetch(url); + return res.json(); + }, + ); if (error !== undefined) { - return
Nepodařilo se načíst data webu.
+ return
Nepodařilo se načíst data webu.
; } if (!data) { - return
Načítají se data webu.
+ return
Načítají se data webu.
; } return ( @@ -69,5 +69,5 @@ export const App = (): React.JSX.Element => { /> - ) -} + ); +}; diff --git a/packages/frontend/src/components/ArticleBox.tsx b/packages/frontend/src/components/ArticleBox.tsx index dd00e9055..91a639410 100644 --- a/packages/frontend/src/components/ArticleBox.tsx +++ b/packages/frontend/src/components/ArticleBox.tsx @@ -1,11 +1,11 @@ -import styled from "@emotion/styled" -import type React from "react" -import ReactMarkdown from "react-markdown" -import { Link } from "react-router-dom" -import remarkGfm from "remark-gfm" +import styled from "@emotion/styled"; +import type React from "react"; +import ReactMarkdown from "react-markdown"; +import { Link } from "react-router-dom"; +import remarkGfm from "remark-gfm"; -import { ColoredTag } from "./ColoredTag" -import { Article, H2, Paragraph } from "./Typography" +import { ColoredTag } from "./ColoredTag"; +import { Article, H2, Paragraph } from "./Typography"; export const ArticleBox = ({ title, @@ -16,13 +16,13 @@ export const ArticleBox = ({ description, tags, }: { - readonly title: string - readonly link?: string - readonly subtitle?: string - readonly subtitleLink?: string - readonly subtitleDescription?: string - readonly description: string - readonly tags?: Array + readonly title: string; + readonly link?: string; + readonly subtitle?: string; + readonly subtitleLink?: string; + readonly subtitleDescription?: string; + readonly description: string; + readonly tags?: Array; }): React.JSX.Element => (

{link !== undefined ? {title} : title}

@@ -40,7 +40,7 @@ export const ArticleBox = ({ {tag} ))}
-) +); ArticleBox.defaultProps = { link: undefined, @@ -48,15 +48,15 @@ ArticleBox.defaultProps = { subtitleDescription: undefined, subtitleLink: undefined, tags: [], -} +}; const ProjectName = styled("p")` margin: 0 0 0.6em; * { font-size: 0.8rem; } -` +`; const ThinArticle = styled(Article)` max-width: 600px; -` +`; diff --git a/packages/frontend/src/components/Button.tsx b/packages/frontend/src/components/Button.tsx index d8f9f1502..45ebfa371 100644 --- a/packages/frontend/src/components/Button.tsx +++ b/packages/frontend/src/components/Button.tsx @@ -1,13 +1,13 @@ -import styled from "@emotion/styled" -import type React from "react" +import styled from "@emotion/styled"; +import type React from "react"; -import { theme } from "../theme" -import type { LinkProps } from "./ExtLink" -import { ExtLink } from "./ExtLink" +import { theme } from "../theme"; +import type { LinkProps } from "./ExtLink"; +import { ExtLink } from "./ExtLink"; export const Button = (props: LinkProps): React.JSX.Element => ( -) +); const ButtonWrapper = styled(ExtLink)` display: inline-block; @@ -19,4 +19,4 @@ const ButtonWrapper = styled(ExtLink)` border-radius: 10px; box-shadow: 0 0 0 ${theme.colors.gray}; transition: box-shadow 300ms; -` +`; diff --git a/packages/frontend/src/components/ColoredTag.tsx b/packages/frontend/src/components/ColoredTag.tsx index 695712cb2..60a88134f 100644 --- a/packages/frontend/src/components/ColoredTag.tsx +++ b/packages/frontend/src/components/ColoredTag.tsx @@ -1,6 +1,6 @@ -import { css } from "@emotion/react" -import styled from "@emotion/styled" -import stringToColor from "string-to-color" +import { css } from "@emotion/react"; +import styled from "@emotion/styled"; +import stringToColor from "string-to-color"; export const ColoredTag = styled("span")( (props: { children: string; isLight?: boolean }) => css` @@ -12,5 +12,5 @@ export const ColoredTag = styled("span")( padding: 0.2rem 0.4rem; border-radius: 4px; ${props.isLight === true ? "border: 1px solid #ffffff55" : ""}; - ` -) + `, +); diff --git a/packages/frontend/src/components/Container.tsx b/packages/frontend/src/components/Container.tsx index 170ba4954..e584a3f73 100644 --- a/packages/frontend/src/components/Container.tsx +++ b/packages/frontend/src/components/Container.tsx @@ -1,12 +1,12 @@ -import { Global } from "@emotion/react" -import styled from "@emotion/styled" -import type React from "react" -import { Link, Outlet } from "react-router-dom" +import { Global } from "@emotion/react"; +import styled from "@emotion/styled"; +import type React from "react"; +import { Link, Outlet } from "react-router-dom"; -import { globalStyles } from "../globalStyles" -import logo from "../images/logo.svg" -import { theme } from "../theme" -import { ScrollToTop } from "./ScrollToTop" +import { globalStyles } from "../globalStyles"; +import logo from "../images/logo.svg"; +import { theme } from "../theme"; +import { ScrollToTop } from "./ScrollToTop"; export const Container = (): React.JSX.Element => ( @@ -22,13 +22,13 @@ export const Container = (): React.JSX.Element => ( -) +); const WrapperDiv = styled("div")` max-width: ${theme.layout.width}px; padding: 0 16px; margin: 0 auto; -` +`; const Header = styled("header")` display: flex; @@ -36,14 +36,14 @@ const Header = styled("header")` height: 60px; margin: 0 auto; padding: 16px 0; -` +`; const Title = styled("h1")` font-family: themix; font-size: 20px; margin: 0 0 0 24px; -` +`; const Logo = styled("img")` max-height: 100%; -` +`; diff --git a/packages/frontend/src/components/ExtLink.tsx b/packages/frontend/src/components/ExtLink.tsx index e91b9af20..278444c5e 100644 --- a/packages/frontend/src/components/ExtLink.tsx +++ b/packages/frontend/src/components/ExtLink.tsx @@ -1,13 +1,13 @@ /** @jsxImportSource @emotion/react */ -import { css } from "@emotion/react" -import type React from "react" +import { css } from "@emotion/react"; +import type React from "react"; export interface LinkProps { - readonly children: React.ReactNode - readonly href: string - readonly title?: string - readonly targetSelf?: boolean - readonly className?: string + readonly children: React.ReactNode; + readonly href: string; + readonly title?: string; + readonly targetSelf?: boolean; + readonly className?: string; } export const ExtLink = ({ children, @@ -33,10 +33,10 @@ export const ExtLink = ({ > {children} -) +); ExtLink.defaultProps = { className: undefined, targetSelf: false, title: undefined, -} +}; diff --git a/packages/frontend/src/components/Issue.tsx b/packages/frontend/src/components/Issue.tsx index 464526d94..f73e0150c 100644 --- a/packages/frontend/src/components/Issue.tsx +++ b/packages/frontend/src/components/Issue.tsx @@ -1,16 +1,16 @@ -import type React from "react" +import type React from "react"; -import type { ProjectIssueWithProjectInfo } from "../utils/getAllIssues" -import { getIssueLink } from "../utils/getIssueLink" -import { getProjectLink } from "../utils/getProjectLink" -import { ArticleBox } from "./ArticleBox" +import type { ProjectIssueWithProjectInfo } from "../utils/getAllIssues"; +import { getIssueLink } from "../utils/getIssueLink"; +import { getProjectLink } from "../utils/getProjectLink"; +import { ArticleBox } from "./ArticleBox"; export const Issue = ({ issue, hideTags, }: { - readonly issue: ProjectIssueWithProjectInfo - readonly hideTags?: boolean + readonly issue: ProjectIssueWithProjectInfo; + readonly hideTags?: boolean; }): React.JSX.Element => ( -) +); Issue.defaultProps = { hideTags: false, -} +}; diff --git a/packages/frontend/src/components/IssuesList.tsx b/packages/frontend/src/components/IssuesList.tsx index c83080b2b..220157c58 100644 --- a/packages/frontend/src/components/IssuesList.tsx +++ b/packages/frontend/src/components/IssuesList.tsx @@ -1,24 +1,24 @@ /** @jsxImportSource @emotion/react */ -import { css } from "@emotion/react" -import type React from "react" -import ReactMarkdown from "react-markdown" -import { Link } from "react-router-dom" -import remarkGfm from "remark-gfm" +import { css } from "@emotion/react"; +import type React from "react"; +import ReactMarkdown from "react-markdown"; +import { Link } from "react-router-dom"; +import remarkGfm from "remark-gfm"; -import type { Project } from "../interfaces/Project" -import type { ProjectInfo } from "../interfaces/ProjectInfo" -import type { ProjectIssue } from "../interfaces/ProjectIssue" -import type { ProjectListing } from "../interfaces/ProjectListing" -import { theme } from "../theme" -import { getIssueLink } from "../utils/getIssueLink" -import { H3 } from "./Typography" +import type { Project } from "../interfaces/Project"; +import type { ProjectInfo } from "../interfaces/ProjectInfo"; +import type { ProjectIssue } from "../interfaces/ProjectIssue"; +import type { ProjectListing } from "../interfaces/ProjectListing"; +import { theme } from "../theme"; +import { getIssueLink } from "../utils/getIssueLink"; +import { H3 } from "./Typography"; export const IssuesList = ({ issues, project, }: { - readonly issues: Array - readonly project: ProjectListing | (Project & ProjectInfo) + readonly issues: Array; + readonly project: ProjectListing | (Project & ProjectInfo); }): React.JSX.Element => ( <> {issues.map((issue) => ( @@ -60,4 +60,4 @@ export const IssuesList = ({ ))} -) +); diff --git a/packages/frontend/src/components/Layout.tsx b/packages/frontend/src/components/Layout.tsx index 07c19ef76..3134a3454 100644 --- a/packages/frontend/src/components/Layout.tsx +++ b/packages/frontend/src/components/Layout.tsx @@ -1,6 +1,6 @@ -import styled from "@emotion/styled" +import styled from "@emotion/styled"; export const Section = styled("section")` margin: 0 0 16px; padding-bottom: 24px; -` +`; diff --git a/packages/frontend/src/components/Navigation.tsx b/packages/frontend/src/components/Navigation.tsx index dd0719ee9..5181f897a 100644 --- a/packages/frontend/src/components/Navigation.tsx +++ b/packages/frontend/src/components/Navigation.tsx @@ -1,19 +1,19 @@ -import styled from "@emotion/styled" -import type React from "react" -import { NavLink } from "react-router-dom" +import styled from "@emotion/styled"; +import type React from "react"; +import { NavLink } from "react-router-dom"; -import { theme } from "../theme" +import { theme } from "../theme"; interface NavigationItem { - title: string - link: string - isActive?: boolean + title: string; + link: string; + isActive?: boolean; } export const Navigation = ({ items, }: { - readonly items: Array + readonly items: Array; }): React.JSX.Element => ( -) +); const Container = styled("div")` list-style: none; @@ -32,7 +32,7 @@ const Container = styled("div")` margin-bottom: 24px; padding: 0 16px; border-bottom: 1px solid ${theme.colors.brand}; -` +`; const NavigationLink = styled(NavLink)` display: block; @@ -47,4 +47,4 @@ const NavigationLink = styled(NavLink)` border-left: 1px solid ${theme.colors.brand}; background-color: #fff; } -` +`; diff --git a/packages/frontend/src/components/Project.tsx b/packages/frontend/src/components/Project.tsx index d76e4658b..dc0beb678 100644 --- a/packages/frontend/src/components/Project.tsx +++ b/packages/frontend/src/components/Project.tsx @@ -1,13 +1,13 @@ -import type React from "react" +import type React from "react"; -import type { ProjectListing } from "../interfaces/ProjectListing" -import { getProjectLink } from "../utils/getProjectLink" -import { ArticleBox } from "./ArticleBox" +import type { ProjectListing } from "../interfaces/ProjectListing"; +import { getProjectLink } from "../utils/getProjectLink"; +import { ArticleBox } from "./ArticleBox"; export const Project = ({ project, }: { - readonly project: ProjectListing + readonly project: ProjectListing; }): React.JSX.Element => ( -) +); diff --git a/packages/frontend/src/components/ProjectBox.tsx b/packages/frontend/src/components/ProjectBox.tsx index 0501f7a89..045959a96 100644 --- a/packages/frontend/src/components/ProjectBox.tsx +++ b/packages/frontend/src/components/ProjectBox.tsx @@ -1,6 +1,6 @@ -import styled from "@emotion/styled" +import styled from "@emotion/styled"; -import { theme } from "../theme" +import { theme } from "../theme"; export const ProjectBox = styled("div")` color: white; @@ -16,4 +16,4 @@ export const ProjectBox = styled("div")` background-color: white; color: ${theme.colors.brand}; } -` +`; diff --git a/packages/frontend/src/components/ProjectLinks.tsx b/packages/frontend/src/components/ProjectLinks.tsx index e91005bf1..e1b1f3794 100644 --- a/packages/frontend/src/components/ProjectLinks.tsx +++ b/packages/frontend/src/components/ProjectLinks.tsx @@ -1,23 +1,23 @@ -import type { ReactNode } from "react" -import type React from "react" -import { AiFillGithub } from "react-icons/ai" -import { BiBookAlt } from "react-icons/bi" -import { BsFillPersonFill } from "react-icons/bs" -import { FaFacebook, FaSlack } from "react-icons/fa" -import { GrMail } from "react-icons/gr" -import { HiOutlineDocumentText } from "react-icons/hi" -import { ImEarth } from "react-icons/im" -import { MdWebAsset } from "react-icons/md" -import { MdChecklist } from "react-icons/md" +import type { ReactNode } from "react"; +import type React from "react"; +import { AiFillGithub } from "react-icons/ai"; +import { BiBookAlt } from "react-icons/bi"; +import { BsFillPersonFill } from "react-icons/bs"; +import { FaFacebook, FaSlack } from "react-icons/fa"; +import { GrMail } from "react-icons/gr"; +import { HiOutlineDocumentText } from "react-icons/hi"; +import { ImEarth } from "react-icons/im"; +import { MdWebAsset } from "react-icons/md"; +import { MdChecklist } from "react-icons/md"; -import type { ProjectInfo, ProjectInfoLink } from "../interfaces/ProjectInfo" -import { ExtLink } from "./ExtLink" -import { Mark, Paragraph, SmallLink } from "./Typography" +import type { ProjectInfo, ProjectInfoLink } from "../interfaces/ProjectInfo"; +import { ExtLink } from "./ExtLink"; +import { Mark, Paragraph, SmallLink } from "./Typography"; export interface LinkType { - type: ProjectInfoLink["type"] - label: string - icon?: ReactNode + type: ProjectInfoLink["type"]; + label: string; + icon?: ReactNode; } export const links: Array = [ @@ -71,12 +71,12 @@ export const links: Array = [ label: "Wiki", icon: , }, -] +]; export const ProjectLinks = ({ projectInfo, }: { - readonly projectInfo: ProjectInfo + readonly projectInfo: ProjectInfo; }): React.JSX.Element => ( <> @@ -88,7 +88,7 @@ export const ProjectLinks = ({ {projectInfo.maintainers .filter( (person): person is { name: string; email: string } => - person.email !== undefined + person.email !== undefined, ) .map((person) => ( @@ -98,12 +98,12 @@ export const ProjectLinks = ({ {links.map((link) => { const currentLink = projectInfo.links.find( - (item) => item.type === link.type - ) + (item) => item.type === link.type, + ); if (!currentLink) { - return undefined + return undefined; } - const url = new URL(currentLink.uri) + const url = new URL(currentLink.uri); return ( @@ -115,7 +115,7 @@ export const ProjectLinks = ({ - ) + ); })} -) +); diff --git a/packages/frontend/src/components/ScrollToTop.tsx b/packages/frontend/src/components/ScrollToTop.tsx index 9411e8d2a..5cebac1e1 100644 --- a/packages/frontend/src/components/ScrollToTop.tsx +++ b/packages/frontend/src/components/ScrollToTop.tsx @@ -1,12 +1,12 @@ -import { useEffect } from "react" -import { useLocation } from "react-router-dom" +import { useEffect } from "react"; +import { useLocation } from "react-router-dom"; export const ScrollToTop = (): null => { - const location = useLocation() + const location = useLocation(); useEffect(() => { - window.scrollTo(0, 0) - }, [location.pathname]) + window.scrollTo(0, 0); + }, [location.pathname]); - return null -} + return null; +}; diff --git a/packages/frontend/src/components/Typography.tsx b/packages/frontend/src/components/Typography.tsx index 537f5e628..e1bb2427a 100644 --- a/packages/frontend/src/components/Typography.tsx +++ b/packages/frontend/src/components/Typography.tsx @@ -1,19 +1,19 @@ -import styled from "@emotion/styled" +import styled from "@emotion/styled"; -import { theme } from "../theme" +import { theme } from "../theme"; export const Article = styled("article")` margin: 0 0 16px; padding-bottom: 24px; border-bottom: 1px solid ${theme.colors.brand}10; -` +`; export const Paragraph = styled("p")` margin: 0 0 16px; img { max-width: 100%; } -` +`; export const Mark = styled("span")` display: flex; @@ -23,26 +23,26 @@ export const Mark = styled("span")` svg { margin-right: 0.2em; } -` +`; export const H1 = styled("h1")` color: ${theme.colors.brand}; margin: 0 0 16px; font-family: themix; font-size: 2em; -` +`; export const H2 = styled("h2")` color: ${theme.colors.brand}; margin: 0 0 12px; font-family: themix; -` +`; export const H3 = styled("h3")` color: ${theme.colors.brand}; margin: 0 0 12px; font-family: themix; -` +`; export const SmallLink = styled("span")` a { @@ -52,9 +52,9 @@ export const SmallLink = styled("span")` overflow: hidden; text-overflow: ellipsis; } -` +`; export const LargeParagraph = styled(Paragraph)` font-size: 18px; margin: 0; -` +`; diff --git a/packages/frontend/src/config.ts b/packages/frontend/src/config.ts index 289c27d46..10b599079 100644 --- a/packages/frontend/src/config.ts +++ b/packages/frontend/src/config.ts @@ -1,3 +1,3 @@ export const config = { dataApiUrl: "https://itpoptavky.skaut.cz/listings.json", -} +}; diff --git a/packages/frontend/src/globalStyles.ts b/packages/frontend/src/globalStyles.ts index 024bbcd3b..1d9fee04d 100644 --- a/packages/frontend/src/globalStyles.ts +++ b/packages/frontend/src/globalStyles.ts @@ -1,7 +1,7 @@ /** @jsxImportSource @emotion/react */ -import { css } from "@emotion/react" +import { css } from "@emotion/react"; -import { theme } from "./theme" +import { theme } from "./theme"; export const globalStyles = css` body { @@ -24,4 +24,4 @@ export const globalStyles = css` background-color: ${theme.colors.brand}; color: white; } -` +`; diff --git a/packages/frontend/src/index.tsx b/packages/frontend/src/index.tsx index 0b74bf38f..de296f931 100644 --- a/packages/frontend/src/index.tsx +++ b/packages/frontend/src/index.tsx @@ -1,17 +1,17 @@ -import React from "react" -import { createRoot } from "react-dom/client" -import { BrowserRouter as Router } from "react-router-dom" +import React from "react"; +import { createRoot } from "react-dom/client"; +import { BrowserRouter as Router } from "react-router-dom"; -import { App } from "./App" +import { App } from "./App"; -const container = document.getElementById("root") +const container = document.getElementById("root"); if (container !== null) { - const root = createRoot(container) + const root = createRoot(container); root.render( - - ) + , + ); } diff --git a/packages/frontend/src/interfaces/GlobalConfig.ts b/packages/frontend/src/interfaces/GlobalConfig.ts index 24bd4d1cd..50c9c31a1 100644 --- a/packages/frontend/src/interfaces/GlobalConfig.ts +++ b/packages/frontend/src/interfaces/GlobalConfig.ts @@ -1,5 +1,5 @@ -import type { Project } from "./Project" +import type { Project } from "./Project"; export interface GlobalConfig { - projects: Array + projects: Array; } diff --git a/packages/frontend/src/interfaces/Project.ts b/packages/frontend/src/interfaces/Project.ts index 0dc3c0d58..8c7e27c51 100644 --- a/packages/frontend/src/interfaces/Project.ts +++ b/packages/frontend/src/interfaces/Project.ts @@ -1,4 +1,4 @@ export interface Project { - owner: string - repo: string + owner: string; + repo: string; } diff --git a/packages/frontend/src/interfaces/ProjectInfo.ts b/packages/frontend/src/interfaces/ProjectInfo.ts index 1bcd38555..55aa24e78 100644 --- a/packages/frontend/src/interfaces/ProjectInfo.ts +++ b/packages/frontend/src/interfaces/ProjectInfo.ts @@ -1,37 +1,37 @@ interface ProjectInfoMaintainer { - name: string - email?: string + name: string; + email?: string; } interface ProjectInfoLinkSlack { - type: "slack" - uri: string - space: string - channel: string + type: "slack"; + uri: string; + space: string; + channel: string; } interface ProjectInfoLinkNamed { - type: "facebook-group" | "facebook-page" | "github-repo" - uri: string - name: string + type: "facebook-group" | "facebook-page" | "github-repo"; + uri: string; + name: string; } interface ProjectInfoLinkOther { - type: "demo" | "docs" | "email" | "homepage" | "issue-tracker" | "wiki" - uri: string + type: "demo" | "docs" | "email" | "homepage" | "issue-tracker" | "wiki"; + uri: string; } export type ProjectInfoLink = | ProjectInfoLinkNamed | ProjectInfoLinkOther - | ProjectInfoLinkSlack + | ProjectInfoLinkSlack; export interface ProjectInfo { - name: string - "short-description": string - description: string - maintainers: Array - links: Array - "help-issue-label"?: string - tags?: Array + name: string; + "short-description": string; + description: string; + maintainers: Array; + links: Array; + "help-issue-label"?: string; + tags?: Array; } diff --git a/packages/frontend/src/interfaces/ProjectIssue.ts b/packages/frontend/src/interfaces/ProjectIssue.ts index 66fd41033..0ae93426a 100644 --- a/packages/frontend/src/interfaces/ProjectIssue.ts +++ b/packages/frontend/src/interfaces/ProjectIssue.ts @@ -1,6 +1,6 @@ export interface ProjectIssue { - number: number - title: string - description: string - link?: string + number: number; + title: string; + description: string; + link?: string; } diff --git a/packages/frontend/src/interfaces/ProjectListing.ts b/packages/frontend/src/interfaces/ProjectListing.ts index c2e240be9..7bef61eae 100644 --- a/packages/frontend/src/interfaces/ProjectListing.ts +++ b/packages/frontend/src/interfaces/ProjectListing.ts @@ -1,8 +1,8 @@ -import type { Project } from "./Project" -import type { ProjectInfo } from "./ProjectInfo" -import type { ProjectIssue } from "./ProjectIssue" +import type { Project } from "./Project"; +import type { ProjectInfo } from "./ProjectInfo"; +import type { ProjectIssue } from "./ProjectIssue"; export type ProjectListing = Project & { - info: ProjectInfo - issues: Array -} + info: ProjectInfo; + issues: Array; +}; diff --git a/packages/frontend/src/interfaces/ProjectListings.ts b/packages/frontend/src/interfaces/ProjectListings.ts index 2017f4fa2..cf3f86240 100644 --- a/packages/frontend/src/interfaces/ProjectListings.ts +++ b/packages/frontend/src/interfaces/ProjectListings.ts @@ -1,6 +1,6 @@ -import type { GlobalConfig } from "./GlobalConfig" -import type { ProjectListing } from "./ProjectListing" +import type { GlobalConfig } from "./GlobalConfig"; +import type { ProjectListing } from "./ProjectListing"; export interface ProjectListings extends GlobalConfig { - projects: Array + projects: Array; } diff --git a/packages/frontend/src/pages/IssueDetail.tsx b/packages/frontend/src/pages/IssueDetail.tsx index 35c3d7c82..2b3260ac0 100644 --- a/packages/frontend/src/pages/IssueDetail.tsx +++ b/packages/frontend/src/pages/IssueDetail.tsx @@ -1,61 +1,61 @@ /** @jsxImportSource @emotion/react */ -import { css } from "@emotion/react" -import type React from "react" -import { AiFillGithub } from "react-icons/ai" -import ReactMarkdown from "react-markdown" -import { useParams } from "react-router-dom" -import { Link } from "react-router-dom" -import remarkGfm from "remark-gfm" +import { css } from "@emotion/react"; +import type React from "react"; +import { AiFillGithub } from "react-icons/ai"; +import ReactMarkdown from "react-markdown"; +import { useParams } from "react-router-dom"; +import { Link } from "react-router-dom"; +import remarkGfm from "remark-gfm"; -import { Button } from "../components/Button" -import { ColoredTag } from "../components/ColoredTag" -import { ExtLink } from "../components/ExtLink" -import { IssuesList } from "../components/IssuesList" -import { Section } from "../components/Layout" -import { ProjectBox } from "../components/ProjectBox" -import { ProjectLinks } from "../components/ProjectLinks" +import { Button } from "../components/Button"; +import { ColoredTag } from "../components/ColoredTag"; +import { ExtLink } from "../components/ExtLink"; +import { IssuesList } from "../components/IssuesList"; +import { Section } from "../components/Layout"; +import { ProjectBox } from "../components/ProjectBox"; +import { ProjectLinks } from "../components/ProjectLinks"; import { H1, H2, LargeParagraph, Mark, Paragraph, -} from "../components/Typography" -import type { ProjectListings } from "../interfaces/ProjectListings" -import { theme } from "../theme" -import { getIssuesWithProjectInfo } from "../utils/getAllIssues" -import { getIssueWithProject } from "../utils/getIssueWithProject" -import { getProjectLink } from "../utils/getProjectLink" +} from "../components/Typography"; +import type { ProjectListings } from "../interfaces/ProjectListings"; +import { theme } from "../theme"; +import { getIssuesWithProjectInfo } from "../utils/getAllIssues"; +import { getIssueWithProject } from "../utils/getIssueWithProject"; +import { getProjectLink } from "../utils/getProjectLink"; export const IssueDetail = ({ data, }: { - readonly data: ProjectListings + readonly data: ProjectListings; }): React.JSX.Element => { const { owner: projectOwner, project: projectRepo, issue: issueNumber, - } = useParams<{ owner: string; project: string; issue: string }>() + } = useParams<{ owner: string; project: string; issue: string }>(); const issue = getIssueWithProject( data, projectOwner, projectRepo, - Number(issueNumber) - ) + Number(issueNumber), + ); const projectIssues = getIssuesWithProjectInfo(data, { owner: projectOwner, repo: projectRepo, omitIssueNumber: issue?.number, - }) + }); if (!issue) { return (

Poptávka {projectOwner}/{projectRepo}/{issueNumber} zde není.

- ) + ); } return ( @@ -164,5 +164,5 @@ export const IssueDetail = ({ )} - ) -} + ); +}; diff --git a/packages/frontend/src/pages/IssuesList.tsx b/packages/frontend/src/pages/IssuesList.tsx index 61f02adb0..776192f07 100644 --- a/packages/frontend/src/pages/IssuesList.tsx +++ b/packages/frontend/src/pages/IssuesList.tsx @@ -1,21 +1,21 @@ /** @jsxImportSource @emotion/react */ -import type React from "react" +import type React from "react"; -import { Issue } from "../components/Issue" -import type { ProjectListings } from "../interfaces/ProjectListings" -import { getIssuesWithProjectInfo } from "../utils/getAllIssues" +import { Issue } from "../components/Issue"; +import type { ProjectListings } from "../interfaces/ProjectListings"; +import { getIssuesWithProjectInfo } from "../utils/getAllIssues"; export const IssuesList = ({ data, }: { - readonly data: ProjectListings + readonly data: ProjectListings; }): React.JSX.Element => { - const issues = getIssuesWithProjectInfo(data) + const issues = getIssuesWithProjectInfo(data); return ( <> {issues.map((issue) => ( ))} - ) -} + ); +}; diff --git a/packages/frontend/src/pages/ProjectDetail.tsx b/packages/frontend/src/pages/ProjectDetail.tsx index ad99a363b..3a3289307 100644 --- a/packages/frontend/src/pages/ProjectDetail.tsx +++ b/packages/frontend/src/pages/ProjectDetail.tsx @@ -1,37 +1,37 @@ /** @jsxImportSource @emotion/react */ -import { css } from "@emotion/react" -import type React from "react" -import ReactMarkdown from "react-markdown" -import { useParams } from "react-router-dom" -import remarkGfm from "remark-gfm" +import { css } from "@emotion/react"; +import type React from "react"; +import ReactMarkdown from "react-markdown"; +import { useParams } from "react-router-dom"; +import remarkGfm from "remark-gfm"; -import { ColoredTag } from "../components/ColoredTag" -import { IssuesList } from "../components/IssuesList" -import { Section } from "../components/Layout" -import { ProjectBox } from "../components/ProjectBox" -import { ProjectLinks } from "../components/ProjectLinks" -import { H1, LargeParagraph, Mark } from "../components/Typography" -import type { ProjectListings } from "../interfaces/ProjectListings" -import { getProject } from "../utils/getProject" +import { ColoredTag } from "../components/ColoredTag"; +import { IssuesList } from "../components/IssuesList"; +import { Section } from "../components/Layout"; +import { ProjectBox } from "../components/ProjectBox"; +import { ProjectLinks } from "../components/ProjectLinks"; +import { H1, LargeParagraph, Mark } from "../components/Typography"; +import type { ProjectListings } from "../interfaces/ProjectListings"; +import { getProject } from "../utils/getProject"; export const ProjectDetail = ({ data, }: { - readonly data: ProjectListings + readonly data: ProjectListings; }): React.JSX.Element => { const { owner: projectOwner, project: projectRepo } = useParams<{ - owner: string - project: string - issue: string - }>() - const project = getProject(data, projectOwner, projectRepo) + owner: string; + project: string; + issue: string; + }>(); + const project = getProject(data, projectOwner, projectRepo); if (!project) { return (

Projekt {projectOwner}/{projectRepo} zde není.

- ) + ); } return ( @@ -96,5 +96,5 @@ export const ProjectDetail = ({ )} - ) -} + ); +}; diff --git a/packages/frontend/src/pages/ProjectsList.tsx b/packages/frontend/src/pages/ProjectsList.tsx index a0df38d44..2ccadaa29 100644 --- a/packages/frontend/src/pages/ProjectsList.tsx +++ b/packages/frontend/src/pages/ProjectsList.tsx @@ -1,16 +1,16 @@ -import type React from "react" +import type React from "react"; -import { Project } from "../components/Project" -import type { ProjectListings } from "../interfaces/ProjectListings" +import { Project } from "../components/Project"; +import type { ProjectListings } from "../interfaces/ProjectListings"; export const ProjectsList = ({ data, }: { - readonly data: ProjectListings + readonly data: ProjectListings; }): React.JSX.Element => ( <> {data.projects.map((project) => ( ))} -) +); diff --git a/packages/frontend/src/react-app-env.d.ts b/packages/frontend/src/react-app-env.d.ts index e1d4b5583..a8ad89c17 100644 --- a/packages/frontend/src/react-app-env.d.ts +++ b/packages/frontend/src/react-app-env.d.ts @@ -1,6 +1,6 @@ /// declare module "*.svg" { - const src: string - export default src + const src: string; + export default src; } diff --git a/packages/frontend/src/theme.ts b/packages/frontend/src/theme.ts index 085e44101..112923d07 100644 --- a/packages/frontend/src/theme.ts +++ b/packages/frontend/src/theme.ts @@ -8,4 +8,4 @@ export const theme = { gray: "#999", lightGray: "#ddd", }, -} +}; diff --git a/packages/frontend/src/utils/getAllIssues.ts b/packages/frontend/src/utils/getAllIssues.ts index 1f0fb53d9..2fe0bee37 100644 --- a/packages/frontend/src/utils/getAllIssues.ts +++ b/packages/frontend/src/utils/getAllIssues.ts @@ -1,26 +1,26 @@ -import type { Project } from "../interfaces/Project" -import type { ProjectInfo } from "../interfaces/ProjectInfo" -import type { ProjectIssue } from "../interfaces/ProjectIssue" -import type { ProjectListings } from "../interfaces/ProjectListings" +import type { Project } from "../interfaces/Project"; +import type { ProjectInfo } from "../interfaces/ProjectInfo"; +import type { ProjectIssue } from "../interfaces/ProjectIssue"; +import type { ProjectListings } from "../interfaces/ProjectListings"; export interface ProjectIssueWithProjectInfo extends ProjectIssue { - project: Project & ProjectInfo + project: Project & ProjectInfo; } interface Query extends Partial { - omitIssueNumber?: number + omitIssueNumber?: number; } export const getIssuesWithProjectInfo = ( projectListings: ProjectListings, - query?: Query + query?: Query, ): Array => projectListings.projects .filter( (project) => !query || ((query.owner === undefined || query.owner === project.owner) && - (query.repo === undefined || query.repo === project.repo)) + (query.repo === undefined || query.repo === project.repo)), ) .flatMap((project) => project.issues @@ -32,5 +32,5 @@ export const getIssuesWithProjectInfo = ( repo: project.repo, ...project.info, }, - })) - ) + })), + ); diff --git a/packages/frontend/src/utils/getIssueLink.ts b/packages/frontend/src/utils/getIssueLink.ts index 2a085b870..f579e063f 100644 --- a/packages/frontend/src/utils/getIssueLink.ts +++ b/packages/frontend/src/utils/getIssueLink.ts @@ -1,4 +1,4 @@ -import type { ProjectIssueWithProjectInfo } from "./getAllIssues" +import type { ProjectIssueWithProjectInfo } from "./getAllIssues"; export const getIssueLink = (issue: ProjectIssueWithProjectInfo): string => - `/${issue.project.owner}/${issue.project.repo}/${issue.number}` + `/${issue.project.owner}/${issue.project.repo}/${issue.number}`; diff --git a/packages/frontend/src/utils/getIssueWithProject.ts b/packages/frontend/src/utils/getIssueWithProject.ts index 0c51d13da..a6e71d1f8 100644 --- a/packages/frontend/src/utils/getIssueWithProject.ts +++ b/packages/frontend/src/utils/getIssueWithProject.ts @@ -1,28 +1,28 @@ -import type { ProjectListings } from "../interfaces/ProjectListings" -import type { ProjectIssueWithProjectInfo } from "./getAllIssues" +import type { ProjectListings } from "../interfaces/ProjectListings"; +import type { ProjectIssueWithProjectInfo } from "./getAllIssues"; export const getIssueWithProject = ( projectListings: ProjectListings, projectOwner: string | undefined, projectRepo: string | undefined, - issueNumber: number + issueNumber: number, ): ProjectIssueWithProjectInfo | undefined => { const project = projectListings.projects.find( - (project) => project.owner === projectOwner && project.repo === projectRepo - ) + (project) => project.owner === projectOwner && project.repo === projectRepo, + ); if (!project) { - return + return; } - const issue = project.issues.find((issue) => issue.number === issueNumber) + const issue = project.issues.find((issue) => issue.number === issueNumber); if (!issue) { - return + return; } return { ...issue, project: { owner: project.owner, repo: project.repo, ...project.info }, - } -} + }; +}; diff --git a/packages/frontend/src/utils/getProject.ts b/packages/frontend/src/utils/getProject.ts index a1a7a89ba..18c124a37 100644 --- a/packages/frontend/src/utils/getProject.ts +++ b/packages/frontend/src/utils/getProject.ts @@ -1,11 +1,11 @@ -import type { ProjectListing } from "../interfaces/ProjectListing" -import type { ProjectListings } from "../interfaces/ProjectListings" +import type { ProjectListing } from "../interfaces/ProjectListing"; +import type { ProjectListings } from "../interfaces/ProjectListings"; export const getProject = ( projectLisstings: ProjectListings, owner: string | undefined, - repo: string | undefined + repo: string | undefined, ): ProjectListing | undefined => projectLisstings.projects.find( - (project) => project.owner === owner && project.repo === repo - ) + (project) => project.owner === owner && project.repo === repo, + ); diff --git a/packages/frontend/src/utils/getProjectLink.ts b/packages/frontend/src/utils/getProjectLink.ts index c3abb6e84..da05acfaf 100644 --- a/packages/frontend/src/utils/getProjectLink.ts +++ b/packages/frontend/src/utils/getProjectLink.ts @@ -1,4 +1,4 @@ -import type { Project } from "../interfaces/Project" +import type { Project } from "../interfaces/Project"; export const getProjectLink = ({ owner, repo }: Project): string => - `/${owner}/${repo}` + `/${owner}/${repo}`; diff --git a/packages/frontend/webpack.config.js b/packages/frontend/webpack.config.js index e88bbabd4..94e940a96 100644 --- a/packages/frontend/webpack.config.js +++ b/packages/frontend/webpack.config.js @@ -1,14 +1,14 @@ /* eslint-env node */ -const HtmlWebpackPlugin = require("html-webpack-plugin") -const TerserPlugin = require("terser-webpack-plugin") -const MiniCssExtractPlugin = require("mini-css-extract-plugin") -const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin") -const { SubresourceIntegrityPlugin } = require("webpack-subresource-integrity") +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const TerserPlugin = require("terser-webpack-plugin"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); +const { SubresourceIntegrityPlugin } = require("webpack-subresource-integrity"); module.exports = (env) => { const mode = - process.env.NODE_ENV ?? (env.development ? "development" : "production") + process.env.NODE_ENV ?? (env.development ? "development" : "production"); return { mode, @@ -74,5 +74,5 @@ module.exports = (env) => { }), ], }, - } -} + }; +};