Open jhoermann opened 23 hours ago
This would require type information, so it would only be possible when typescript-eslint's parser is used.
Other patterns that should be reported:
(maybeRef ? x : y)
!maybeRef
maybeRef || x
maybeRef && y
maybeRef ?? x
x || maybeRef
x && maybeRef
x ?? maybeRef
maybeRef == x
maybeRef != x
maybeRef === x
maybeRef !== x
x == maybeRef
x != maybeRef
x === maybeRef
x !== maybeRef
Boolean(maybeRef)
String(maybeRef)
As a name, I'd suggest vue/require-mayberef-unwrap
Similar to
Please describe what the rule should do: Currently using a MaybeRef without using
unref
wouldn't lead to an eslint error:It should be enforced using unref in this case to prevent false positives in conditions.
Name of rule tbd.
What category should the rule belong to? [ ] Enforces code style (layout) [x] Warns about a potential error (problem) [ ] Suggests an alternate way of doing something (suggestion) [ ] Other (please specify:)