Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/fe-code-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Frontend Lint Check

on:
pull_request:
branches: [dev/fe]
paths:
- "src/frontend/**"
push:
branches: [dev/fe]
paths:
- "src/frontend/**"

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
cache-dependency-path: "./src/frontend/yarn.lock"

- name: Install Dependencies
working-directory: ./src/frontend
run: yarn install --frozen-lockfile

- name: Run ESLint
working-directory: ./src/frontend
run: yarn lint --max-warnings=0

- name: Run Type Check
working-directory: ./src/frontend
run: yarn typecheck

- name: Run Prettier Check
working-directory: ./src/frontend
run: yarn format
7 changes: 6 additions & 1 deletion src/frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import reactHooks from 'eslint-plugin-react-hooks'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
import tanstackPlugin from '@tanstack/eslint-plugin-query'
import unusedImports from 'eslint-plugin-unused-imports'
import reactPlugin from 'eslint-plugin-react'

export default tseslint.config(
{ ignores: ['dist', 'node_modules', '**/*.config.js', '!**/eslint.config.js'] },
Expand Down Expand Up @@ -37,10 +38,14 @@ export default tseslint.config(
'simple-import-sort': simpleImportSort,
'@typescript-eslint': tseslint.plugin,
onlyWarn,
tanstack: tanstackPlugin
tanstack: tanstackPlugin,
react: reactPlugin
},
rules: {
...reactHooks.configs.recommended.rules,
'no-console': ['error', { allow: ['warn', 'error'] }],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'import/no-anonymous-default-export': 'off',
'prettier/prettier': 'error',
'unused-imports/no-unused-imports': 'error',
Expand Down
11 changes: 9 additions & 2 deletions src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
"dev": "vite dev",
"start": "vite",
"typecheck": "tsc",
"test": "vitest",
"check": "yarn formatter && yarn lint:fix",
"lint": "eslint \"src/**/*.{ts,tsx}\"",
"lint:fix": "eslint --fix \"src/**/*.{ts,tsx}\"",
"formatter": "prettier --write \"src/**/*.{ts,tsx}\"",
"format": "prettier --check \"src/**/*.{ts,tsx}\"",
"format:fix": "prettier --write \"src/**/*.{ts,tsx}\"",
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
Expand Down Expand Up @@ -42,25 +45,29 @@
"devDependencies": {
"@chromatic-com/storybook": "^3.2.4",
"@eslint/js": "^9.17.0",
"@mswjs/socket.io-binding": "^0.1.1",
"@storybook/addon-essentials": "^8.5.0",
"@storybook/addon-interactions": "^8.5.0",
"@storybook/addon-onboarding": "^8.5.0",
"@storybook/react": "^8.5.0",
"@storybook/react-vite": "^8.5.0",
"@storybook/test": "^8.5.0",
"@tanstack/eslint-plugin-query": "^5.66.1",
"@testing-library/react": "^16.2.0",
"@types/node": "^20",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.1",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.17.0",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-storybook": "^0.11.2",
"eslint-plugin-unused-imports": "^4.1.4",
"globals": "^15.14.0",
"jsdom": "^26.0.0",
"msw": "^2.7.1",
"prettier": "^3.4.2",
"sharp": "^0.33.5",
Expand Down
43 changes: 36 additions & 7 deletions src/frontend/src/__mock__/data/auth.mock.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,48 @@
import { CommonResponseType } from '@/apis/schema/types/common'
import { LoginResponseSchema } from '@/apis/schema/types/auth'

export const registerMock: CommonResponseType<{ id: string; name: string }> = {
code: 'AUTH100',
message: 'Register OK',
export const statusCheckMock = {
code: 'AUTH109',
message: 'login status check success!',
result: {
id: '1',
name: 'John Doe'
status: true
}
}

export const loginMock: CommonResponseType<{ accessToken: string }> = {
export const registerMock = {
code: 'AUTH104',
message: 'register success!'
}

export const loginMock: LoginResponseSchema = {
code: 'AUTH100',
message: 'Login OK',
result: {
accessToken:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNzQwMzcwODQ5LCJleHAiOjE3NDAzNzA4NTl9.7bQ_NfH38iBCJIJVzlnrH5WepVBh1vrpaC3sOgfWWRM',
refreshToken:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNzQwMzcwODQ5LCJleHAiOjE3NDAzNzA4NTl9.7bQ_NfH38iBCJIJVzlnrH5WepVBh1vrpaC3sOgfWWRM'
}
}

export const logoutMock = { code: 'AUTH101', message: 'Logout success!' }

export const refreshTokenMock = {
code: 'AUTH102',
message: 'refresh success',
result: {
accessToken:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNzQwMzcwODQ5LCJleHAiOjE3NDAzNzA4NTl9.7bQ_NfH38iBCJIJVzlnrH5WepVBh1vrpaC3sOgfWWRM',
refreshToken:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNzQwMzcwODQ5LCJleHAiOjE3NDAzNzA4NTl9.7bQ_NfH38iBCJIJVzlnrH5WepVBh1vrpaC3sOgfWWRM'
}
}

export const verifyTokenMock = {
code: 'AUTH105',
message: 'token verify success!'
}

export const healthCheckMock = {
code: 'AUTH108',
message: 'health check success!'
}
Loading