Skip to content

Commit

Permalink
fix: vuls
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-apprentice committed Dec 1, 2024
1 parent 128802d commit 25578ae
Show file tree
Hide file tree
Showing 11 changed files with 6,179 additions and 9,689 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ COPY src ./src
COPY public ./public
COPY tsconfig.json .
COPY vite.config.ts .
COPY .eslintrc.cjs .
COPY index.html .

RUN npm run lint
RUN npm run build

FROM node:alpine3.20 as prod-runner
Expand Down
5 changes: 3 additions & 2 deletions .eslintrc.cjs → eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
export default [{
ignores: ["node_modules/**"],
env: {
browser: true,
es2021: true,
Expand All @@ -20,4 +21,4 @@ module.exports = {
'@typescript-eslint/semi': 1,
},
include: ['src/**/*'],
}
}]
15,736 changes: 6,113 additions & 9,623 deletions package-lock.json

Large diffs are not rendered by default.

66 changes: 34 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@
"private": true,
"type": "module",
"dependencies": {
"@chakra-ui/icons": "^2.0.11",
"@chakra-ui/react": "^1.8.8",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"apisauce": "^2.1.5",
"framer-motion": "^6.3.3",
"i18next": "^21.9.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^11.18.6",
"react-icons": "^4.3.1",
"react-router-dom": "^6.4.2"
"@chakra-ui/icons": "^2.2.4",
"@chakra-ui/react": "^3.2.2",
"@emotion/react": "^11.13.5",
"@emotion/styled": "^11.13.5",
"apisauce": "3.1.0",
"framer-motion": "^11.12.0",
"i18next": "^24.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^15.1.3",
"react-icons": "^5.3.0",
"react-router-dom": "^7.0.1"
},
"scripts": {
"prebuild": "rm -rf dist",
"lint": "eslint . --ext .ts,.tsx --fix",
"prettier": "prettier --write .",
"lint": "eslint ./src/**/*.ts",
"lint:fix": "eslint ./src/**/*.ts --fix",
"format": "prettier --check ./src/**/*.ts",
"format:fix": "prettier --write ./src/**/*.ts",
"dev": "vite",
"build": "tsc && vite build",
"serve": "vite preview"
Expand All @@ -43,23 +45,23 @@
]
},
"devDependencies": {
"@types/node": "^18.11.3",
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"@vitejs/plugin-react": "^2.1.0",
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard-with-typescript": "^23.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.5.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.31.10",
"prettier": "2.7.1",
"typescript": "^4.8.4",
"vite": "^3.1.8",
"vite-plugin-svgr": "^2.2.2",
"vite-tsconfig-paths": "^3.5.2"
"@types/node": "^22.10.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-react": "^7.37.2",
"prettier": "3.4.1",
"typescript": "^5.7.2",
"vite": "^6.0.1",
"vite-plugin-svgr": "^4.3.0",
"vite-tsconfig-paths": "^5.1.3"
}
}
2 changes: 1 addition & 1 deletion src/components/section/images/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Images = ({ images, tags, onChange }: ImagesProps) => {
{images &&
images.map(
(image: { url: string | undefined }, index) => (
<Box>
<Box key={index}>
<Image
key={index}
objectFit="cover"
Expand Down
1 change: 1 addition & 0 deletions src/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const DefaultLayout: React.FC<RouteProps> = ({ route }: RouteProps) => {
api.userApi
.getUserInfo(token)
.then((response) => setUser(response as IUser))
.catch((error) => console.error(error))
}
}
}, [user])
Expand Down
1 change: 0 additions & 1 deletion src/services/base/apiProblem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export function getGeneralApiProblem(
): GeneralApiProblem | void {
switch (response.problem) {
case 'CONNECTION_ERROR':
return { kind: 'cannot-connect', temporary: true }
case 'NETWORK_ERROR':
return { kind: 'cannot-connect', temporary: true }
case 'TIMEOUT_ERROR':
Expand Down
21 changes: 11 additions & 10 deletions src/views/account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ export const AccountView = () => {

useEffect(() => {
const isLogged = useCheckToken()
if (isLogged) {
if (token) {
api.userApi
.getUserInfo(token)
.then((response) => setUser(response as IUser))
}
} else {
if (!isLogged) {
window.location.href = '/login'
}

if (token) {
api.userApi
.getUserInfo(token)
.then((response) => setUser(response as IUser))
.catch((error) => console.error(error))
}

}, [api.api.token, image])

return (
Expand All @@ -35,9 +37,8 @@ export const AccountView = () => {
onClick={() => {
api.userApi
.updateUserInfo(user?.id as string, image as File)
.then((response: any) =>
setImage(response?.picture)
)
.then((response: any) => setImage(response?.picture))
.catch((error) => console.error(error))
}}
/>
}
Expand Down
6 changes: 3 additions & 3 deletions src/views/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export const Home: React.FC = (): React.ReactElement => {
}

useEffect(() => {
obtainWaifu().then((waifus) => {
setWaifu(waifus)
})
obtainWaifu()
.then((waifus) => setWaifu(waifus))
.catch((error) => console.log(error))
}, [])

return (
Expand Down
19 changes: 10 additions & 9 deletions src/views/images/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ export const ImagesView = () => {
}, [api.api.token])

useEffect(() => {
obtainTags().then((tag) => {
setTags(tag)
})
obtainWaifu(waifusPerFetch).then((waifus) => {
setWaifu(waifus)
})
obtainTags()
.then((tag) => setTags(tag))
.catch((error) => console.log(error))

obtainWaifu(waifusPerFetch)
.then((waifus) => setWaifu(waifus))
.catch((error) => console.log(error))
}, [])

return (
Expand All @@ -49,9 +50,9 @@ export const ImagesView = () => {
onChange={async (e: {
target: { value: string | number }
}) =>
await obtainWaifu(waifusPerFetch, +e.target.value).then(
(waifus: IImage[]) => setWaifu(waifus)
)
await obtainWaifu(waifusPerFetch, +e.target.value)
.then((waifus: IImage[]) => setWaifu(waifus))
.catch((error) => console.log(error))
}
tags={tags}
images={waifu}
Expand Down

0 comments on commit 25578ae

Please sign in to comment.