Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a store with an action or transition directive does not count as used #877

Closed
geoffrich opened this issue Mar 13, 2021 · 0 comments
Closed
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@geoffrich
Copy link
Member

Describe the bug
If I use the value of a store in an action or transition directive using the $ shorthand, VSCode still thinks the store variable is unused.

To Reproduce
Try creating a Svelte component with the following code snippet:

<script>
	import { fly } from 'svelte/transition';
	import { readable } from 'svelte/store';

	const transitionStore = new readable(fly);
	const actionStore = new readable((node) => {
		console.log(node);
	});
</script>

<div transition:$transitionStore={{ y: 100 }} use:$actionStore>
	I'm some content
</div>

Both stores are marked as unused despite being used in the directives (see screenshots below).

If the stores are in the same file as the component, this is only a mild annoyance. However, if they are imported from a different file, the imports are removed when you run "Organize imports" since VSCode thinks they aren't used.

Expected behavior
Using a store value means the store variable is not marked unused.

Screenshots
image

System (please complete the following information):

  • OS: Windows 10 (WSL 2 with the Ubuntu distro)
  • IDE: VSCode
  • Plugin/Package: Svelte for VSCode
@geoffrich geoffrich added the bug Something isn't working label Mar 13, 2021
dummdidumm pushed a commit to dummdidumm/language-tools that referenced this issue Mar 17, 2021
animate/transition/action can use $stores, too
sveltejs#877
dummdidumm added a commit that referenced this issue Mar 19, 2021
animate/transition/action can use $stores, too
#877
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

2 participants