Skip to content

Commit 74962b8

Browse files
authored
Merge PR #775 from knocte/wip/miscImprovements
Misc improvements.
2 parents 29c06d2 + 9838c69 commit 74962b8

File tree

3 files changed

+4
-54
lines changed

3 files changed

+4
-54
lines changed

.github/copilot-instructions.md

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,7 @@ We prefer the latest F# 9 features over the old syntax
22

33
Prefer `voption` over `option`
44

5-
Prefer `task` CE over `async` CE
5+
Prefer `async` CE over `task` CE
66

7-
This is how you define a non-default F# class constructor:
8-
```fsharp
9-
type DerivedClass =
10-
inherit BaseClass
11-
12-
new (``arguments here``) as ``created object``
13-
=
14-
// create any objects used in the base class constructor
15-
let fieldValue = ""
16-
{
17-
inherit
18-
BaseClass (``arguments here``)
19-
}
20-
then
21-
``created object``.otherField <- fieldValue
22-
23-
[<DefaultValue>]
24-
val mutable otherField : FieldType
25-
```
26-
27-
Always prefer F# class initializers over property assignment! **You absolutely must use F# class initializers instead of property assignment**!
28-
29-
Class declaration:
30-
``` F#
31-
type MyClass (someConstructorParam : string) =
32-
member ReadOnlyProperty = someConstructorParam
33-
34-
member val MutableProperty1 = "" with get, set
35-
member val MutableProperty2 = "" with get, set
36-
```
37-
38-
Wrong:
39-
``` F#
40-
let myClass = MyClass("some value")
41-
myClass.MutableProperty1 <- "new value"
42-
myClass.MutableProperty2 <- "new value"
43-
```
44-
45-
Right:
46-
``` F#
47-
let myClass =
48-
MyClass(
49-
// constructor parameters go first without names
50-
"some value",
51-
// then mutable properties go next with names
52-
MutableProperty1 = "new value",
53-
MutableProperty2 =
54-
// operations must be placed into parentheses
55-
(5 |> string)
56-
)
57-
```
7+
Prefer idiomatic F#, that is, code that favors composition over inheritance,
8+
and leans to immutability (pure functions, usage of thread-safe collections, etc.)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License
22

3-
Copyright (c) 2014-2024 FSharpLint contributors
3+
Copyright (c) 2014-2025 FSharpLint contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

src/FSharpLint.Core/Rules/Identifiers.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// fsharplint:disable FL0046
21
module FSharpLint.Rules.Identifiers
32

43
let [<Literal>] private Prefix = "FL"

0 commit comments

Comments
 (0)