-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Ignore specific warnings of svelte-check #311
Comments
Thank you for posting issue. How about using The svelte compiler doesn't seem to have an option to ignore specific warnings, so I don't think there's anything we can do with rule. |
Yep, the comments work. |
https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#onwarn |
No, I would like to silence the linter and it doesn't seem to care :D |
Hmm... svelte-check seems to filter on its own. I found a related issue, but I'm not sure why decided to add the option in the language tools instead of adding it to svelte's compiler 🤔. |
I would like to follow up on this real quick. I have no new insight or anything, but to move things forward, could we expose this array to the rule's settings? Just like the language tools have an ignore list to configure, maybe we can have one too until the Svelte compiler offers a solution? |
When does the Svelte compiler offer that solution? I think you should ask the Svelte compiler to add an option to ignore warnings first. If there's a reason the Svelte team doesn't provide an ignore option, I don't think we should add it either. |
Svelte offers command line flags to disable certain warnings for the svelte-check tool, like so:
I think this is the closes the user usually gets in touch with the compiler, so I would argue that they already provide a way to the user to ignore specific warnings in their tooling. However I do not know if they also do through the compiler API. Further, I understand your point, but I was hoping we could still have this. It could be through some flag that makes sure it's simply filtering out the error codes and the errors are still there but hidden. It could be something like |
I looked into svelte's issues. It seems to me that it is up to the compiler API caller to decide how to handle the warning. So if the user wants to suppress warnings globally, I think it is intended to be controlled by the compiler API caller. Also, since most bundler svelte plugins seem to be designed to globally suppress warnings with the |
I am also interested in this. See: sveltejs/language-tools#650 |
How about this? |
ESLint configuration files can also be defined in JSON or YAML, so I still have no idea how to define |
By the way, JSON and YAML configuration files may be deprecated after ESLint v9. But for now we support ESLint>=v7. |
Maybe we can use similar settings as the one for the VSCode plugin? We could have an object like this: {
"ignore": [
"a11y-no-static-element-interactions",
"a11y-...",
"a11y-..."
],
"warn": [
"a11y-no-onchange",
"a11y-..."
],
"error": [
"a11y-aria-unsupported-elements",
"a11y-..."
]
} Anything in IT would work in YAML + JSON and is exportable from a JS module. Maybe not a final solution, but a good start to move things forward? |
Is there any documentation for that settings? I couldn't find that documentation. |
There is a setting svelte.plugin.svelte.compilerWarnings. However the settings are simple KV pairs there: {
"a11y-...": "ignore"
} instead of the grouping I suggested. But that's kind of what I meant. If you install the Svelte Plugin in VSCode and go to the plugin's settings you will find the option to enter some errors. If you then open the Edit: see sveltejs/language-tools#650 (comment) for step-by-step instructions. |
I don't think there is a need for some complex It can be plugged into eslint-plugin-svelte/src/rules/valid-compile.ts Lines 31 to 37 in 9e5da94
|
To silent most of the blue warning, do this, In VScode setting.json, add this
In svelte.config file, do this const config = {
preprocess: vitePreprocess(),
onwarn: (warning, handler) => {
if (warning.code.startsWith('a11y-')) return
if (warning.code === 'missing-exports-condition') return
if (warning.code === 'a11y-no-static-element-interactions') return
if (warning.code === 'svelte-ignore a11y-autofocus') return
if (warning.code.startsWith('css-unused-selector')) return
handler(warning)
},
kit: {
adapter: adapter(),
},
} Just add more rules that you don't like to those two places. it will shut up. |
Description
For
eslint-plugin-svelte3
there issvelte3/compiler-options
orsvelte3/ignore-warnings
to ignore some specified compiler warnings, for example all the a11y warnings.For this plugin I can't seem to find something similar. I can disable the
valid-compile
rule all together, yet that's a bit unspecific. I could try to disable the warning in my svelte.config.js by defining aconfig.onwarn
function but this does not seem to work with vite/kit.I suggest to provide a way to ignore specific warnings of the svelte compiler, as I think it might be quite handy.
The text was updated successfully, but these errors were encountered: