Skip to content

Commit

Permalink
Autoformat files
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanl21 committed Oct 29, 2023
1 parent 590a0ca commit 1cf2662
Show file tree
Hide file tree
Showing 17 changed files with 62 additions and 62 deletions.
32 changes: 16 additions & 16 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
},
};
6 changes: 3 additions & 3 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
'on':
"on":
push:
branches:
- main
Expand All @@ -14,8 +14,8 @@ jobs:
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_RETRORATINGS }}'
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_RETRORATINGS }}"
channelId: live
projectId: retroratings
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
'on': pull_request
"on": pull_request
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_RETRORATINGS }}'
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_RETRORATINGS }}"
projectId: retroratings
env:
FIREBASE_CLI_EXPERIMENTS: webframeworks
2 changes: 1 addition & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ addRating(id, ratingVal)
});
```

The average rating of a rating item will be updated whenever a user creates, updates, or deletes a rating.
The average rating of a rating item will be updated whenever a user creates, updates, or deletes a rating.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" href="public/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="public/favicon.ico" type="image/x-icon" />
<title>RetroRatings</title>
</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ProfilePage } from "./components/ProfilePage";

function App() {
const [authActionType, setAuthActionType] = useState<"signup" | "signin">(
"signin"
"signin",
);

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down Expand Up @@ -137,7 +137,7 @@ function App() {
onClick={() => {
if (auth) {
alert(
'You\'re already logged in!\n(Sign out in the "Profile" tab)'
'You\'re already logged in!\n(Sign out in the "Profile" tab)',
);
} else {
openModal();
Expand Down
6 changes: 3 additions & 3 deletions src/components/AddNewItemCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type AddNewItemFormInput = {
type OnFormSubmitHandlerType = (
item: string,
description: string,
image: File
image: File,
) => Promise<void | FirebaseError>;

/**
Expand All @@ -49,15 +49,15 @@ export const AddNewItemCard = (props: AddNewItemCardProps) => {

// Function called when the form is submitted
const onAddNewItemFormSubmit: SubmitHandler<AddNewItemFormInput> = async (
data
data,
) => {
// call the callback handler from props if it exists
if (props.OnFormSubmit) {
props
.OnFormSubmit(
DOMPurify.sanitize(data.itemName),
DOMPurify.sanitize(data.description),
data.image[0]
data.image[0],
)
.then(() => {
setModalHeader("Success");
Expand Down
8 changes: 4 additions & 4 deletions src/components/AuthCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const AuthCard = ({ ...props }: AuthProps) => {
//formState: { errors },
} = useForm<BasicEmailFormInput>();
const onBasicLoginFormSubmit: SubmitHandler<BasicEmailFormInput> = async (
data
data,
) => {
if (props.actionType === "signup") {
await createUserWithEmailAndPassword(data.email, data.password);
Expand Down Expand Up @@ -97,7 +97,7 @@ export const AuthCard = ({ ...props }: AuthProps) => {
useSignInWithGoogle(fAuth);
const [signInWithGitHub, githubUser, githubLoading, githubError] =
useSignInWithGithub(fAuth);

const [authState, authStateLoading, authStateError] = useAuthState(fAuth);

const [showPassword, setShowPassword] = useState(false);
Expand All @@ -110,10 +110,10 @@ export const AuthCard = ({ ...props }: AuthProps) => {

const cb = props.onAuthenticated;
useEffect(() => {
if(authState && cb){
if (authState && cb) {
cb();
}
}, [authState, cb])
}, [authState, cb]);

return (
<>
Expand Down
3 changes: 1 addition & 2 deletions src/components/RatingPickerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Rating } from "react-simple-star-rating";
import { useState } from "react";
import { FirebaseError } from "firebase/app";


interface RatingPickerCardProps {
id: string;
name: string;
Expand All @@ -14,7 +13,7 @@ interface RatingPickerCardProps {
rating: number;
OnRatingChanged: (
id: string,
rating: number
rating: number,
) => Promise<void | FirebaseError>;
}

Expand Down
6 changes: 4 additions & 2 deletions src/components/TierList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "./tierlist.css";

const getTierImages = (
ratings: Array<{ url: string; rating: number }>,
tier: number
tier: number,
) => {
return ratings
.filter((rating) => Math.round(rating.rating) === tier)
Expand All @@ -35,7 +35,9 @@ export const TierList = ({ ...props }: TierListProps) => {
<Table striped bordered hover>
<thead>
<tr>
<td colSpan={2}><h2>{nameDisplay}'s ratings</h2></td>
<td colSpan={2}>
<h2>{nameDisplay}'s ratings</h2>
</td>
</tr>
</thead>
<tbody>
Expand Down
6 changes: 3 additions & 3 deletions src/components/tierlist.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
td {
vertical-align: middle;
vertical-align: middle;
}

tr {
line-height: 85px;
}
line-height: 85px;
}
15 changes: 7 additions & 8 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import './index.css'
import 'bootstrap/dist/css/bootstrap.min.css';
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
import "bootstrap/dist/css/bootstrap.min.css";


ReactDOM.createRoot(document.getElementById('root')!).render(
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
);
4 changes: 2 additions & 2 deletions src/tasks/addItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import DOMPurify from "dompurify";
export const addRatingItem = async (
itemName: string,
description: string,
image: File
image: File,
) => {
try {
let result = null;
if (auth.currentUser) {
const imageName = DOMPurify.sanitize(
`${nanoid()}.${image.name.split(".").pop()}`
`${nanoid()}.${image.name.split(".").pop()}`,
);
const imageRef = ref(storage, `/rating-items-images/${imageName}`);
result = await uploadBytes(imageRef, image);
Expand Down
10 changes: 5 additions & 5 deletions src/tasks/getRatingItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export const getRatingItem = async (id: string) => {
};

export const getRatingItemImage = async (id: string) => {
const item = await getRatingItem(id);
if(item){
return Promise.resolve({id: id, url: item.image});
}
const item = await getRatingItem(id);
if (item) {
return Promise.resolve({ id: id, url: item.image });
}

return Promise.reject();
return Promise.reject();
};
2 changes: 1 addition & 1 deletion src/tasks/getUserRatings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { auth, db } from "../config/firebase";

export type UserRatings = {
[itemId: string]: number;
}
};

/**
* @brief Gets a user's ratings
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/setRating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const setRating = async (ratingItemId: string, ratingValue: number) => {
await setDoc(
userRatingsRef,
{ [ratingItemId]: ratingValue },
{ merge: true }
{ merge: true },
);

// calculate the new average rating
Expand Down
8 changes: 4 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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()],
base: "/"
})
base: "/",
});

0 comments on commit 1cf2662

Please sign in to comment.