fi3ework / vite-plugin-checker

💬 Vite plugin that provide checks of TypeScript, ESLint, vue-tsc, Stylelint and more.
https://vite-plugin-checker.netlify.app
MIT License
980 stars 84 forks source link

Vue2 + Typescript (vls): Customizing vls options causes wrong invocation of vti in build mode and resulting in NO TYPECHECKING of builds #178

Open kije opened 1 year ago

kije commented 1 year ago

Describe the bug

When using vite-plugin-checker with a Vue2 + TypeScript setup (so using the vls option), and customizing the vls option, the invocation of vti diagnostics in build mode is wrong, as the JSON.stringify-ed version of the option are just passed to vti diagnostics as an argument, but vti diagnostics does not support this style of option passing, and just appends the string to the workspace path. This then results in vti not type checking anything, since it can't find any files in that path.

// vite.config.js
const { checker } = require("vite-plugin-checker");
const { defineConfig } = require("vite");

module.exports = defineConfig({
  plugins: [
    checker({
      typescript: true,
      vls: {
        vetur: {
          validation: {
            templateProps: false,
            style: false
          }
        }
      },
    })
  ]
});

Output of vite build:

transforming (1) index.html====================================
Getting Vetur diagnostics
Loading Vetur in workspace path: /Development/www/my-project/{"vetur":{"validation":{"templateProps":false,"style":false}}}
Vetur initialized
====================================
No input files
====================================
VTI found no error
✓ 113 modules transformed.

Note the line Loading Vetur in workspace path: /Development/www/my-project/{"vetur":{"validation":{"templateProps":false,"style":false}}}

Thus, any typescript errors in Vue components are not checked during build. In dev mode, everything works fine, and typechecking is performed correctly.

The bug must have been introduced somewhere between 1.8.2 and 2.2.0

Reproduction

Expected behavior

When customizing the vls option according to the documentation, typechecking should still work in build mode!

System Info

System:
    OS: macOS 12.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 769.68 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.4.0 - ~/.nvm/versions/node/v18.4.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.13.0 - ~/.nvm/versions/node/v18.4.0/bin/npm
  Browsers:
    Brave Browser: 102.1.39.111
    Chrome: 106.0.5249.119
    Chrome Canary: 108.0.5359.0
    Firefox: 105.0.3
    Firefox Developer Edition: 89.0
    Safari: 15.5
    Safari Technology Preview: 16.0
  npmPackages:
    vite-plugin-checker: ^0.5.1 => 0.5.1 
    vls: ^0.8.1 => 0.8.1
    vti: ^0.1.7 => 0.1.7

Additional context

No response

Validations

skkakaka2 commented 4 months ago

I have the same question. Has the author given up on maintenance?