vite-plugin-checker icon indicating copy to clipboard operation
vite-plugin-checker copied to clipboard

"Report only" mode for typescript?

Open justinhelmer opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

We use this tool to have typechecking in vite projects. We have a use-case where we are trying to progressively migrate a project from .js to .ts. As such, there are a ton of TypeScript issues today.

Describe the solution you'd like

What we would like to have the plugin do, is report on typescript errors - but not fail the build. This way, vite will still build the project, and the console will still output all of the type failures.

Describe alternatives you've considered

We can run tsc --noEmit || exit 0 as part of the build process, but ideally it would be part of this plugin as a configuration option so that we can just have a single build command that we run locally & in CI, and then "flip the switch" when we are ready to start failing.

Additional context

No response

Validations

  • [X] Read the docs.
  • [X] Read the Contributing Guidelines.
  • [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.

justinhelmer avatar Feb 21 '23 18:02 justinhelmer

There's an option you can pass to the plugin that will disable running checks on build! I use it on all my projects as I have explicit type checking configured as part of my CI pipeline anyway, and it's nice to be able to build unfinished code sometimes.

checker({
  enableBuild: false,
});

danielwaltz avatar Feb 21 '23 22:02 danielwaltz

@danielwaltz - Thanks for the tip! I had not considered the shared options.

However, this does not appear to do what I was hoping. Having the type errors in serve mode is great, but what I would like to accomplish is still getting the diagnostic reporting in build mode, without it failing the build.

I want the console output to be noisy when building but still exit 0 for CI/CD, and so that we can still build unfinished code as you mentioned.

This is really a nice-to-have because we can accomplish this with a separate command (i.e. tsc --noEmit || exit 0) but would ideally roll it all into the build pipeline for consistency between build and serve.

justinhelmer avatar Feb 22 '23 13:02 justinhelmer