diff options
| author | Shu Ding <g@shud.in> | 2026-04-14 20:37:17 +0900 |
|---|---|---|
| committer | Shu Ding <g@shud.in> | 2026-04-14 20:37:17 +0900 |
| commit | dc8367e6f91c022d83361f03c3313fa05e848ee5 (patch) | |
| tree | 02a7c57f14a6cda38e194d4d763ca370270982a8 | |
| parent | 6938f37b6302cae3045138f2c2fe227d8165db69 (diff) | |
update exampleshu/rBVLn
| -rw-r--r-- | packages/react-best-practices-build/test-cases.json | 4 | ||||
| -rw-r--r-- | skills/react-best-practices/AGENTS.md | 7 | ||||
| -rw-r--r-- | skills/react-best-practices/rules/bundle-analyzable-paths.md | 7 |
3 files changed, 4 insertions, 14 deletions
diff --git a/packages/react-best-practices-build/test-cases.json b/packages/react-best-practices-build/test-cases.json index 050e67d..02ce981 100644 --- a/packages/react-best-practices-build/test-cases.json +++ b/packages/react-best-practices-build/test-cases.json @@ -179,7 +179,7 @@ "ruleId": "", "ruleTitle": "Prefer Statically Analyzable Paths", "type": "bad", - "code": "const CONTENT_DIRS = {\n blog: 'content/blog',\n docs: 'content/docs',\n} as const\n\nconst baseDir = path.join(process.cwd(), CONTENT_DIRS[contentKind])", + "code": "const baseDir = path.join(process.cwd(), 'content/' + contentKind)", "language": "ts", "description": "a 2-value enum still hides the final path from static analysis" }, @@ -1111,4 +1111,4 @@ "language": "tsx", "description": "serializes only 1 field" } -]
\ No newline at end of file +] diff --git a/skills/react-best-practices/AGENTS.md b/skills/react-best-practices/AGENTS.md index 7fb9fb2..4e340a5 100644 --- a/skills/react-best-practices/AGENTS.md +++ b/skills/react-best-practices/AGENTS.md @@ -622,12 +622,7 @@ const Page = await PAGE_MODULES[pageName]() **Incorrect: a 2-value enum still hides the final path from static analysis** ```ts -const CONTENT_DIRS = { - blog: 'content/blog', - docs: 'content/docs', -} as const - -const baseDir = path.join(process.cwd(), CONTENT_DIRS[contentKind]) +const baseDir = path.join(process.cwd(), 'content/' + contentKind) ``` **Correct: make each final path literal at the callsite** diff --git a/skills/react-best-practices/rules/bundle-analyzable-paths.md b/skills/react-best-practices/rules/bundle-analyzable-paths.md index 0b2e627..8276f15 100644 --- a/skills/react-best-practices/rules/bundle-analyzable-paths.md +++ b/skills/react-best-practices/rules/bundle-analyzable-paths.md @@ -46,12 +46,7 @@ const Page = await PAGE_MODULES[pageName]() **Incorrect (a 2-value enum still hides the final path from static analysis):** ```ts -const CONTENT_DIRS = { - blog: 'content/blog', - docs: 'content/docs', -} as const - -const baseDir = path.join(process.cwd(), CONTENT_DIRS[contentKind]) +const baseDir = path.join(process.cwd(), 'content/' + contentKind) ``` **Correct (make each final path literal at the callsite):** |
