Skip to content

Commit

Permalink
feat: Chrry-pick #11
Browse files Browse the repository at this point in the history
  • Loading branch information
Legitgoons authored and BangDori committed Apr 19, 2024
1 parent 44a1be3 commit 963ad24
Show file tree
Hide file tree
Showing 14 changed files with 1,014 additions and 34 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/shared/mocks/*
55 changes: 54 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,65 @@ module.exports = {
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh', '@tanstack/query'],
plugins: [
'react-refresh',
'@tanstack/query',
'fsd-import',
'import',
'react',
],
settings: {
'import/resolver': {
alias: {
map: [['@', '@public', './src']],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
},
},
},
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'no-var': 'error',
'no-multiple-empty-lines': 'error',
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
eqeqeq: 'error',
'dot-notation': 'error',
'no-unused-vars': 'error',
'react/jsx-no-useless-fragment': 'error',
'react/react-in-jsx-scope': 'off',
'fsd-import/fsd-relative-path': 'error',
'fsd-import/public-api-imports': 'error',
'fsd-import/layer-imports': 'error',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'parent', 'sibling', 'index'],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before',
},
{
pattern: 'react-router-dom',
group: 'external',
position: 'before',
},
{
pattern: '@/**/*',
group: 'parent',
position: 'before',
},
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
globals: {
...vitest.environments.env.globals,
Expand Down
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "🐶 Running lint-staged..."
yarn lint-front
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@

> 💡 FSD Architecture를 커스텀하여 사용합니다.
- widgets, features, entities 3단계를 통합해 components단계로 설정하였습니다.
- widgets, features, entities 3단계를 통합해 features단계로 설정하였습니다.
<div align="center">
<img src="https://github.com/Legitgoons/Legitgoons/assets/101088491/99d1490e-7066-41cf-8f8a-70326627ea1f" width="600">
<img src="https://github.com/CollaBu/pennyway-client-webview/assets/101088491/9f247ff1-9fe3-4d84-98e5-de1ebfa70180" width="600">
</div>
<br/>

Expand Down
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"test": "vitest --passWithNoTests"
"test": "vitest --passWithNoTests",
"postinstall": "husky",
"lint-front": "lint-staged"
},
"dependencies": {
"@tanstack/react-query": "^5.25.0",
Expand All @@ -32,10 +34,16 @@
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-fsd-import": "^0.0.12",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"eslint-plugin-vitest": "^0.4.1",
"husky": "^8.0.0",
"jsdom": "^24.0.0",
"lint-staged": "^15.2.2",
"msw": "^2.2.13",
"prettier": "^3.2.5",
"sass": "1.71.1",
Expand All @@ -47,5 +55,9 @@
"workerDirectory": [
"public"
]
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --fix",
"*.{js,jsx,ts,tsx,css,md}": "prettier --write"
}
}
3 changes: 2 additions & 1 deletion src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { RouterProvider } from 'react-router-dom';
import { QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { RouterProvider } from 'react-router-dom';

import { queryClient } from './providers/query-client';
import { router } from './routers/index';

Expand Down
1 change: 1 addition & 0 deletions src/app/layout/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Outlet } from 'react-router-dom';

import FNB from '@/shared/ui/FNB/FNB';

export default function RootLayout() {
Expand Down
1 change: 1 addition & 0 deletions src/app/routers/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createBrowserRouter, RouteObject } from 'react-router-dom';

import RootLayout from '../layout/RootLayout.tsx';

const root: RouteObject[] = [
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ReactDOM from 'react-dom/client';

import App from './app/App';

async function enableMocking() {
Expand Down
9 changes: 4 additions & 5 deletions src/setupTest.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import '@testing-library/jest-dom/vitest';
import * as matchers from '@testing-library/jest-dom/matchers';
import { beforeAll, afterAll, afterEach, expect } from 'vitest';

// jest-dom의 matchers를 vitest 테스트 환경에 추가
expect.extend(matchers);

// 테스트용 Mocking 서버 설정
import { setupServer } from 'msw/node';
import { beforeAll, afterAll, afterEach, expect } from 'vitest';

import { likeHandlers } from './app/mocks/handler/like';

expect.extend(matchers);

export const server = setupServer(...likeHandlers);

beforeAll(() => server.listen({ onUnhandledRequest: 'error' }));
Expand Down
2 changes: 1 addition & 1 deletion src/shared/tests/setup.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactElement } from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render as testRender } from '@testing-library/react';
import { ReactElement } from 'react';
import { MemoryRouter } from 'react-router-dom';

function customRender(children: ReactElement, baseEntries?: string[]) {
Expand Down
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'vitest/config';
import path from 'path';

import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';

// https://vitejs.dev/config/
export default defineConfig({
Expand Down
Loading

0 comments on commit 963ad24

Please sign in to comment.