dart-code-metrics icon indicating copy to clipboard operation
dart-code-metrics copied to clipboard

[Rule change] `avoid-unrelated-type-assertions` should work with `is!`

Open ookami-kb opened this issue 3 years ago • 0 comments

What rule do you want to change?

avoid-unrelated-type-assertions

How will the change be implemented? (New option, new default behavior, etc.)?

New behavior: it should trigger warning on is! operator.

Please provide some example code that this change will affect:

From the current rule example:

final result3 = animal is! NotAnimal; // LINT

What does the rule currently do for this code?

No lint warning triggered.

What will the rule do after it's changed?

Lint warning triggered.

Are you willing to submit a pull request to implement this change?

Not sure.

ookami-kb avatar Jun 13 '22 21:06 ookami-kb

@ookami-kb what do you think if instead of modifying the avoid-unrelated-type-assertions rule, the change will be applied to avoid-unnecessary-type-assertions?

incendial avatar Sep 10 '22 16:09 incendial

Available in 4.18.0 🚀

incendial avatar Sep 12 '22 15:09 incendial