Closed qupig closed 1 month ago
I think just you can override ESLint config. e.g.
import eslintPluginSvelte from 'eslint-plugin-svelte';
export default [
// https://github.com/sveltejs/eslint-plugin-svelte
...eslintPluginSvelte.configs['flat/recommended'],
{
rules: {
'svelte/valid-compile': 'warn',
},
},
];
Why does the plugin report higher level errors than the svelte compiler? Why not use the same warning level?
recommended
config is just recommended rule set. Feel free to change the settings if you are unhappy with them in you eslint config file.
The Svelte compiler sometimes uses the warning level because it also need to consider about backwards compatibility and other considerations.
So what you mean is that the plugin's ruleset can only report an error
to eslint and not a warn
?
Or is the rule set unable to distinguish between different levels of warn/error in that svelte/valid-compile
set?
So the question is, is lowering the level of the entire svelte/valid-compile
set for this particular warn the only option?
UPDATE: Forget about it, it's always possible to add ugly comments to line: // eslint-disable-next-line svelte/valid-compile
Otherwise shouldn't the plugin be passed to eslint the same warning level produced by the svelte compiler?
The svelte compiler throws an error when the code can not compile. ESLint throws an error when a user wants to throw.
The semantics of error differs between the Svelte compiler and ESLint.
shouldn't the plugin be passed to eslint the same warning level produced by the svelte compiler?
This is possible within the ESLint plugin code, but users can not do fine-grained configure. So, at present, everything is set to error/warn.
If there is a problem, you should disable the ESLint rule and make the warning from the Svelte compiler an error, which can be achieved with the onwarn option in vite-plugin-svelte.
https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#config-file
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
9.3.0
What version of
eslint-plugin-svelte
are you using?2.39.0
What did you do?
Configuration
import eslintPluginSvelte from 'eslint-plugin-svelte'; export default [ ...eslintPluginSvelte.configs['flat/recommended'], ];Check the console output of the following commands in StackBlitz-Demo.
Also in Svelte5-REPL.
What did you expect to happen?
"eslint-plugin-svelte" should report the same error level as the svelte compiler.
What actually happened?
Link to GitHub Repo with Minimal Reproducible Example
This is easy to reproduce, everything is configured as default.
If you don't want to fix it, feel free, I'm reporting this issue for the third time.
Sorry, I don't have more time to make a GitHub repository for you.
(Also, please don’t ask for "minimal reproduction" TWICE in the issue template and demand for the GitHub Repo the second time!)
Additional comments
Related issue: https://github.com/sveltejs/svelte/issues/11818