-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Warnings: Add info if warning can be ignored #5281
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
Comments
Maybe it's also a bug because every warning should be ignorable? Not sure. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still want this |
Looked into this a little. Seems like the problem for all css/js warnings is that the "should be ignored"-code does not apply there because the "ignore next thing"-logic only runs on the template, not in css/js. That would need to be added I guess. |
including css-unused-selector, unused-export-let, module-script-reactive-declaration Fixes sveltejs#5954 Related to sveltejs#5281
Looking back at this, I believe that it should be seen as a bug and/or unavoidable consequence of how things are structure in the compiler when something can't be ignored. In other words, one should be expected to ignore all errors (in reality: 99% of them). I think this is already pretty much achieved by now both in Svelte 4 and 5, which is why I would be good with closing this. |
Is your feature request related to a problem? Please describe.
Over at the language-tools repo we get bug reports that people cannot disable warnings. Most can be disabled, but some apparently can't. This is the most recent issue where someone asks how to disable the warnings for unused selectors: sveltejs/language-tools#457 .
According to this PR it should be possible to silence errors / prevent the compiler from returning them by adding a
svelte-ignore
comment above it, for example<!-- svelte-ignore some-a11y-warning-code -->
.Describe the solution you'd like
I would like the compiler to add a property like
canIgnore: false
to the warning, if the warning cannot be disabled. We could use that so that a quickfix to add thesvelte-ignore
comment no longer appears. We then could also add additional text to the message in the IDE ("this warning cannot be ignored through a comment").Describe alternatives you've considered
Gradually add things to a blacklist without knowing if that's really correct.
How important is this feature to you?
Nice to have, would clean up confusion.
Additional context
In order to implement this, I propose to move out all warnings into a separate, common file, where they are listed in a concise manner. People could get a nice overview of all warnings that are possible. Rich also pointed out that this would be good in the PR which implemented the
svelte-ignore
-comments.The text was updated successfully, but these errors were encountered: