@txstack/dev-guide 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @txstack/dev-guide
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9983a34: 설정 프리셋을 더했다 — `@txstack/dev-guide/prettier` · `/commitlint` · `/lint-staged` · `/eslint`(`base` · `react` · `node`). 도구와 플러그인은 선택 peer 라 쓰는 것만 설치한다. `jsx-a11y` recommended 를 켠다(의도된 예외는 그 줄에서 끄고 이유를 적는다). `.prettierignore` 템플릿과 커밋 훅 내용을 더했다.
8
+
9
+ ## 0.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - npm 의 홈페이지 링크가 문서 사이트의 Dev Guide 페이지(`https://code7004.github.io/txstack/docs/dev-guide`)로 간다. 내용은 바뀌지 않았다.
14
+
3
15
  ## 0.1.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -76,6 +76,54 @@ cp "$G/verification.md" "docs/verification/$n.md"
76
76
  **공통 규칙은 패키지를 참조하고, 프로젝트별 예외만 기록하세요.** 규칙을 프로젝트 문서에 복사해 관리하면
77
77
  패키지를 업데이트해도 변경 사항이 반영되지 않습니다.
78
78
 
79
+ ## 설정 프리셋
80
+
81
+ prettier · eslint · commitlint · lint-staged 설정을 그대로 가져다 쓸 수 있습니다. 규칙의 뜻은 `rules/` 문서와 같습니다.
82
+ 도구와 플러그인은 **선택 peer** 라 쓰는 것만 설치하면 됩니다 — 문서만 쓰는 프로젝트는 아무것도 더 받지 않습니다.
83
+
84
+ ```sh
85
+ pnpm add -D prettier
86
+ pnpm add -D @commitlint/cli @commitlint/config-conventional
87
+ pnpm add -D lint-staged husky
88
+ pnpm add -D eslint @eslint/js typescript-eslint typescript globals eslint-config-prettier eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-refresh eslint-plugin-jsx-a11y
89
+ ```
90
+
91
+ ```js
92
+ // prettier.config.js
93
+ export { default } from "@txstack/dev-guide/prettier";
94
+ ```
95
+
96
+ ```js
97
+ // commitlint.config.mjs
98
+ export { default } from "@txstack/dev-guide/commitlint";
99
+ ```
100
+
101
+ ```js
102
+ // lint-staged.config.mjs
103
+ export { default } from "@txstack/dev-guide/lint-staged";
104
+ ```
105
+
106
+ eslint 는 조각으로 제공합니다. 앱 폴더 이름은 프로젝트마다 다르므로 `react` · `node` 에 경로를 넘기고,
107
+ 프로젝트 고유의 규칙은 그 아래에 둡니다. 다르게 적용한 규칙은 `00_DEV_GUIDE_DIFF.md` 에도 이유와 함께 기록하세요.
108
+
109
+ ```js
110
+ // eslint.config.js
111
+ import { base, react, node } from "@txstack/dev-guide/eslint";
112
+
113
+ export default [...base({ ignores: ["vendor/**"] }), ...react({ files: ["apps/web/**/*.{ts,tsx}"] }), ...node({ files: ["apps/api/**/*.ts", "scripts/**/*.mjs"] })];
114
+ ```
115
+
116
+ | 조각 | 담는 것 |
117
+ | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
118
+ | `base()` | 무시 경로 · `@eslint/js` · `typescript-eslint` recommended · 공통 TS 규칙 · `*.d.ts` 완화 · 설정 파일과 스크립트의 Node 전역 · `eslint-config-prettier` |
119
+ | `react()` | 브라우저 전역 · `react` · `react-hooks` · `react-refresh` · `jsx-a11y` recommended(`anchor-is-valid` · `alt-text` 제외) — 의도된 예외는 그 줄에서 끄고 이유를 적습니다 |
120
+ | `node()` | Node 전역 — 규칙은 `base` 그대로 |
121
+
122
+ 무시할 파일 목록은 프리셋으로 줄 수 없어(prettier 가 패키지에서 읽지 않습니다) [templates/prettierignore](templates/prettierignore) 를
123
+ 저장소 루트의 `.prettierignore` 로 복사합니다. 커밋 훅(`.husky/pre-commit` · `commit-msg`)의 내용은 [rules/commits.md](rules/commits.md) 5장에 있습니다.
124
+
125
+ UI 컴포넌트를 고르는 규칙(원시 `<button>` 경고 등)은 포함하지 않습니다 — `@txstack/ui` 의 AI Guide 가 제공합니다.
126
+
79
127
  ## 업데이트하기
