TSFluff icon indicating copy to clipboard operation
TSFluff copied to clipboard

Rule idea: overload-coverage

Open Legogris opened this issue 6 years ago • 1 comments

Promiscuous types and type unions in signatures are legacy JavaScript code-smell. TypeScript comes with an Expressive Type System that allows for expressions in type signatures. Any Haskell developer who has previously scoffed at the procedural nature of ES will feel right at home.

New rule

I propose introducing a rule that enforces good form by demanding a minimum overload coverage.

  • overload-coverage.

Example:

"overload-coverage": [
  true,
  {
    "require-returntype": true,
    "minimum-coverage": 0.8
  }
]

Options

  • minimum-coverage: Require at least this ratio of type signatures to be over,loads of another signature.
  • require-returntype: Require the return type to be different for a signature to count as different

Legogris avatar Aug 16 '18 19:08 Legogris

This is horrific, I love it

bencoveney avatar Aug 17 '18 17:08 bencoveney