Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7팀 김원표] [Chapter 2-2] 디자인 패턴과 함수형 프로그래밍 #19

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
64b44a9
🎉 패키지 설치 및 설정
pitangland Jan 13, 2025
faa243c
🔧 tsconfig 설정 추가
pitangland Jan 13, 2025
39ab380
✨ 장바구니 유틸리티 함수 구현
pitangland Jan 14, 2025
ec872e5
✨ useCart 훅 구현
pitangland Jan 14, 2025
e9cef92
🎨 코드 스타일 통일을 위해 확장자와 따옴표 변경
pitangland Jan 14, 2025
391bef4
🎨 코드 스타일 통일을 위해 확장자와 따옴표 변경
pitangland Jan 14, 2025
ce6244b
✏️ 개별 항목 및 장바구니 로직 수정
pitangland Jan 14, 2025
9ae2abc
✨ useProduct 훅 구현
pitangland Jan 14, 2025
1381b20
✨ useCoupons 훅 구현
pitangland Jan 14, 2025
951d23e
✅ basic test 통과
pitangland Jan 14, 2025
b0b7bec
🎨 CartPage 컴포넌트 분리
pitangland Jan 15, 2025
66879f2
🎨 CartPage, AdminPage 폴더 구조 변경
pitangland Jan 15, 2025
7d5ba20
🎨 ProductList 컴포넌트를 순수 함수형으로 리팩터링
pitangland Jan 15, 2025
9fbb0d6
🎨 CartList 컴포넌트를 순수 함수형으로 리팩터링
pitangland Jan 15, 2025
699a740
🎨 CouponSelector 컴포넌트에서 불필요한 return 제거
pitangland Jan 15, 2025
d6c5529
🎨 OrderSummary 컴포넌트 props 구조 변경
pitangland Jan 15, 2025
7c279e6
♻️ 비즈니스 로직 분리 및 책임 명확화
pitangland Jan 15, 2025
e3e577c
🎨 관심사 분리
pitangland Jan 15, 2025
81a3549
♻️ 장바구니 로직 리팩토링
pitangland Jan 15, 2025
a7daebd
🎨 컴포넌트 Cart 와 Admin 폴더로 구조 변경
pitangland Jan 15, 2025
9cc919c
✏️ 변수명 수정
pitangland Jan 15, 2025
90a0a0f
♻️ App 컴포넌트 리팩토링 및 관심사 분리
pitangland Jan 16, 2025
7a6e19b
🚚 훅 파일 경로 업데이트 및 내보내기 수정
pitangland Jan 16, 2025
9f51fdb
🚑 폴더명때문에 깃액션 동작안해서 수정
pitangland Jan 16, 2025
18a723c
🎨 AdminPage 컴포넌트 리팩토링 및 구조 개선
pitangland Jan 16, 2025
3946bd5
✅ discount 유틸리티 함수에 대한 테스트 코드 작성
pitangland Jan 16, 2025
4594a03
✅ useAppState 훅에 대한 테스트 코드 작성
pitangland Jan 16, 2025
d7a786a
✏️ 변수명 수정 및 주석 추가
pitangland Jan 16, 2025
fcae30e
♻️ useAdminProduct 훅 생성
pitangland Jan 16, 2025
ed6bf86
📦 jest 관련 라이브러리 설치
pitangland Jan 16, 2025
e7a9f4d
✅ useAdminProduct 훅 테스트 코드 추가
pitangland Jan 16, 2025
14d0656
♻️ useAdminCoupon 훅 생성
pitangland Jan 17, 2025
a5de7cc
✅ useAdminCoupon 훅 테스트 코드 추가
pitangland Jan 17, 2025
69f11c2
♻️ admin으로 유틸리티 함수 분리
pitangland Jan 17, 2025
bdcf462
🔧 .prettierignore 추가
pitangland Jan 17, 2025
37950e2
🎨 테스트 스타일 통일
pitangland Jan 17, 2025
a538508
♻️ 변수 재할당 방지
pitangland Jan 19, 2025
aace1df
:memo: README 문서 수정
pitangland Jan 20, 2025
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
115 changes: 115 additions & 0 deletions .eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import typescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import prettier from 'eslint-config-prettier';
import compat from 'eslint-plugin-compat';
import jest from 'eslint-plugin-jest';
import node from 'eslint-plugin-node';
import eslintPluginPrettier from 'eslint-plugin-prettier';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import security from 'eslint-plugin-security';
import sonarjs from 'eslint-plugin-sonarjs';
import unicorn from 'eslint-plugin-unicorn';
import globals from 'globals';