80
128
 
81
129
  패키지를 업데이트하면 AI 도구가 참조하는 개발 규칙도 함께 바뀝니다. 규칙이 바뀌는 업데이트는
@@ -130,6 +178,7 @@ cp "$G/verification.md" "docs/verification/$n.md"
130
178
  | [CURRENT.md](templates/CURRENT.md) | 저장소 루트 `CURRENT.md` |
131
179
  | [CLAUDE.md](templates/CLAUDE.md) | 저장소 루트 `CLAUDE.md` · `AGENTS.md` |
132
180
  | [DEV_GUIDE_DIFF.md](templates/DEV_GUIDE_DIFF.md) | `docs/rules/00_DEV_GUIDE_DIFF.md` |
181
+ | [prettierignore](templates/prettierignore) | 저장소 루트 `.prettierignore` |
133
182
 
134
183
  ## 제공 범위
135
184
 
@@ -138,6 +187,4 @@ cp "$G/verification.md" "docs/verification/$n.md"
138
187
 
139
188
  UI 컴포넌트 선택과 사용 규칙은 `@txstack/ui` 의 AI Guide(`ai/rules.md`)에서 별도로 제공합니다.
140
189
 
141
- ESLint · Prettier · commitlint 설정 프리셋은 현재 제공하지 않습니다. 후속 단계에서 검토할 예정입니다.
142
-
143
190
  MIT
