From 42ca60c02656dd833c9d0c766012755380e89092 Mon Sep 17 00:00:00 2001 From: Alie Date: Sat, 27 Apr 2024 18:17:56 +0200 Subject: [PATCH] fmt --- .eslintrc.cjs | 18 ++++++++-------- Dockerfile | 2 +- index.html | 15 ++++++++++---- init-mongo.js | 12 +++++------ src/components/Button/Button.tsx | 8 ++++---- src/main.tsx | 10 ++++----- test/unit/ImageModerator.test.tsx | 34 ++++++++++++++++--------------- vite.config.ts | 8 ++++---- 8 files changed, 57 insertions(+), 50 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index d6c9537..6e8698b 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -2,17 +2,17 @@ module.exports = { root: true, env: { browser: true, es2020: true }, extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:react-hooks/recommended', + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:react-hooks/recommended", ], - ignorePatterns: ['dist', '.eslintrc.cjs'], - parser: '@typescript-eslint/parser', - plugins: ['react-refresh'], + ignorePatterns: ["dist", ".eslintrc.cjs"], + parser: "@typescript-eslint/parser", + plugins: ["react-refresh"], rules: { - 'react-refresh/only-export-components': [ - 'warn', + "react-refresh/only-export-components": [ + "warn", { allowConstantExport: true }, ], }, -} +}; diff --git a/Dockerfile b/Dockerfile index b2d0803..70716be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,4 @@ COPY . /temp/prod/ RUN cd /temp/prod && bun run build FROM nginx AS release -COPY --from=install /temp/prod/dist /usr/share/nginx/html \ No newline at end of file +COPY --from=install /temp/prod/dist /usr/share/nginx/html diff --git a/index.html b/index.html index e4b78ea..f27b914 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,20 @@ - + - - + + Vite + React + TS
- + diff --git a/init-mongo.js b/init-mongo.js index c883274..f0b1f55 100644 --- a/init-mongo.js +++ b/init-mongo.js @@ -1,10 +1,10 @@ db = new Mongo().getDB("bot"); -db.createCollection('authorizations'); +db.createCollection("authorizations"); db.authorizations.insert([ - { - app: "tester", - secret: "test" - } -]) \ No newline at end of file + { + app: "tester", + secret: "test", + }, +]); diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 05eb252..f308fb9 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -1,8 +1,8 @@ export interface ButtonProps { - label: string; - action?: () => void; + label: string; + action?: () => void; } export default function ImageViewer(props: ButtonProps) { - return -} \ No newline at end of file + return ; +} diff --git a/src/main.tsx b/src/main.tsx index a4d5ce7..eb0a604 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,7 +1,5 @@ -import ReactDOM from 'react-dom/client' -import App from './App.tsx' -import './index.css' +import ReactDOM from "react-dom/client"; +import App from "./App.tsx"; +import "./index.css"; -ReactDOM.createRoot(document.getElementById('root')!).render( - -) +ReactDOM.createRoot(document.getElementById("root")!).render(); diff --git a/test/unit/ImageModerator.test.tsx b/test/unit/ImageModerator.test.tsx index fc65179..d79fbfb 100644 --- a/test/unit/ImageModerator.test.tsx +++ b/test/unit/ImageModerator.test.tsx @@ -1,29 +1,31 @@ import React from "react"; import { render, screen } from "@testing-library/react"; import { describe, expect, it } from "bun:test"; -import ImageModerator, { ImageModeratorProps } from '../../src/components/ImageModerator/ImageModerator'; +import ImageModerator, { + ImageModeratorProps, +} from "../../src/components/ImageModerator/ImageModerator"; const properties: ImageModeratorProps = { - acceptLabel: "Accept", - discardLabel: "Discard" -} + acceptLabel: "Accept", + discardLabel: "Discard", +}; it("should render into the document", () => { - render(); + render(); }); it("should show a new image when accept button is clicked", () => { - const acceptButton = screen.getByText(properties.acceptLabel); - const imgElement = screen.getByRole("img"); - const imgElementSrcBefore = imgElement.getAttribute("src"); - acceptButton.click(); - expect(imgElement.getAttribute("src")).not.toEqual(imgElementSrcBefore); + const acceptButton = screen.getByText(properties.acceptLabel); + const imgElement = screen.getByRole("img"); + const imgElementSrcBefore = imgElement.getAttribute("src"); + acceptButton.click(); + expect(imgElement.getAttribute("src")).not.toEqual(imgElementSrcBefore); }); it("should show a new image when discard button is clicked", () => { - const discardButton = screen.getByText(properties.discardLabel); - const imgElement = screen.getByRole("img"); - const imgElementSrcBefore = imgElement.getAttribute("src"); - discardButton.click(); - expect(imgElement.getAttribute("src")).not.toEqual(imgElementSrcBefore); -}); \ No newline at end of file + const discardButton = screen.getByText(properties.discardLabel); + const imgElement = screen.getByRole("img"); + const imgElementSrcBefore = imgElement.getAttribute("src"); + discardButton.click(); + expect(imgElement.getAttribute("src")).not.toEqual(imgElementSrcBefore); +}); diff --git a/vite.config.ts b/vite.config.ts index f3d53be..d366e8c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,7 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react-swc' +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react-swc"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react()] -}) \ No newline at end of file + plugins: [react()], +});