workadventure icon indicating copy to clipboard operation
workadventure copied to clipboard

Improve typing to find strange bugs

Open Nolway opened this issue 1 year ago • 1 comments

Hello, dear WA team =)

I think a lot of strange bugs can be detected with small improvements to the linting rules.

The first is to add this library, which will add a new rule to avoid the type assertion: https://www.npmjs.com/package/eslint-plugin-no-type-assertion

The second is to add the @typescript-eslint/no-unnecessary-condition which will display an error if you are try to add a unnecessary condition on your code.

I believe that these rules are the most important and that they help avoid many bugs.

There more rules can be interesting like:

  • @typescript-eslint/no-unsafe-return
  • @typescript-eslint/no-unsafe-argument
  • @typescript-eslint/no-unsafe-call
  • @typescript-eslint/restrict-plus-operands

At the moment, I don't have the time to implement these rules, but if you agree, I may be able to do so later.

Nolway avatar Feb 21 '24 10:02 Nolway

Hellloooooo!

More ruuuuules! YEAH! I'll take a look. Don't hesitate to submit a PR if you feel like it of course!

The second is to add the @typescript-eslint/no-unnecessary-condition which will display an error if you are try to add a unnecessary condition on your code.

Are you talking about this PR? => https://github.com/workadventure/workadventure/pull/3679

moufmouf avatar Feb 29 '24 09:02 moufmouf