Skip to content

Commit 798149b

Browse files
author
Jonathan D.A. Jewell
committed
chore: Add ReScript enforcement + conversion required (RSR policy)
This repo needs full TS/JS → ReScript conversion. See TS_CONVERSION_NEEDED.md for details.
1 parent a4ba141 commit 798149b

4 files changed

Lines changed: 84 additions & 0 deletions

File tree

.claude/CLAUDE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Project Instructions
2+
3+
## ⚠️ CONVERSION REQUIRED: TypeScript/JavaScript → ReScript
4+
5+
This repository needs FULL conversion from TS/JS to ReScript.
6+
7+
### Policy (RSR)
8+
- **REQUIRED**: ReScript for all code
9+
- **FORBIDDEN**: TypeScript (.ts, .tsx)
10+
- **FORBIDDEN**: JavaScript (.js, .jsx) except generated .res.js
11+
- **EXCEPTION**: WASM for performance-critical computation
12+
13+
### When modifying this codebase:
14+
1. DO NOT add new TS/JS files
15+
2. When touching existing TS/JS, convert to ReScript
16+
3. Create `.res` file with equivalent logic
17+
4. Delete the original TS/JS file
18+
5. Run `rescript build` to generate JS
19+
20+
### DO NOT:
21+
- Add new TypeScript files
22+
- Write raw JavaScript
23+
- Use tsc or TypeScript compiler
24+
25+
See TS_CONVERSION_NEEDED.md for full migration guide.

.github/workflows/ts-blocker.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: TypeScript/JavaScript Blocker
2+
on: [push, pull_request]
3+
jobs:
4+
check:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- name: Block new TypeScript/JavaScript
9+
run: |
10+
NEW_TS=$(git diff --name-only --diff-filter=A HEAD~1 2>/dev/null | grep -E '\.(ts|tsx)$' | grep -v '\.gen\.' || true)
11+
NEW_JS=$(git diff --name-only --diff-filter=A HEAD~1 2>/dev/null | grep -E '\.(js|jsx)$' | grep -v '\.res\.js$' | grep -v '\.gen\.' | grep -v 'node_modules' || true)
12+
13+
if [ -n "$NEW_TS" ] || [ -n "$NEW_JS" ]; then
14+
echo "❌ New TS/JS files detected. Use ReScript instead."
15+
[ -n "$NEW_TS" ] && echo "$NEW_TS"
16+
[ -n "$NEW_JS" ] && echo "$NEW_JS"
17+
exit 1
18+
fi
19+
echo "✅ ReScript policy enforced"

MANUAL_REVIEW_NEEDED.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ⚠️ Large Codebase - Manual Review Required
2+
3+
This repository has substantial TS/JS code (>5000 lines).
4+
5+
## Challenges
6+
- Large codebase requires careful migration planning
7+
- May have complex type dependencies
8+
- Third-party libraries may need bindings
9+
10+
## Recommended Approach
11+
1. **Audit**: Catalog all TS/JS files and dependencies
12+
2. **Prioritize**: Identify core vs peripheral code
13+
3. **Incremental**: Convert module by module
14+
4. **Test**: Ensure each converted module works
15+
5. **WASM**: Consider for heavy computation sections
16+
17+
## Do NOT attempt automated bulk conversion.

TS_CONVERSION_NEEDED.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# TypeScript/JavaScript → ReScript Conversion Required
2+
3+
This repository is **entirely TS/JS** and needs full conversion to ReScript.
4+
5+
## Conversion Steps
6+
1. Install ReScript: Add to deno.json or use npm: specifier
7+
2. Create `rescript.json` configuration
8+
3. For EACH file:
9+
- Create `.res` equivalent
10+
- Migrate types (ReScript has excellent type inference)
11+
- Update module imports
12+
- Test with `rescript build`
13+
4. Delete all `.ts`/`.tsx`/`.js`/`.jsx` files
14+
5. Remove TypeScript dependencies
15+
16+
## Policy
17+
- No NEW TypeScript/JavaScript allowed (CI enforced)
18+
- Existing code must be migrated to ReScript
19+
- Generated `.res.js` files are the output
20+
21+
## Resources
22+
- https://rescript-lang.org/docs/manual/latest/introduction
23+
- https://rescript-lang.org/docs/manual/latest/migrate-from-typescript

0 commit comments

Comments
 (0)