Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/react-best-practices-build/test-cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -1111,4 +1111,4 @@
"language": "tsx",
"description": "serializes only 1 field"
}
]
]
7 changes: 1 addition & 6 deletions skills/react-best-practices/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
7 changes: 1 addition & 6 deletions skills/react-best-practices/rules/bundle-analyzable-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):**
Expand Down
Loading