export default [
{
ignores: ['**/node_modules/**', 'dist/**'], // 구성 개체가 적용되지 않아야 하는 파일을 나타내는 glob패턴, 지정하지 않으면 모든 파일에 적용
},
sonarjs.configs.recommended,
{
files: ['**/*.{js,jsx,ts,tsx}'], // 구성 개체가 적용되어야 하는 피일을 나타는 glob패턴, 지정하지 않으면 모든 파일에 적용
languageOptions: {
ecmaVersion: 'latest', // 지원할 ECMAScript 버전 기본 값은 'latest'
sourceType: 'module', // js 소스코드의 유형, ECMAScript의 모듈일 경우 'module', Commonjs인 경우 'commonjs'
globals: {
// linting 중 전역 범위에 추가되어야하는 추가 개체를 지정
...globals.browser,
...globals.es2021,
},
parser: typescriptParser, // parse() 또는 parseForESLint() 메서드를 포함하는 객체, 기본 값은 'espree', 추가적으로 레거시 프로젝트에서는 babel로 되어있는 parser일 수 있음
parserOptions: {
// parse() 또는 parseForESLint() 메서드에 직접 전달되는 추가 옵션을 지정
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
// 플러그인 개체를 매핑
prettier: eslintPluginPrettier,
react,
'react-hooks': reactHooks,
'@typescript-eslint': typescript,
compat,
jest,
security,
unicorn,
node,
},
settings: {
// 모든 규칙에 사용할 수 있는 정보의 key-value 쌍이 포함된 객체
react: {
version: 'detect',
},
},
rules: {
// 구성된 규칙이 포함된 객체, files가 지정되면 포함된 파일만 검사
// Prettier 통합 규칙
'prettier/prettier': 'error', // Prettier 포맷팅 오류를 ESLint 에러로 표시

// React 관련 규칙
'react/prop-types': 'off', // TypeScript 사용 시 prop-types 검사를 비활성화
'react/react-in-jsx-scope': 'off', // React 17+에서는 필요 없음
'react-hooks/rules-of-hooks': 'error', // 훅 사용 시 규칙 강제
'react-hooks/exhaustive-deps': 'warn', // useEffect 의존성 배열 검증

// TypeScript 관련 규칙
'@typescript-eslint/no-explicit-any': 'warn', // any 사용 최소화
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' }, // 사용하지 않는 변수 중 '_'로 시작하는 인자는 무시
],

// 최신 JavaScript 스타일 규칙
'prefer-const': 'error', // 가능하면 const 사용
'no-var': 'error', // var 사용 금지
'arrow-body-style': ['error', 'as-needed'], // 필요할 때만 중괄호 사용
'object-shorthand': 'error', // 객체 속성 단축 표기법 사용
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }], // 빈 줄 제한

// 코드 안전성 및 문제 방지
eqeqeq: ['error', 'always'], // 항상 === 사용
'no-console': ['warn', { allow: ['warn', 'error'] }], // console.log는 경고
'no-debugger': 'warn', // 디버거 사용 경고
'no-unused-vars': 'off', // TypeScript 규칙으로 대체
'no-undef': 'off', // TypeScript 환경에서 처리

// Test (Jest) 관련 규칙
'jest/no-disabled-tests': 'warn', // 비활성화된 테스트 경고
'jest/no-focused-tests': 'error', // 단일 테스트 실행 방지
'jest/no-identical-title': 'error', // 동일 제목 테스트 방지
'jest/prefer-to-have-length': 'warn', // `.length` 확인 권장
'jest/valid-expect': 'error', // 올바른 `expect` 사용 보장

// 브라우저 호환성 (Compat) 규칙
'compat/compat': 'warn', // 브라우저 호환성 문제 경고

// 보안 관련 규칙 (Security)
'security/detect-object-injection': 'warn', // 객체 속성 주입 방지
'security/detect-non-literal-require': 'warn', // 동적 require 경고
'security/detect-eval-with-expression': 'error', // eval 사용 금지

// 코드 품질 향상 (SonarJS)
'sonarjs/cognitive-complexity': 'warn', // 복잡도 제한
'sonarjs/no-identical-expressions': 'warn', // 동일한 표현식 방지
'sonarjs/pseudo-random': 'warn', // 난수 사용 경고

// 모던 JavaScript (Unicorn)
'unicorn/prefer-module': 'error', // ESM 모듈 사용
'unicorn/prefer-ternary': 'error', // 삼항 연산자 권장
'unicorn/prefer-node-protocol': 'error', // Node.js URL 모듈 프로토콜 사용
},
},
prettier, // Prettier 충돌 방지
];
18 changes: 0 additions & 18 deletions .eslintrc.cjs

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/origin
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"semi": true,
"singleQuote": true,
"jsxSingleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"printWidth": 100,
"endOfLine": "auto"
}
Loading
Loading