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

Warnings: Add info if warning can be ignored #5281

Closed
dummdidumm opened this issue Aug 16, 2020 · 5 comments
Closed

Warnings: Add info if warning can be ignored #5281

dummdidumm opened this issue Aug 16, 2020 · 5 comments
Labels
compiler Changes relating to the compiler
Milestone

Comments

@dummdidumm
Copy link
Member

dummdidumm commented Aug 16, 2020

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 the svelte-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.

@dummdidumm dummdidumm changed the title Warnings: Add info if warning can be disabled Warnings: Add info if warning can be ignored Aug 16, 2020
@dummdidumm
Copy link
Member Author

Maybe it's also a bug because every warning should be ignorable? Not sure.

@Conduitry Conduitry added the awaiting submitter needs a reproduction, or clarification label Sep 10, 2020
@stale
Copy link

stale bot commented Jun 27, 2021

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.

@stale stale bot added the stale-bot label Jun 27, 2021
@dummdidumm
Copy link
Member Author

Still want this

@dummdidumm
Copy link
Member Author

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.

@dummdidumm dummdidumm added compiler Changes relating to the compiler and removed awaiting submitter needs a reproduction, or clarification labels Jul 6, 2021
dummdidumm pushed a commit to dummdidumm/svelte that referenced this issue Jul 7, 2021
including css-unused-selector, unused-export-let, module-script-reactive-declaration
Fixes sveltejs#5954
Related to sveltejs#5281
dummdidumm added a commit that referenced this issue Jul 14, 2021
including css-unused-selector, unused-export-let, module-script-reactive-declaration
Fixes #5954
Related to #5281
@Rich-Harris Rich-Harris added this to the 5.0 milestone Apr 2, 2024
@dummdidumm
Copy link
Member Author

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.

@dummdidumm dummdidumm closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Changes relating to the compiler
Projects
None yet
Development

No branches or pull requests

3 participants