@@ -0,0 +1,21 @@
1
+ /**
2
+ * `@txstack/dev-guide/commitlint` — 커밋 메시지 프리셋. 규칙의 뜻은 `rules/commits.md`.
3
+ *
4
+ * // commitlint.config.mjs
5
+ * export { default } from "@txstack/dev-guide/commitlint";
6
+ *
7
+ * Conventional Commits 를 따르되, 한글 제목과 표 · 목록이 든 본문을 막지 않는다.
8
+ * `@commitlint/cli` · `@commitlint/config-conventional` 은 프로젝트가 설치한다.
9
+ */
10
+ const config = {
11
+ extends: ["@commitlint/config-conventional"],
12
+ rules: {
13
+ // 제목은 한글로 쓴다 — 대소문자 규칙이 뜻이 없다
14
+ "subject-case": [0],
15
+ // 본문 · 푸터에 표 · 목록 · 링크를 쓴다
16
+ "body-max-line-length": [0],
17
+ "footer-max-line-length": [0]
18
+ }
19
+ };
20
+
21
+ export default config;
@@ -0,0 +1,114 @@
1
+ /**
2
+ * `@txstack/dev-guide/eslint` — eslint 9 flat config 조각.
3
+ *
4
+ * // eslint.config.js
5
+ * import { base, react, node } from "@txstack/dev-guide/eslint";
6
+ *
7
+ * export default [
8
+ * ...base({ ignores: ["vendor/**"] }),
9
+ * ...react({ files: ["apps/web/**\/*.{ts,tsx}"] }),
10
+ * ...node({ files: ["apps/api/**\/*.ts"] })
11
+ * // 프로젝트 고유의 것은 그 아래에
12
+ * ];
13
+ *
14
+ * 앱 폴더 이름은 프로젝트마다 다르므로 `react` · `node` 는 경로를 받는다.
15
+ * 도구와 플러그인은 프로젝트가 설치한다(선택 peer) — 이 파일을 import 할 때만 불러온다.
16
+ *
17
+ * UI 부품을 고르는 규칙(`react/forbid-elements`)은 여기 없다. `@txstack/ui` 의 `ai/rules.md` 가 갖는다.
18
+ */
19
+ import js from "@eslint/js";
20
+ import prettier from "eslint-config-prettier";
21
+ import jsxA11y from "eslint-plugin-jsx-a11y";
22
+ import reactPlugin from "eslint-plugin-react";
23
+ import reactHooks from "eslint-plugin-react-hooks";
24
+ import reactRefresh from "eslint-plugin-react-refresh";
25
+ import globals from "globals";
26
+ import tseslint from "typescript-eslint";
27
+
28
+ /** @typedef {import("eslint").Linter.Config} Config */
29
+
30
+ /**
31
+ * 모든 저장소의 바탕 — ignores · `@eslint/js` · `typescript-eslint` recommended · 공통 TS 규칙 ·
32
+ * `*.d.ts` 완화 · 설정 파일 · 스크립트에 Node 전역 · 맨 끝에 `eslint-config-prettier`.
33
+ *
34
+ * @param {{ ignores?: string[] }} [options] 더 무시할 경로 (`vendor/**` 등)
35
+ * @returns {Config[]}
36
+ */
37
+ export function base({ ignores = [] } = {}) {
38
+ return [
39
+ { ignores: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/coverage/**", "**/.temp/**", ...ignores] },
40
+ js.configs.recommended,
41
+ ...tseslint.configs.recommended,
42
+ {
43
+ files: ["**/*.{ts,tsx,mts,cts}"],
44
+ rules: {
45
+ // 타입 검사가 맡는다 — 함수 오버로드 · 전역 타입을 eslint 가 잘못 잡는다
46
+ "no-redeclare": "off",
47
+ "no-undef": "off",
48
+ "no-unused-vars": "off",
49
+ // _ 접두사는 "일부러 안 쓴다" 는 표시다. `const { a: _a, ...rest } = x` 로 필드를 빼는 관용구도 허용한다
50
+ "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_", ignoreRestSiblings: true }],
51
+ "@typescript-eslint/no-explicit-any": "warn",
52
+ "@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "separate-type-imports" }],
53
+ "@typescript-eslint/no-empty-object-type": "off",
54
+ "@typescript-eslint/triple-slash-reference": "off",
55
+ "@typescript-eslint/ban-ts-comment": "off",
56
+ "@typescript-eslint/no-unused-expressions": ["error", { allowShortCircuit: true, allowTernary: true, allowTaggedTemplates: true }],
57
+ "no-constant-condition": "off"
58
+ }
59
+ },
60
+ {
61
+ // 선언 파일은 앰비언트 계약이라 쓰지 않는 이름과 any 가 자연스럽다
62
+ files: ["**/*.d.ts"],
63
+ rules: { "@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-explicit-any": "off" }
64
+ },
65
+ {
66
+ files: ["**/*.config.{js,mjs,cjs,ts,mts,cts}", "**/scripts/**/*.{js,mjs,cjs,ts,mts}"],
67
+ languageOptions: { globals: { ...globals.node } }
68
+ },
69
+ prettier
70
+ ];
71
+ }
72
+
73
+ /**
74
+ * React 화면 — 브라우저 전역 · `react` · `react-hooks` · `react-refresh` · `jsx-a11y`.
75
+ *
76
+ * @param {{ files: string[] }} options React 코드가 있는 경로 (`apps/web/**\/*.{ts,tsx}` 등)
77
+ * @returns {Config[]}
78
+ */
79
+ export function react({ files }) {
80
+ return [
81
+ {
82
+ files,
83
+ languageOptions: {
84
+ parserOptions: { ecmaFeatures: { jsx: true } },
85
+ globals: { ...globals.browser }
86
+ },
87
+ plugins: { react: reactPlugin, "react-hooks": reactHooks, "react-refresh": reactRefresh, "jsx-a11y": jsxA11y },
88
+ settings: { react: { version: "detect" } },
89
+ rules: {
90
+ // 접근성 규칙은 recommended 그대로(오류). 의도된 예외는 그 줄에서 끄고 이유를 적는다
91
+ ...jsxA11y.flatConfigs.recommended.rules,
92
+ // 라우터 링크를 <a> 로 그리는 부품과 장식 이미지가 흔하다 — 이 둘만 끈다
93
+ "jsx-a11y/anchor-is-valid": "off",
94
+ "jsx-a11y/alt-text": "off",
95
+ "react/react-in-jsx-scope": "off",
96
+ "react/jsx-key": "error",
97
+ "react/prop-types": "off",
98
+ "react-hooks/rules-of-hooks": "error",
99
+ "react-hooks/exhaustive-deps": "error",
100
+ "react-refresh/only-export-components": "off"
101
+ }
102
+ }
103
+ ];
104
+ }
105
+
106
+ /**
107
+ * Node 코드 — 서버 · 워커 · 스크립트. 전역만 바꾸고 규칙은 `base` 그대로다.
108
+ *
109
+ * @param {{ files: string[] }} options Node 코드가 있는 경로 (`apps/api/**\/*.ts` 등)
110
+ * @returns {Config[]}
111
+ */
112
+ export function node({ files }) {
113
+ return [{ files, languageOptions: { globals: { ...globals.node } } }];
114
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `@txstack/dev-guide/lint-staged` — 커밋할 때 스테이징한 파일만 고친다. 훅은 `rules/commits.md` 5장.
3
+ *
4
+ * // lint-staged.config.mjs
5
+ * export { default } from "@txstack/dev-guide/lint-staged";
6
+ *
7
+ * 전체 검사(`pnpm check`)는 여기 두지 않는다 — 느리면 사람이 훅을 끈다.
8
+ */
9
+ const config = {
10
+ "*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}": ["eslint --fix", "prettier --write"],
11
+ "*.{json,md,mdx,css,scss,yaml,yml}": ["prettier --write"]
12
+ };
13
+
14
+ export default config;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@txstack/dev-guide/prettier` — 포맷 프리셋.
3
+ *
4
+ * // prettier.config.js
5
+ * export { default } from "@txstack/dev-guide/prettier";
6
+ *
7
+ * 줄 폭은 넓게 두고 줄바꿈은 사람이 정한다. 큰따옴표 · 끝 쉼표 없음.
8
+ * 무시할 파일은 프리셋으로 줄 수 없다(prettier 가 패키지에서 읽지 않는다) — `templates/prettierignore` 를 복사한다.
9
+ *
10
+ * @type {import("prettier").Config}
11
+ */
12
+ const config = {
13
+ printWidth: 250,
14
+ singleQuote: false,
15
+ semi: true,
16
+ trailingComma: "none"
17
+ };
18
+
19
+ export default config;
package/llms.txt CHANGED
@@ -27,6 +27,14 @@
27
27
  - [templates/CURRENT.md](templates/CURRENT.md): 저장소 루트 — 지금 상태 · 다음 할 일
28
28
  - [templates/CLAUDE.md](templates/CLAUDE.md): 저장소 루트 — AI 도구가 먼저 읽는 문서
29
29
  - [templates/DEV_GUIDE_DIFF.md](templates/DEV_GUIDE_DIFF.md): docs/rules/00_DEV_GUIDE_DIFF.md — dev-guide 와 다른 점
30
+ - [templates/prettierignore](templates/prettierignore): .prettierignore — 프리셋으로 줄 수 없는 무시 목록
31
+
32
+ ## 설정 프리셋
33
+
34
+ - [config/eslint.js](config/eslint.js): `@txstack/dev-guide/eslint` — base() · react({ files }) · node({ files }) 조각. eslint 9 flat config
35
+ - [config/prettier.js](config/prettier.js): `@txstack/dev-guide/prettier` — printWidth 250 · 큰따옴표 · semi · 끝 쉼표 없음
36
+ - [config/commitlint.js](config/commitlint.js): `@txstack/dev-guide/commitlint` — config-conventional + 한글 제목 · 긴 본문 허용
37
+ - [config/lint-staged.js](config/lint-staged.js): `@txstack/dev-guide/lint-staged` — 코드는 eslint --fix · prettier --write, 나머지는 prettier --write
30
38
 
31
39
  ## 버전
32
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@txstack/dev-guide",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Shared development guide — script naming, code and commit rules, a document-driven workflow (requirements → plans → verification → reports) and document templates",
5
5
  "keywords": [
6
6
  "conventions",
@@ -16,8 +16,9 @@
16
16
  "url": "git+https://github.com/code7004/txstack.git",
17
17
  "directory": "packages/dev-guide"
18
18
  },
19
- "homepage": "https://github.com/code7004/txstack/tree/main/packages/dev-guide#readme",
19
+ "homepage": "https://code7004.github.io/txstack/docs/dev-guide",
20
20
  "bugs": "https://github.com/code7004/txstack/issues",
21
+ "type": "module",
21
22
  "files": [
22
23
  "README.md",
23
24
  "CHANGELOG.md",
@@ -25,9 +26,14 @@
25
26
  "llms.txt",
26
27
  "rules",
27
28
  "process",
28
- "templates"
29
+ "templates",
30
+ "config"
29
31
  ],
30
32
  "exports": {
33
+ "./prettier": "./config/prettier.js",
34
+ "./commitlint": "./config/commitlint.js",
35
+ "./lint-staged": "./config/lint-staged.js",
36
+ "./eslint": "./config/eslint.js",
31
37
  "./llms.txt": "./llms.txt",
32
38
  "./rules/*": "./rules/*",
33
39
  "./process/*": "./process/*",
@@ -36,6 +42,67 @@
36
42
  "./CHANGELOG.md": "./CHANGELOG.md",
37
43
  "./README.md": "./README.md"
38
44
  },
45
+ "peerDependencies": {
46
+ "prettier": ">=3",
47
+ "eslint": ">=9",
48
+ "@eslint/js": ">=9",
49
+ "typescript-eslint": ">=8",
50
+ "globals": ">=15",
51
+ "eslint-config-prettier": ">=9",
52
+ "eslint-plugin-react": ">=7",
53
+ "eslint-plugin-react-hooks": ">=5",
54
+ "eslint-plugin-react-refresh": ">=0.4",
55
+ "eslint-plugin-jsx-a11y": ">=6",
56
+ "@commitlint/config-conventional": ">=19"
57
+ },
58
+ "peerDependenciesMeta": {
59
+ "prettier": {
60
+ "optional": true
61
+ },
62
+ "eslint": {
63
+ "optional": true
64
+ },
65
+ "@eslint/js": {
66
+ "optional": true
67
+ },
68
+ "typescript-eslint": {
69
+ "optional": true
70
+ },
71
+ "globals": {
72
+ "optional": true
73
+ },
74
+ "eslint-config-prettier": {
75
+ "optional": true
76
+ },
77
+ "eslint-plugin-react": {
78
+ "optional": true
79
+ },
80
+ "eslint-plugin-react-hooks": {
81
+ "optional": true
82
+ },
83
+ "eslint-plugin-react-refresh": {
84
+ "optional": true
85
+ },
86
+ "eslint-plugin-jsx-a11y": {
87
+ "optional": true
88
+ },
89
+ "@commitlint/config-conventional": {
90
+ "optional": true
91
+ }
92
+ },
93
+ "devDependencies": {
94
+ "prettier": "^3.5.3",
95
+ "eslint": "^9.39.1",
96
+ "@eslint/js": "^9.39.1",
97
+ "typescript-eslint": "^8.48.0",
98
+ "globals": "^16.5.0",
99
+ "eslint-config-prettier": "^10.1.8",
100
+ "eslint-plugin-react": "^7.37.5",
101
+ "eslint-plugin-react-hooks": "^7.0.1",
102
+ "eslint-plugin-react-refresh": "^0.4.24",
103
+ "eslint-plugin-jsx-a11y": "^6.10.2",
104
+ "@commitlint/config-conventional": "^20.5.0"
105
+ },
39
106
  "publishConfig": {
40
107
  "access": "public"
41
108
  }
package/rules/commits.md CHANGED
@@ -59,3 +59,15 @@ chore: txstack 을 link 대신 npm 배포본(^0.1.2)으로 설치한다
59
59
 
60
60
  - 전체 검사(`pnpm check`)는 훅에 두지 않는다. 느리면 사람이 훅을 끈다
61
61
  - 훅을 건너뛰지 않는다(`--no-verify` 금지). 훅이 실패하면 원인을 고친다
62
+
63
+ 설정은 `@txstack/dev-guide/lint-staged` · `@txstack/dev-guide/commitlint` 프리셋을 쓴다 (README 「설정 프리셋」). 훅 파일은 이렇게 둔다.
64
+
65
+ ```sh
66
+ # .husky/pre-commit
67
+ pnpm lint-staged
68
+ ```
69
+
70
+ ```sh
71
+ # .husky/commit-msg
72
+ pnpm exec commitlint --edit "$1"
73
+ ```
@@ -0,0 +1,7 @@
1
+ # 저장소 루트의 .prettierignore 로 복사한다 — prettier 는 패키지의 프리셋에서 무시 목록을 읽지 않는다
2
+ node_modules/
3
+ dist/
4
+ build/
5
+ coverage/
6
+ pnpm-lock.yaml
7
+ *.tgz