Skip to content

Commit 16ecb20

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 74c8a4b commit 16ecb20

3 files changed

Lines changed: 60 additions & 21 deletions

File tree

.claude/CLAUDE.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
# Project Instructions
22

3-
## ⚠️ CONVERSION NEEDED: npmDeno
3+
## ⚠️ CONVERSION REQUIRED: TypeScript/JavaScriptReScript
44

5-
This repo currently uses npm but needs to be converted to Deno.
5+
This repository needs FULL conversion from TS/JS to ReScript.
66

7-
### DO NOT:
8-
- Run `npm install`
9-
- Add new npm dependencies
10-
- Create package-lock.json
11-
12-
### INSTEAD:
13-
- Use `deno task` for scripts
14-
- Use npm: specifiers for dependencies (e.g., `import X from "npm:package"`)
15-
- Create deno.json instead of package.json
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
1612

17-
### Conversion Steps:
18-
1. Analyze package.json dependencies
19-
2. Create deno.json with equivalent imports/tasks
20-
3. Update source files to use Deno imports
21-
4. Remove package.json and package-lock.json
22-
5. Test with `deno check` and `deno test`
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
2319

24-
## Package Manager Policy (RSR)
20+
### DO NOT:
21+
- Add new TypeScript files
22+
- Write raw JavaScript
23+
- Use tsc or TypeScript compiler
2524

26-
- **REQUIRED**: Deno for JavaScript/TypeScript
27-
- **FORBIDDEN**: npm, npx, node_modules (after conversion)
28-
- **FALLBACK**: Bun only if Deno is impossible
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"

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)