sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.25k stars 200 forks source link

svelte-check --compiler-warnings ignored when tsconfig.json has compilerOptions #2588

Open jnikula opened 11 hours ago

jnikula commented 11 hours ago

Describe the bug

Upgraded to svelte 5. Started getting:

tsconfig.json:7:3
Error: 'forceConsistentCasingInFileNames' should be set inside the 'compilerOptions' object of the config json file 

Tried to move it to compilerOptions, but simply adding compilerOptions in tsconfig.json apparently makes svelte-check ignore the --compiler-warnings command-line option set in package.json. I get a plethora of warnings that should've been ignored.

Reproduction

Add --compiler-warnings option to svelte-check in package.json to ignore some warning.

Hit that warning.

Add compilerOptions object in tsconfig.json. The object doesn't have to have anything meaningful, simply its presence will make svelte-check ignore the --compiler-warnings option.

Expected behaviour

I'd expect command-line options to amend whatever is in the config file, not to be ignored. The minimum would be a warning about command-line options being incompatible with configuration.

System Info

Which package is the issue about?

svelte-check

Additional Information, eg. Screenshots

No response

jnikula commented 10 hours ago

I tried adding warningFilter in compilerOptions in svelte.config.js, and that can be used to replace the --compiler-warnings command-line option. However, that too gets ignored when I set compilerOptions in tsconfig.json.

I'm pretty much lost on how all these things should be working together. Bottom line, this is blocking my Svelte 5 migration.

dummdidumm commented 10 hours ago

Please provide a reproduction repository. I have no idea what the warnings are that are supposed to not show up and what the code is that makes them appear.

jnikula commented 10 hours ago

The repo is https://github.com/groovescore/snooker-scoreboard and the reproduction branches there are:

I just don't know how to both keep the warning ignores/filters I have and fix the new warning introduced during the migration.

jasonlyu123 commented 7 hours ago

It's not that the --compiler-warnings is ignored when there is compilerOptions in your tsconfig. It's because you encounter two breaking changes from svelte-check and svelte. In svelte-check v4, errors in tsconfig.json will prevent further checks. And in svelte 5, the warning is renamed.

Maybe we could map the --compiler-warnings to its new name or issue a warning when the flag is passed with the old naming scheme, i.e., - instead of _. But because of how the warning filtering works, we can't map the code to the new code for you. You have to use the new names.