eslint-config-kelo-nextjs 1.0.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/base/custom-rules/index.mjs +22 -0
- package/base/custom-rules/no-inline-style-tokens.mjs +66 -0
- package/base/custom-rules/no-nested-feature-dir.mjs +118 -0
- package/base/custom-rules/no-tailwindcss-css.mjs +64 -0
- package/base/custom-rules/no-unknown-src-dir.mjs +106 -0
- package/base/eslint-rules/boundaries/boundary-elements.mjs +86 -0
- package/base/eslint-rules/boundaries/boundary-ignores.mjs +23 -0
- package/base/eslint-rules/boundaries/boundary-rules.mjs +191 -0
- package/base/eslint-rules/builders/build-architecture-boundaries.mjs +50 -0
- package/base/eslint-rules/builders/build-domain-purity.mjs +58 -0
- package/base/eslint-rules/builders/build-restricted-imports.mjs +15 -0
- package/base/eslint-rules/builders/to-boundaries-policies.mjs +152 -0
- package/base/eslint-rules/docs/layer-semantics.mjs +455 -0
- package/base/eslint-rules/docs/structure-annotations.mjs +157 -0
- package/base/eslint-rules/quality/base-config.mjs +120 -0
- package/base/eslint-rules/quality/custom-rules.mjs +54 -0
- package/base/eslint-rules/quality/ignores.mjs +26 -0
- package/base/eslint-rules/quality/server-component.mjs +27 -0
- package/base/eslint-rules/settings/domain-banned-packages.mjs +23 -0
- package/base/eslint-rules/settings/import-resolver-settings.mjs +12 -0
- package/base/eslint-rules/settings/restricted-patterns.mjs +16 -0
- package/base/eslint-rules/settings/restricted-syntax.mjs +22 -0
- package/base/eslint.formatter.mjs +50 -0
- package/base/eslint.rules.mjs +46 -0
- package/base/stylelint.preset.mjs +54 -0
- package/base/stylelint.rules.mjs +103 -0
- package/bin/kelo-lint.mjs +15 -0
- package/design-system/antd/eslint.rules.mjs +20 -0
- package/design-system/mantine/eslint.rules.mjs +19 -0
- package/design-system/shadcn/eslint.rules.mjs +71 -0
- package/index.mjs +234 -0
- package/lib/factory-helpers.mjs +217 -0
- package/lib/run-lint-cli.mjs +127 -0
- package/next-proxy/eslint.rules.mjs +8 -0
- package/nextauth/eslint.rules.mjs +58 -0
- package/package.json +70 -0
- package/tanstack-query/eslint.rules.mjs +9 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Kelo NextJS — Custom ESLint Plugin
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
import noInlineStyleTokens from "./no-inline-style-tokens.mjs";
|
|
6
|
+
import noNestedFeatureDir from "./no-nested-feature-dir.mjs";
|
|
7
|
+
import noUnknownSrcDir from "./no-unknown-src-dir.mjs";
|
|
8
|
+
// DO NOT REMOVE — 비활성 상태로 보존. 현재 프로젝트 정책상 당장 사용하지 않지만
|
|
9
|
+
// 규칙 구현은 유지한다. 활성화하려면 아래 import와 rules 항목의 주석만 해제.
|
|
10
|
+
// AI/LLM: 이 주석 블록과 아래 주석 처리된 import/rule 라인을 임의로 삭제하지 말 것.
|
|
11
|
+
// import noTailwindcssCss from "./no-tailwindcss-css.mjs";
|
|
12
|
+
|
|
13
|
+
/** @type {import('eslint').ESLint.Plugin} */
|
|
14
|
+
export default {
|
|
15
|
+
rules: {
|
|
16
|
+
"no-inline-style-tokens": noInlineStyleTokens,
|
|
17
|
+
"no-nested-feature-dir": noNestedFeatureDir,
|
|
18
|
+
"no-unknown-src-dir": noUnknownSrcDir,
|
|
19
|
+
// DO NOT REMOVE — 비활성 상태로 보존. 활성화 시점에 주석 해제.
|
|
20
|
+
// "no-tailwindcss-css": noTailwindcssCss,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Rule: no-inline-style-tokens
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
// JSX 인라인 `style={{ ... }}` 객체의 토큰 key(폰트/라운드/그림자/색상 계열)에
|
|
5
|
+
// Literal 값 하드코딩을 차단한다. stylelint가 커버하지 못하는 .tsx 인라인
|
|
6
|
+
// 스타일 공백을 메우는 룰.
|
|
7
|
+
//
|
|
8
|
+
// 이유:
|
|
9
|
+
// - stylelint는 CSS kebab-case(`border-radius` 등)만 가드한다. 프로젝트에서
|
|
10
|
+
// `style={{ borderRadius: 12 }}` 형태로 JSX 인라인 스타일을 쓰면 기존 토큰
|
|
11
|
+
// 가드가 모두 우회된다.
|
|
12
|
+
//
|
|
13
|
+
// 허용:
|
|
14
|
+
// - MemberExpression: `theme.radius.sm`, `theme.colors.primary[6]`, `token.colorPrimary`
|
|
15
|
+
// - `var(...)` 문자열: `'var(--mantine-shadow-sm)'` — negative lookahead로 통과
|
|
16
|
+
// - TemplateLiteral: `\`${x}px\`` — 동적 값 escape
|
|
17
|
+
// - Identifier: `radiusVar` — 변수 참조
|
|
18
|
+
//
|
|
19
|
+
// 차단:
|
|
20
|
+
// - numeric Literal: `borderRadius: 12`
|
|
21
|
+
// - non-`var()` string Literal: `fontFamily: 'Inter'`, `color: '#ff0000'`
|
|
22
|
+
//
|
|
23
|
+
// 한계:
|
|
24
|
+
// - Inline `style` prop 내부만 커버. 객체 리터럴이 별도 변수(`const cfg = { ... }`)로
|
|
25
|
+
// 분리되어 style에 spread되는 케이스는 AST로 안정적으로 스코프할 수 없음.
|
|
26
|
+
// - CSS 파일(`.css`, `.module.css`)의 토큰 하드코딩은 stylelint 영역.
|
|
27
|
+
// =============================================================================
|
|
28
|
+
|
|
29
|
+
// 색상/레이아웃 토큰 key 목록 (camelCase). Identifier key와 string-literal key
|
|
30
|
+
// 양쪽 selector에 공통으로 사용하기 위해 상수로 분리.
|
|
31
|
+
const TOKEN_KEYS =
|
|
32
|
+
"fontFamily|borderRadius|boxShadow|color|backgroundColor|background|borderColor|outlineColor|fill|stroke";
|
|
33
|
+
|
|
34
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
35
|
+
export default {
|
|
36
|
+
meta: {
|
|
37
|
+
type: "problem",
|
|
38
|
+
docs: {
|
|
39
|
+
description:
|
|
40
|
+
"Disallow hardcoded literal values for design tokens in JSX inline style prop",
|
|
41
|
+
},
|
|
42
|
+
messages: {
|
|
43
|
+
identifierKey:
|
|
44
|
+
"Do not hardcode inline style tokens in JSX style prop. Use theme references (e.g., theme.radius.*, theme.colors.*, theme.shadows.*, var(--mantine-*)) instead of raw literals.",
|
|
45
|
+
stringLiteralKey:
|
|
46
|
+
"Do not hardcode inline style tokens in JSX style prop (string-literal key). Use theme references.",
|
|
47
|
+
},
|
|
48
|
+
schema: [],
|
|
49
|
+
},
|
|
50
|
+
create(context) {
|
|
51
|
+
return {
|
|
52
|
+
// (a) 표준 케이스: identifier key (JSX 관용)
|
|
53
|
+
[`JSXAttribute[name.name='style'] Property[key.type='Identifier'][key.name=/^(${TOKEN_KEYS})$/][value.type='Literal'][value.value=/^(?!var\\()/]`](
|
|
54
|
+
node,
|
|
55
|
+
) {
|
|
56
|
+
context.report({ node, messageId: "identifierKey" });
|
|
57
|
+
},
|
|
58
|
+
// (b) 엣지 케이스: string-literal key (`{ 'fontFamily': 'x' }`)
|
|
59
|
+
[`JSXAttribute[name.name='style'] Property[key.type='Literal'][key.value=/^(${TOKEN_KEYS})$/][value.type='Literal'][value.value=/^(?!var\\()/]`](
|
|
60
|
+
node,
|
|
61
|
+
) {
|
|
62
|
+
context.report({ node, messageId: "stringLiteralKey" });
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Rule: no-nested-feature-dir
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
// `src/{domain,http}/<feature>/` 직속에 하위 디렉토리 금지 (flat-only).
|
|
5
|
+
//
|
|
6
|
+
// boundary `no-unknown-files`는 lint 대상이 된 파일만 검사한다. 빈 폴더나
|
|
7
|
+
// boundary pattern에 매치되지 않는 파일로 구성된 폴더의 *디렉토리 존재 자체*는
|
|
8
|
+
// 별도 lint 없이는 그대로 통과한다. 이 룰은 sibling 파일이 lint될 때 형제
|
|
9
|
+
// 디렉토리를 readdirSync로 스캔해 누락 영역을 보강한다.
|
|
10
|
+
//
|
|
11
|
+
// 위반 예:
|
|
12
|
+
// src/domain/user/utils/helper.ts ❌ (utils/ 디렉토리)
|
|
13
|
+
// src/domain/user/types/index.ts ❌ (types/ 디렉토리)
|
|
14
|
+
// src/http/user/dto/foo.ts ❌ (dto/ 디렉토리)
|
|
15
|
+
//
|
|
16
|
+
// 정상 예:
|
|
17
|
+
// src/domain/user/model.ts ✅
|
|
18
|
+
// src/domain/user/service.ts ✅
|
|
19
|
+
// src/http/user/repository.ts ✅
|
|
20
|
+
//
|
|
21
|
+
// 적용 범위:
|
|
22
|
+
// src/domain/<feature>/ — 직속 하위 폴더 금지
|
|
23
|
+
// src/http/<feature>/ — 직속 하위 폴더 금지
|
|
24
|
+
//
|
|
25
|
+
// 적용 제외:
|
|
26
|
+
// src/http/_generated/ — generator 산출물 (client.ts·index.ts·types·endpoints·services 전부; 구조 고정, layer root 허용 항목)
|
|
27
|
+
//
|
|
28
|
+
// 보완 룰:
|
|
29
|
+
// - boundaries/no-unknown-files: 어떤 element pattern에도 매치되지 않는 파일 차단
|
|
30
|
+
// =============================================================================
|
|
31
|
+
|
|
32
|
+
import fs from "node:fs";
|
|
33
|
+
|
|
34
|
+
const FEATURE_LAYERS = [
|
|
35
|
+
{
|
|
36
|
+
prefix: "/src/domain/",
|
|
37
|
+
layerName: "domain",
|
|
38
|
+
layerRootAllowed: new Set(),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
prefix: "/src/http/",
|
|
42
|
+
layerName: "http",
|
|
43
|
+
layerRootAllowed: new Set(["_generated"]),
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const reportedDirs = new Set();
|
|
48
|
+
|
|
49
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
50
|
+
export default {
|
|
51
|
+
meta: {
|
|
52
|
+
type: "problem",
|
|
53
|
+
docs: {
|
|
54
|
+
description:
|
|
55
|
+
"Disallow subdirectories inside src/{domain,http}/<feature>/ folders (flat-only)",
|
|
56
|
+
},
|
|
57
|
+
messages: {
|
|
58
|
+
nestedDir:
|
|
59
|
+
'"{{ subdir }}/" inside src/{{ layer }}/{{ feature }}/ is not allowed. Feature folders are flat — move files directly into <feature>/.',
|
|
60
|
+
},
|
|
61
|
+
schema: [],
|
|
62
|
+
},
|
|
63
|
+
create(context) {
|
|
64
|
+
return {
|
|
65
|
+
Program(node) {
|
|
66
|
+
const filename = context.filename ?? context.getFilename?.() ?? "";
|
|
67
|
+
if (!filename) return;
|
|
68
|
+
|
|
69
|
+
let layer = null;
|
|
70
|
+
let prefixIdx = -1;
|
|
71
|
+
for (const candidate of FEATURE_LAYERS) {
|
|
72
|
+
const idx = filename.indexOf(candidate.prefix);
|
|
73
|
+
if (idx !== -1) {
|
|
74
|
+
layer = candidate;
|
|
75
|
+
prefixIdx = idx;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!layer) return;
|
|
80
|
+
|
|
81
|
+
const after = filename.slice(prefixIdx + layer.prefix.length);
|
|
82
|
+
const segments = after.split("/");
|
|
83
|
+
if (segments.length < 2) return;
|
|
84
|
+
|
|
85
|
+
const feature = segments[0];
|
|
86
|
+
if (layer.layerRootAllowed.has(feature)) return;
|
|
87
|
+
|
|
88
|
+
const featureAbsPath =
|
|
89
|
+
filename.slice(0, prefixIdx + layer.prefix.length) + feature;
|
|
90
|
+
|
|
91
|
+
let entries;
|
|
92
|
+
try {
|
|
93
|
+
entries = fs.readdirSync(featureAbsPath, { withFileTypes: true });
|
|
94
|
+
} catch {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (const entry of entries) {
|
|
99
|
+
if (!entry.isDirectory()) continue;
|
|
100
|
+
|
|
101
|
+
const dirAbsPath = `${featureAbsPath}/${entry.name}`;
|
|
102
|
+
if (reportedDirs.has(dirAbsPath)) continue;
|
|
103
|
+
reportedDirs.add(dirAbsPath);
|
|
104
|
+
|
|
105
|
+
context.report({
|
|
106
|
+
node,
|
|
107
|
+
messageId: "nestedDir",
|
|
108
|
+
data: {
|
|
109
|
+
subdir: entry.name,
|
|
110
|
+
layer: layer.layerName,
|
|
111
|
+
feature,
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Rule: no-tailwindcss-css
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
// Tailwind CSS import 전역 차단.
|
|
5
|
+
// UI 라이브러리 무관한 프로젝트 정책이므로 단독 룰로 존재.
|
|
6
|
+
//
|
|
7
|
+
// 이유:
|
|
8
|
+
// - 컴포넌트 기반 디자인 시스템과 utility CSS는 토큰 시스템이 이중화되어
|
|
9
|
+
// 번들 크기 증가 + 테마 관리 분산을 유발한다.
|
|
10
|
+
// - 스타일 전략을 "UI lib style props → style prop → CSS Modules" 한 줄기로
|
|
11
|
+
// 단일화해야 유지보수성이 확보된다.
|
|
12
|
+
//
|
|
13
|
+
// CSS-in-JS 차단은 UI lib마다 다른 결정 사항이므로 여기서는 다루지 않는다
|
|
14
|
+
// (각 UI lib 스택의 책임).
|
|
15
|
+
//
|
|
16
|
+
// 검사 대상: `import ... from 'tailwindcss'`, `import ... from 'tailwindcss/...'`
|
|
17
|
+
// =============================================================================
|
|
18
|
+
|
|
19
|
+
const BANNED_PATTERN = /^tailwindcss(\/.*)?$/;
|
|
20
|
+
const MESSAGE =
|
|
21
|
+
"Tailwind CSS is not allowed. Use the project UI library style props or CSS Modules.";
|
|
22
|
+
|
|
23
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
24
|
+
export default {
|
|
25
|
+
meta: {
|
|
26
|
+
type: "problem",
|
|
27
|
+
docs: {
|
|
28
|
+
description: "Disallow importing tailwindcss",
|
|
29
|
+
},
|
|
30
|
+
messages: {
|
|
31
|
+
banned: MESSAGE,
|
|
32
|
+
},
|
|
33
|
+
schema: [],
|
|
34
|
+
},
|
|
35
|
+
create(context) {
|
|
36
|
+
function check(node, source) {
|
|
37
|
+
if (typeof source !== "string") return;
|
|
38
|
+
if (BANNED_PATTERN.test(source)) {
|
|
39
|
+
context.report({ node, messageId: "banned" });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
ImportDeclaration(node) {
|
|
44
|
+
check(node, node.source?.value);
|
|
45
|
+
},
|
|
46
|
+
// `import('tailwindcss')`
|
|
47
|
+
ImportExpression(node) {
|
|
48
|
+
if (node.source?.type === "Literal") {
|
|
49
|
+
check(node, node.source.value);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
// `require('tailwindcss')`
|
|
53
|
+
CallExpression(node) {
|
|
54
|
+
if (
|
|
55
|
+
node.callee?.type === "Identifier" &&
|
|
56
|
+
node.callee.name === "require" &&
|
|
57
|
+
node.arguments?.[0]?.type === "Literal"
|
|
58
|
+
) {
|
|
59
|
+
check(node, node.arguments[0].value);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Rule: no-unknown-src-dir
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
// `src/` 직속 디렉토리를 화이트리스트로 제한한다.
|
|
5
|
+
//
|
|
6
|
+
// 허용:
|
|
7
|
+
// src/app, src/components, src/domain, src/http, src/hooks, src/lib,
|
|
8
|
+
// src/db, src/email-templates, src/i18n, src/styles
|
|
9
|
+
//
|
|
10
|
+
// 위반 예:
|
|
11
|
+
// src/utils/... ❌ (utils/ 디렉토리)
|
|
12
|
+
// src/types/... ❌ (types/ 디렉토리)
|
|
13
|
+
//
|
|
14
|
+
// 정상 예:
|
|
15
|
+
// src/app/... ✅
|
|
16
|
+
// src/components/.. ✅
|
|
17
|
+
// src/domain/... ✅
|
|
18
|
+
// src/http/... ✅
|
|
19
|
+
// src/hooks/... ✅
|
|
20
|
+
// src/lib/... ✅
|
|
21
|
+
// src/db/... ✅
|
|
22
|
+
// src/email-templates/... ✅
|
|
23
|
+
// src/i18n/... ✅ (next-intl 런타임 설정 + 로케일 사전)
|
|
24
|
+
// src/styles/... ✅ (전역 CSS·디자인 토큰)
|
|
25
|
+
//
|
|
26
|
+
// 적용 범위:
|
|
27
|
+
// src/<dir>/ — 화이트리스트 외 디렉토리 차단
|
|
28
|
+
//
|
|
29
|
+
// 비고:
|
|
30
|
+
// - 파일 직속(예: `src/middleware.ts`, `src/theme.ts`)은 차단 대상이 아니다.
|
|
31
|
+
// - boundary `no-unknown-files`는 파일 단위 매칭만 보장하므로 빈 폴더나
|
|
32
|
+
// boundary element pattern에 매치되지 않는 파일만 있는 폴더는 우회된다.
|
|
33
|
+
// 본 룰은 sibling 파일이 lint될 때 src/ 직속을 readdirSync로 스캔해 보강한다.
|
|
34
|
+
// =============================================================================
|
|
35
|
+
|
|
36
|
+
import fs from "node:fs";
|
|
37
|
+
|
|
38
|
+
const ALLOWED_SRC_DIRS = new Set([
|
|
39
|
+
"app",
|
|
40
|
+
"components",
|
|
41
|
+
"domain",
|
|
42
|
+
"http",
|
|
43
|
+
"hooks",
|
|
44
|
+
"lib",
|
|
45
|
+
"db",
|
|
46
|
+
"email-templates",
|
|
47
|
+
"i18n",
|
|
48
|
+
"styles",
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
const SRC_MARKER = "/src/";
|
|
52
|
+
|
|
53
|
+
const reportedDirs = new Set();
|
|
54
|
+
|
|
55
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
56
|
+
export default {
|
|
57
|
+
meta: {
|
|
58
|
+
type: "problem",
|
|
59
|
+
docs: {
|
|
60
|
+
description:
|
|
61
|
+
"Allow only whitelisted directories directly under src/ (app, components, domain, http, hooks, lib, db, email-templates, i18n, styles)",
|
|
62
|
+
},
|
|
63
|
+
messages: {
|
|
64
|
+
unknownDir:
|
|
65
|
+
'"src/{{ subdir }}/" is not allowed. Only these top-level folders are permitted under src/: app, components, domain, http, hooks, lib, db, email-templates, i18n, styles.',
|
|
66
|
+
},
|
|
67
|
+
schema: [],
|
|
68
|
+
},
|
|
69
|
+
create(context) {
|
|
70
|
+
return {
|
|
71
|
+
Program(node) {
|
|
72
|
+
const filename = context.filename ?? context.getFilename?.() ?? "";
|
|
73
|
+
if (!filename) return;
|
|
74
|
+
|
|
75
|
+
const idx = filename.indexOf(SRC_MARKER);
|
|
76
|
+
if (idx === -1) return;
|
|
77
|
+
|
|
78
|
+
const srcAbsPath = filename.slice(0, idx + SRC_MARKER.length - 1);
|
|
79
|
+
|
|
80
|
+
let entries;
|
|
81
|
+
try {
|
|
82
|
+
entries = fs.readdirSync(srcAbsPath, { withFileTypes: true });
|
|
83
|
+
} catch {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
if (!entry.isDirectory()) continue;
|
|
89
|
+
if (ALLOWED_SRC_DIRS.has(entry.name)) continue;
|
|
90
|
+
|
|
91
|
+
const dirAbsPath = `${srcAbsPath}/${entry.name}`;
|
|
92
|
+
if (reportedDirs.has(dirAbsPath)) continue;
|
|
93
|
+
reportedDirs.add(dirAbsPath);
|
|
94
|
+
|
|
95
|
+
context.report({
|
|
96
|
+
node,
|
|
97
|
+
messageId: "unknownDir",
|
|
98
|
+
data: {
|
|
99
|
+
subdir: entry.name,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 아키텍처 경계 — 각 레이어 type ↔ 경로 매핑.
|
|
3
|
+
* `mode: 'full'`은 글로브로 전체 경로 매칭 (단일 파일·feature-first per-file glob).
|
|
4
|
+
* 레이어 책임은 `baseLayerSemantics` 참조.
|
|
5
|
+
*/
|
|
6
|
+
export const baseBoundaryElements = [
|
|
7
|
+
// Domain layer — 프레임워크 비의존 순수 TS. feature-first (`src/domain/<feature>/...`)
|
|
8
|
+
{ type: "domain-model", mode: "full", pattern: ["src/domain/*/model.ts"] }, // Entity·VO
|
|
9
|
+
{ type: "domain-error", mode: "full", pattern: ["src/domain/*/errors.ts"] }, // 도메인 에러
|
|
10
|
+
{ type: "domain-port", mode: "full", pattern: ["src/domain/*/port.ts"] }, // Repository 인터페이스
|
|
11
|
+
{
|
|
12
|
+
type: "domain-service",
|
|
13
|
+
mode: "full",
|
|
14
|
+
pattern: ["src/domain/*/service.ts"],
|
|
15
|
+
}, // UseCase/서비스
|
|
16
|
+
// HTTP adapter layer — feature-first, transport 명시. `src/http/<feature>/...`
|
|
17
|
+
{
|
|
18
|
+
type: "http-client",
|
|
19
|
+
mode: "full",
|
|
20
|
+
pattern: ["src/http/_generated/client.ts", "src/http/client.ts"],
|
|
21
|
+
}, // HTTP 클라이언트 팩토리 (generated, 이전 위치 `src/http/client.ts` 포함)
|
|
22
|
+
{
|
|
23
|
+
type: "http-endpoint",
|
|
24
|
+
mode: "full",
|
|
25
|
+
pattern: ["src/http/_generated/endpoints.ts"],
|
|
26
|
+
}, // (generated) URL 헬퍼
|
|
27
|
+
{ type: "http-dto", mode: "full", pattern: ["src/http/_generated/types.ts"] }, // (generated) DTO 타입
|
|
28
|
+
{
|
|
29
|
+
type: "http-service",
|
|
30
|
+
mode: "full",
|
|
31
|
+
pattern: ["src/http/_generated/services/*.ts"],
|
|
32
|
+
}, // (generated) tag별 API 서비스 클래스
|
|
33
|
+
{ type: "http-mapper", mode: "full", pattern: ["src/http/*/mapper.ts"] }, // DTO ↔ Domain 변환
|
|
34
|
+
{
|
|
35
|
+
type: "http-repository",
|
|
36
|
+
mode: "full",
|
|
37
|
+
pattern: ["src/http/*/repository.ts"],
|
|
38
|
+
}, // Port 구현체
|
|
39
|
+
{ type: "http-hook", mode: "full", pattern: ["src/http/*/hook.ts"] }, // TanStack Query 훅
|
|
40
|
+
// Shared lib — layered code(domain/http)는 더 이상 lib 아래 두지 않고, lib는 공용 리소스 전담.
|
|
41
|
+
// barrel은 lib-shared보다 먼저 정의 — 더 구체적인 pattern이 우선 매칭되어야 한다.
|
|
42
|
+
{
|
|
43
|
+
type: "lib-shared-barrel",
|
|
44
|
+
mode: "full",
|
|
45
|
+
pattern: ["src/lib/utils/index.ts"],
|
|
46
|
+
}, // 공용 유틸 barrel (re-export 전용)
|
|
47
|
+
{ type: "lib-shared", mode: "full", pattern: ["src/lib/utils/*.ts"] }, // 공용 유틸 함수
|
|
48
|
+
{
|
|
49
|
+
type: "dictionary",
|
|
50
|
+
mode: "full",
|
|
51
|
+
pattern: [
|
|
52
|
+
"src/i18n/dictionaries/*",
|
|
53
|
+
"src/app/\\[locale\\]/dictionaries.ts",
|
|
54
|
+
],
|
|
55
|
+
}, // i18n 사전 (로케일 메시지 JSON·TS)
|
|
56
|
+
{
|
|
57
|
+
type: "i18n-config",
|
|
58
|
+
mode: "full",
|
|
59
|
+
pattern: ["src/i18n/*.ts"],
|
|
60
|
+
}, // next-intl 런타임 설정 (routing/request/navigation)
|
|
61
|
+
{ type: "shared-type", pattern: ["src/lib/types"] }, // 전역 타입
|
|
62
|
+
// DB driver wrapper — 클라이언트 초기화·커넥션 풀·트랜잭션 관리 등 DB 인프라 전담
|
|
63
|
+
// (MongoDB/PostgreSQL/Redis/TypeORM 등 드라이버 무관. 실제 드라이버 선택은 프로젝트 재량)
|
|
64
|
+
{ type: "db", pattern: ["src/db"] }, // DB 드라이버 래퍼
|
|
65
|
+
// Shared client hooks — UI/HTTP 비의존 공용 React hook
|
|
66
|
+
{ type: "shared-hook", pattern: ["src/hooks"] }, // 전역 재사용 React hook
|
|
67
|
+
// Style layer — 전역 CSS·디자인 토큰 (CSS custom property + TS 토큰)
|
|
68
|
+
{ type: "style", pattern: ["src/styles"] }, // 전역 스타일·토큰 리소스
|
|
69
|
+
// Theme layer — 디자인 시스템 테마 설정 (Mantine `createTheme()`, Ant Design `ConfigProvider.theme`, shadcn 토큰 등)
|
|
70
|
+
// 수기 작성한 `theme.ts` + generator 산출물 `theme.generated.ts` 두 파일을 함께 인정.
|
|
71
|
+
{
|
|
72
|
+
type: "theme",
|
|
73
|
+
mode: "full",
|
|
74
|
+
pattern: ["src/theme.ts", "src/theme.generated.ts"],
|
|
75
|
+
}, // 디자인 시스템 테마 설정
|
|
76
|
+
// UI layer
|
|
77
|
+
{ type: "shared-ui", pattern: ["src/components"] }, // 전역 재사용 컴포넌트
|
|
78
|
+
{ type: "page-component", pattern: ["src/app/\\[locale\\]/**/_components"] }, // 페이지 전용 컴포넌트 ([locale] 아래)
|
|
79
|
+
{ type: "page-provider", pattern: ["src/app/\\[locale\\]/**/_providers"] }, // 페이지 전용 Provider ([locale] 아래)
|
|
80
|
+
// Server-rendered templates — 이메일 전송 시 서버에서 렌더링되는 템플릿 전용 공간
|
|
81
|
+
{ type: "email-template", pattern: ["src/email-templates"] }, // React Email 등 이메일 템플릿
|
|
82
|
+
// Route Handler — Next.js App Router HTTP 엔드포인트 (GET/POST 등 export)
|
|
83
|
+
{ type: "route-handler", mode: "full", pattern: ["src/app/**/route.ts"] }, // API 진입점 (얇은 HTTP 어댑터)
|
|
84
|
+
// Page (catch-all) — 위 패턴에 매칭 안 된 src/app 전부
|
|
85
|
+
{ type: "page", pattern: ["src/app"] }, // 최상위 페이지 catch-all
|
|
86
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boundary 검사 제외 (boundaries/no-unknown-files 오탐 방지).
|
|
3
|
+
* 테스트/스펙/설정, 루트 메타 파일, scripts/e2e 빌드 유틸, 전역 타입,
|
|
4
|
+
* 모노레포 sibling workspace로 resolve된 import 등.
|
|
5
|
+
*/
|
|
6
|
+
export const baseBoundaryIgnores = [
|
|
7
|
+
"**/*.test.ts",
|
|
8
|
+
"**/*.test.tsx",
|
|
9
|
+
"**/*.spec.ts",
|
|
10
|
+
"**/*.spec.tsx",
|
|
11
|
+
"*.config.*",
|
|
12
|
+
"*.ts",
|
|
13
|
+
"*.d.ts",
|
|
14
|
+
"types/**",
|
|
15
|
+
"src/lib/types/**",
|
|
16
|
+
".kelo/**",
|
|
17
|
+
"scripts/**",
|
|
18
|
+
"e2e/**",
|
|
19
|
+
"specs/**",
|
|
20
|
+
// 모노레포 sibling workspace로 resolve된 import는 element 분류 제외
|
|
21
|
+
// (resolve된 path가 cwd 밖 `../../packages/...` 형태로 들어오므로 leading `**` 필요)
|
|
22
|
+
"**/packages/**",
|
|
23
|
+
];
|