> 이 문서는 synapse-annotator main 브랜치(2026-10-27) 기준입니다.
## TypeScript (tsconfig.json)
설정 파일은 `tsconfig.json` 하나입니다.
```json
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"moduleResolution": "node",
"experimentalDecorators": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"sourceMap": true,
"baseUrl": ".",
"resolveJsonModule": true,
"types": ["vite/client", "node", "vitest/globals"],
"paths": {
"@/*": ["src/*"],
"@aa/*": ["src/app/annotator/annotators/audio-annotator/*"],
"@app/*": ["src/app/*"],
"@assets/*": ["src/assets/*"],
"@ia/*": ["src/app/annotator/annotators/image-annotator/*"],
"@pa/*": ["src/app/annotator/annotators/pcd-annotator/*"],
"@pta/*": ["src/app/annotator/annotators/prompt-annotator/*"],
"@services/*": ["src/app/annotator/services/*"],
"@shared/*": ["src/app/shared/*"],
"@ta/*": ["src/app/annotator/annotators/text-annotator/*"],
"@va/*": ["src/app/annotator/annotators/video-annotator/*"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.tsx"],
"exclude": ["node_modules"]
}
```
- `types`: `vite/client` 는 `import.meta.env` 등 Vite 타입, `vitest/globals` 는 import 없이 쓰는 `describe`·`it`·`expect` 타입입니다.
- `paths` 는 `vite.config.js` 의 `resolve.alias` 와 같은 11개입니다. 별칭을 바꿀 때는 두 파일과 `vitest.config.js` 를 함께 고칩니다.
- `type-check`(`tsc --noEmit`)는 `.ts`·`.tsx` 만 검사합니다. `include` 에 `src/**/*.vue` 가 있지만 `tsc` 는 `.vue` 파일을 읽지 않고, `vue-tsc` 는 쓰지 않습니다. `.vue` import 의 타입은 `*.vue` 모듈 선언(shim) 파일로 처리합니다.
## ESLint (eslint.config.mjs)
ESLint 9 flat config 입니다. 배열 순서대로 적용되며 뒤 블록이 앞 블록을 덮어씁니다.
| 순서 | 블록 | 대상 | 내용 |
|------|------|------|------|
| 1 | 공통 | `**/*.{js,mjs,cjs,ts,vue}` | 전역 `browser`·`node`, `ecmaVersion: 2020`, 플러그인 `@typescript-eslint`·`perfectionist`, 아래 공통 규칙 |
| 2 | `pluginVue.configs['flat/base']` | `.vue` | Vue 파서(`vue-eslint-parser`)와 기본 규칙만. `essential`·`recommended` 프리셋은 쓰지 않습니다 |
| 3 | Vue 덮어쓰기 | `**/*.vue` | `<script>` 파서로 `@typescript-eslint/parser`, Vue 규칙 조정 |
| 4 | TypeScript | `**/*.ts` | `@typescript-eslint/parser` + `project: './tsconfig.json'` |
| 5 | `eslint-config-prettier` | 전체 | Prettier 와 겹치는 서식 규칙을 끔 |
- JS 기본 권장 규칙(`@eslint/js` 의 recommended)은 켜지 않았습니다.
- Prettier 는 ESLint 규칙으로 돌리지 않습니다(`eslint-plugin-prettier` 없음). 포맷은 `prettier` 를 따로 실행합니다(lefthook, `prettier` 스크립트).
### 공통 규칙
| 규칙 | 설정 |
|------|------|
| `perfectionist/sort-*` 20개 | `error`. 정렬 기준은 아래 표 |
| `padding-line-between-statements` | `error`. `return` 앞에 빈 줄 |
| `no-dupe-class-members` | `error` |
| `no-multiple-empty-lines` | `error`, `max: 1` (실제로는 꺼짐, 아래 참고) |
| `@typescript-eslint/no-explicit-any` | `warn` |
| `@typescript-eslint/no-unused-vars` | `warn`. `_` 로 시작하는 인자·변수·catch 변수는 제외 |
| `@typescript-eslint/explicit-function-return-type`, `explicit-module-boundary-types`, `no-non-null-assertion` | `off` |
perfectionist 공통 설정은 `type: 'line-length'`, `partitionByComment: true`(주석 줄로 구획을 나누면 구획 안에서만 정렬)입니다.
| 정렬 기준 | 규칙 (`perfectionist/` 생략) |
|-----------|------------------------------|
| 줄 길이순 (`line-length`) | `sort-imports`(명시), `sort-array-includes`, `sort-classes`, `sort-decorators`, `sort-enums`, `sort-exports`, `sort-heritage-clauses`, `sort-switch-case`, `sort-union-types` |
| 알파벳순 (`alphabetical`) | `sort-interfaces`, `sort-intersection-types`, `sort-jsx-props`, `sort-maps`, `sort-modules`, `sort-named-exports`, `sort-named-imports`, `sort-object-types`, `sort-objects`, `sort-sets`, `sort-variable-declarations` |
### Vue 규칙
| 규칙 | 설정 |
|------|------|
| `vue/no-unused-components` | `warn` |
| `vue/multiline-html-element-content-newline` | `error` (실제로는 꺼짐, 아래 참고) |
| `vue/multi-word-component-names`, `vue/no-v-html`, `vue/no-multiple-template-root`, `vue/require-default-prop` | `off` |
| `vue/attribute-hyphenation`, `vue/first-attribute-linebreak`, `vue/html-closing-bracket-spacing`, `vue/html-indent`, `vue/html-self-closing`, `vue/max-attributes-per-line`, `vue/singleline-html-element-content-newline` | `off` |
:::note[선언과 실제 값이 다른 규칙]
`no-multiple-empty-lines` 와 `vue/multiline-html-element-content-newline` 은 `error` 로 적혀 있지만, 배열 마지막의 `eslint-config-prettier` 가 두 규칙을 끄므로 실제로는 꺼져 있습니다(`eslint --print-config` 로 확인). 연속 빈 줄은 Prettier 가 하나로 줄입니다.
:::
## Prettier
**.prettierrc.json**
```json
{
"semi": false,
"trailingComma": "none",
"bracketSameLine": true,
"singleQuote": true,
"printWidth": 120
}
```
- 플러그인과 `overrides` 는 없습니다. `.vue` 는 Prettier 내장 파서로 처리합니다.
- `.prettierignore` 는 `public/`, `dist/`, `node_modules/`, `src/assets/`, 모든 `*.json`, `README.md` 등을 제외합니다. 로케일 JSON 도 Prettier 대상이 아닙니다.
## Git hooks (lefthook)
**lefthook.yml** (포맷·린트 부분)
```yaml
pre-commit:
parallel: false
commands:
format:
glob: 'src/**/*.{js,vue,tsx,ts,jsx}'
stage_fixed: true
run: node_modules/.bin/prettier --write {staged_files}
lint:
glob: 'src/**/*.{js,vue,tsx,ts,jsx}'
stage_fixed: true
run: node_modules/.bin/eslint --fix {staged_files}
```
- 커밋할 때 스테이징된 JS·TS·Vue 파일에 Prettier(`format`) → ESLint `--fix`(`lint`)를 차례로 실행하고, 고친 내용을 다시 스테이징합니다(`stage_fixed`). ESLint 오류가 남으면 커밋이 멈춥니다.
- lefthook 은 `parallel: false` 일 때 명령을 파일에 적힌 순서가 아니라 **이름의 알파벳순**으로 실행합니다. 여기서는 `format` 이 `lint` 보다 앞이라 Prettier 가 먼저 돕니다.
- lefthook 기본 glob 매처에서 `src/**/*.{...}` 는 `src/` 아래 한 단계 이상 폴더 안의 파일만 잡습니다. `src/main.js`·`src/i18n.js` 처럼 `src/` 바로 아래 파일은 훅의 포맷·린트 대상이 아닙니다(lefthook 1.13.6 으로 확인).
- 이 밖에 저장소 내부 문서 사본이 서로 같은지 보는 검사가 하나 더 있습니다.
- 훅은 `pnpm install` 뒤 `prepare` 스크립트가 `lefthook install` 로 설치합니다(CI 제외). `pnpm-workspace.yaml` 의 `ignoredBuiltDependencies` 에 `lefthook` 이 있어 패키지 자체의 설치 스크립트는 실행되지 않습니다.
## CSS / 스타일링
Tailwind CSS 4 + PostCSS + SCSS 를 씁니다. Bootstrap·BootstrapVue 패키지는 설치하지 않으며, 코드에 남은 Bootstrap 클래스는 자체 호환 SCSS 로 제공합니다([앱 엔트리포인트](/project-config/app-entry/)의 전역 CSS 참고).
**postcss.config.js**
```javascript
module.exports = {
plugins: [require('@tailwindcss/postcss'), require('autoprefixer')]
}
```
**Tailwind 진입 CSS** (앞부분)
```css
@import "tailwindcss/theme";
@import "tailwindcss/utilities";
@import './theme-variables.css';
@config "../../../tailwind.config.js";
```
- `tailwindcss` 전체가 아니라 `theme`·`utilities` 만 불러옵니다. Preflight(기본 스타일 초기화)를 불러오지 않으므로 기존 스타일이 초기화되지 않습니다.
- `@config` 로 JS 설정 파일(`tailwind.config.js`)을 함께 읽습니다.
- 같은 파일에서 `@theme` 로 surface·text 의미 색을, `@utility` 로 `btn-app`·`focus-ring`·`card-app` 같은 공용 유틸리티를 정의합니다.
- 클래스 접두사(`prefix`)는 쓰지 않습니다.
**tailwind.config.js 주요 설정**
| 키 | 값 |
|----|----|
| `content` | `./src/**/*.{vue,js,ts,jsx,tsx}`, `./public/index.html` (뒤 항목은 Webpack 시절 경로로, 지금은 해당 파일이 없습니다) |
| `darkMode` | `'class'` |
| `corePlugins.preflight` | `false`. Tailwind CSS 4 는 JS 설정의 `corePlugins` 를 지원하지 않으므로, 실제로 Preflight 를 빼는 것은 위 진입 CSS 입니다 |
| `theme.extend` | 색(`primary`·`secondary`·`success`·`danger`·`warning`·`info` 의 50~900·`hover`·`soft`, `gray`, surface 등)과 `textColor`·`backgroundColor`·`borderRadius`·`boxShadow` 는 CSS 변수(`var(--color-primary)` 등)로 참조합니다. `spacing`과 툴바 크기(`height`·`width`·`minWidth`)는 대부분 고정값입니다(`width.toolbar-button` 만 `var(--toolbar-button-width, 42px)`). `fontFamily.sans` 는 Pretendard. `fontSize` 키가 두 번 적혀 있어 뒤의 `{ 'toolbar-label': '0.8rem' }` 만 적용되고, 앞의 CSS 변수 기반 글자 크기 설정은 덮어써집니다 |
| `plugins` | `@tailwindcss/forms` |