-
Notifications
You must be signed in to change notification settings - Fork 149
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
Components used in Pug cause warning declared but its value is never read
#266
Comments
Hey @probablykasper 👋 This seems to be a duplicate of #207 |
@kaisermann I don't think it is, because in that issue the problem is variables created by Pug. In this case, the variable is created in TypeScript |
@kaisermann Got any thoughts on this issue? |
declared but its value is never read
@kaisermann Would love to know what could be done about this. Svelte's Pug support seems quite spotty considering the invalid warnings and errors it generates. Perhaps there should be a note about this if it's not something that's likely to improve anytime soon. |
Hey @probablykasper 👋 Unfortunately there's not much I can do from this side (see #207 (comment)). A comment about the semi-support for pug could be nice, yeah! |
@kaisermann I don't quite understand. Is the issue that Pug can't be compiled synchronously? |
The problem is that pug does not provide source maps by itself, and that the source mapper we use is asynchronous. We also cannot know which other preprocessors people might mix in, and those could be asynchronous. |
@dummdidumm But why would a source map be needed to tell if a component is used or not? I would think that source maps are useful when you have an error and you want to show it in the right place, but not when you have an error that shouldn't exist. |
You can turn off diagnostics and not get false errors that way. We could also investigate turning off diagnostics if we detect pug in the template. |
@dummdidumm What are the source maps needed for in this case? |
Describe the bug
As you can see in the screenshot below, the Svelte VSCode extension does not see that
Router
andNested
are used inside<Template>
. It does however detect thatroutes
was used.This issue is also mentioned when running
svelte-check
, so it's not caused by the text editor. My guess is that this is an issue with svelte-preprocess, but may very well be something else.To Reproduce
Use a component inside a
<template lang='pug'>
block.Information about your project:
svelte-preprocess
version 4.4.2The text was updated successfully, but these errors were encountered: