From e9b52b3dff8443731e92c70db4ec76b8293019eb Mon Sep 17 00:00:00 2001 From: Petr Pokorny Date: Tue, 21 Apr 2026 17:48:59 +0200 Subject: [PATCH] Fix F# style guide: remove LINQ reference, add missing patterns - Remove C#-ism: LINQ reference in 'break/continue' guidance - Add immutable collections: Map/list/Set over Dictionary/ResizeArray/List - Add string interpolation preference over sprintf - Add modern indexing syntax (no dot-bracket) - Add CSS-over-inline-styles guidance for Feliz views --- AGENTS.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 507c0d8..f85b56e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,7 +22,7 @@ This project uses strict functional F# style. These rules are non-negotiable. **Critical requirements:** - **NEVER use loops** — use recursion or higher-order functions (`List.map`, `List.filter`, `List.fold`, `Array.map`, `Seq.map`, etc.) - **NEVER use `let mutable`** — all bindings must be immutable; use recursion with accumulators or `fold` instead -- **NEVER use `break` or `continue`** — restructure with LINQ/higher-order functions +- **NEVER use `break` or `continue`** — restructure with higher-order functions - **NEVER pass collections into methods to be mutated** — return new collections instead **Patterns:** @@ -35,6 +35,10 @@ This project uses strict functional F# style. These rules are non-negotiable. - **Computation expressions** — `async`, `seq`, `result`, `asyncResult` for workflows - **F# 9 shorthand lambdas** — `_.Property`, `_.Method(arg)`, chained `_.Trim().ToUpper()`, nested `_.Value.Name` instead of `fun x -> ...`. No wrapping parens needed: `List.exists _.StartsWith("x")`. Only works with `.` member access — not operators or indexers. - **Type inference** — only annotate when needed for clarity +- **Immutable collections** — use F# `list`, `Map`, `Set` instead of `Dictionary<>`, `ResizeArray`, `List` (mutable .NET types) +- **String interpolation** — `$"text {x}"` instead of `sprintf "text %s" x` +- **Modern indexing** — `collection[0]` not `collection.[0]` (dot-bracket obsolete since F# 6) +- **CSS over inline styles** — use `prop.className` with CSS classes, not `style.*` in Feliz views (inline styles bypass the theme) - **`Path.Combine()`** for paths, **`Environment.NewLine`** for line endings **FsToolkit.ErrorHandling** (currently referenced in Server project, add to Client/Shared if needed):