Open
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
What version of ESLint are you using?
8.39.0
What version of eslint-plugin-svelte
are you using?
2.28.0
What did you do?
I'm showing here in eslint playground but the same thing happens in a .svelte
file, with both svelte/@typescript-eslint/no-unnecessary-condition
and @typescript-eslint/no-unnecessary-condition
<script>
export let href: string | undefined = undefined;
const url = href ?? 'http://example.com';
</script>
It will tell me that the href
condition check is unnecessary since it will always be null or undefined.
But it's an export
variable, so it might get some value from whoever is using the property, I've just defaulted it to undefined
if someone doesn't send it in.
What did you expect to happen?
No warning/error
What actually happened?
Warning: Unnecessary conditional, left-hand side of
??operator is always
nullor
undefined. 3:13 - 3:17
Link to GitHub Repo with Minimal Reproducible Example
Additional comments
No response