FSharpLint icon indicating copy to clipboard operation
FSharpLint copied to clipboard

Add new rule FavourSingleton

Open su8898 opened this issue 3 years ago • 3 comments

Fixes https://github.com/fsprojects/FSharpLint/issues/526

su8898 avatar Dec 20 '21 15:12 su8898

I think it may be possible to express this as one of the hints, although I'm not averse to an additional rule either. Trade off is the rule is easier to ignore one rule specifically, but adding an additional hint should have better performance over an additional rule

(Also apologies, just merged in another PR so needs conflicts resolved)

duckmatt avatar Feb 27 '22 23:02 duckmatt

Disadvantages of converting this into a hint:

  1. Can't be disabled by default (and I've already known 2 people which don't like this rule).
  2. There's already a hint that recommends you to use [x] instead of x::[], so fixing this hint might lead to yet another hint, unless we change that hint to recommend a Singleton func, but should we? (See 1. :) )

knocte avatar May 06 '22 03:05 knocte

...just merged in another PR so needs conflicts resolved)

No worries, I'll rebase myself soon.

knocte avatar May 06 '22 03:05 knocte

Superseded by https://github.com/fsprojects/FSharpLint/pull/587

knocte avatar Nov 21 '22 10:11 knocte