Skip to content

Commit

Permalink
config: 프로젝트 재구성
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooorobo committed Jun 5, 2024
1 parent cd5e6e2 commit dd57f35
Show file tree
Hide file tree
Showing 70 changed files with 11,215 additions and 9,087 deletions.
98 changes: 81 additions & 17 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,84 @@
/**
* This is intended to be a basic starting point for linting in your app.
* It relies on recommended configs out of the box for simplicity, but you can
* and should modify this configuration to best suit your team's needs.
*/

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
"plugin:@conarti/feature-sliced/recommended"
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@conarti/feature-sliced/public-api': ['off']
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},
}
ignorePatterns: ["!**/.server", "!**/.client"],

// Base config
extends: ["eslint:recommended"],

overrides: [
// React
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: ["react", "jsx-a11y"],
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
],
settings: {
react: {
version: "detect",
},
formComponents: ["Form"],
linkComponents: [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" },
],
"import/resolver": {
typescript: {},
},
},
},

// Typescript
// {
// files: ["**/*.{ts,tsx}"],
// plugins: ["@typescript-eslint", "import"],
// parser: "@typescript-eslint/parser",
// settings: {
// "import/internal-regex": "^~/",
// "import/resolver": {
// node: {
// extensions: [".ts", ".tsx"],
// },
// typescript: {
// alwaysTryTypes: true,
// },
// },
// },
// extends: [
// "plugin:@typescript-eslint/recommended",
// "plugin:import/recommended",
// "plugin:import/typescript",
// ],
// },

// Node
{
files: [".eslintrc.cjs"],
env: {
node: true,
},
},
],
};
40 changes: 3 additions & 37 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,40 +1,6 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# Dependencies
node_modules
.pnp
.pnp.js

# Local env files
/.cache
/build
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Testing
coverage

# Turbo
.turbo

# Vercel
.vercel

# Build Outputs
.next/
out/
build
dist


# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Misc
.DS_Store
*.pem

.idea
.idea
Empty file removed .npmrc
Empty file.
76 changes: 0 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +0,0 @@
## 실행 방법

```sh
npm i
npm run dev
```

## 프로젝트 구성

FSD를 차용하여 레이어 > 슬라이스 > 세그먼트 구조로 구성

### 레이어 구조

- `apps`
- `web`
- `webview`
- `mobile-app`
- `packages`
- `lib`
- `pages`
- `widgets`
- `features`
- `entities`
- `shared`
- `configs`

#### 각 레이어의 역할

- `apps`
- 애플리케이션 전체를 관리
- 외부와의 연결을 담당
- `pages`
- widgets를 조합하여 한 document에 그려줄 전체 화면을 구성
- 외부에서 데이터를 가져와 UI에 주입 (ex. persist store, 외부 API 등)
- 전역 상태 관리
- (주의) 상세한 UI 구조나 비즈니스 로직에 대해 너무 많이 알지 않도록 할 것
- `widgets`
- features, entities를 조합하여 페이지의 한 섹션을 구성
- `features`
- 데이터 변경을 발생시키는 사용자 액션과 관련된 비즈니스 로직 관리
- `entities`
- 비즈니스 엔티티 모델, 데이터 구조와 관련된 로직 및 UI
- (주의) 액션과 관련된 데이터가 포함되면 안 됨
- `shared`
- config - 프로젝트 공통 설정
- util - 도메인 의존성이 없는 순수 함수
- ui - 도메인 의존성이 없는 UI 컴포넌트

### 슬라이스 네이밍

- 디렉토리 네이밍: `packages/{layer-name}/{slice-name}`

**규칙**

- 단어 사이 구분이 필요할 경우 `-`를 사용한다

### `Entities` 세그먼트 구조

각 세그먼트는 모두 optional임

- `api`: API 호출 함수를 정의
- `__mocks__`: API 호출 함수에 대한 mock 데이터 정의
- `lib`: 비즈니스 로직 정의
- `model`: 비즈니스 엔티티 모델 정의 (TS Type, Zod Schema 등)
- `ui`: 리액트 컴포넌트 & 스타일

### 규칙

- 각 레이어의 슬라이스는 패키지로 구성한다
- 슬라이스는 하위 레이어의 슬라이스가 내보내는 모듈만 참조할 수 있다
- (entities 추가 규칙) 슬라이스의 `@x` 디렉토리에서 내보내는 모듈은 같은 레이어의 슬라이스가 참조할 수
있다 ([참고](https://github.com/noveogroup-amorgunov/nukeapp/blob/main/docs/en/architecture.md#entities-cross-imports))
- (widgets 추가 규칙) `Base`로 시작되는 슬라이스는 다른 슬라이스에서 참조할 수
있다 ([참고](https://github.com/noveogroup-amorgunov/nukeapp/blob/main/docs/en/architecture.md#Widgets-cross-imports-custom-sublayers))
- 각 슬라이스는 `index.ts` 파일에 내보낼 모듈을 정의해야 한다
- 일반적으로 슬라이스 외부에서는 `index.ts` 파일을 통해 내보내진 모듈만 참조 가능하다
Empty file removed apps/web/.gitignore
Empty file.
105 changes: 0 additions & 105 deletions apps/web/app/entry.server.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions apps/web/app/root.css.ts

This file was deleted.

17 changes: 0 additions & 17 deletions apps/web/app/routes/_index.tsx

This file was deleted.

Loading

0 comments on commit dd57f35

Please sign in to comment.