language-tools
language-tools copied to clipboard
Support for baseline files in svelte-check
Description
I'm coming from a PHP ecosystem where all static type checkers have a feature called baseline files.
This feature essentially allows a central configuration file to silence specific errors in specific lines of code. Having it would solve many issues regarding the silencing of specific warnings, without having to change the source code itself.
However that's not the biggest benefit; it allows for gradual improvement of code bases.
Suppose I never ran svelte-check; my code compiles and it is working in production. I learn about svelte-check and now I want to use; the problem is my code base might have 100s of errors.
Proposed solution
Implement a baseline feature.
The baseline feature could look like this:
> svelte-check --generate-baseline .svelte-check-baseline.js
Running svelte-check, writing all errors to `.svelte-check-baseline.js`
- The baseline now contains all the errors in my code base, and it silences them by default.
- It will throw an error when a silenced error from the baseline is no longer in the code (prompting me to clean up my baseline)
The baseline is committed to the repo, and it allows me to add svelte-check to my CI on day 1. Even if it takes weeks to gradually improve my source code. Because of the way it works, any code I change will immediately be held to the new higher standard.
See: https://phpstan.org/user-guide/baseline and https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file
Alternatives
No response
Additional Information, eg. Screenshots
No response